1. 01 Oct, 2015 2 commits
  2. 27 Jul, 2015 1 commit
  3. 26 Jul, 2015 6 commits
  4. 16 Jul, 2015 1 commit
  5. 14 Jul, 2015 3 commits
  6. 23 Jan, 2015 1 commit
    • antirez's avatar
      DEBUG structsize · 7885e126
      antirez authored
      Show sizes of a few important data structures in Redis. More missing.
      7885e126
  7. 19 Jan, 2015 1 commit
    • Matt Stancliff's avatar
      Improve RDB type correctness · f7043604
      Matt Stancliff authored
      It's possible large objects could be larger than 'int', so let's
      upgrade all size counters to ssize_t.
      
      This also fixes rdbSaveObject serialized bytes calculation.
      Since entire serializations of data structures can be large,
      so we don't want to limit their calculated size to a 32 bit signed max.
      
      This commit increases object size calculation and
      cascades the change back up to serializedlength printing.
      
      Before:
      127.0.0.1:6379> debug object hihihi
      ... encoding:quicklist serializedlength:-2147483559 ...
      
      After:
      127.0.0.1:6379> debug object hihihi
      ... encoding:quicklist serializedlength:2147483737 ...
      f7043604
  8. 12 Jan, 2015 2 commits
  9. 02 Jan, 2015 3 commits
    • Matt Stancliff's avatar
      Add more quicklist info to DEBUG OBJECT · 9e11d079
      Matt Stancliff authored
      Adds: ql_compressed (boolean, 1 if compression enabled for list, 0
      otherwise)
      Adds: ql_uncompressed_size (actual uncompressed size of all quicklistNodes)
      Adds: ql_ziplist_max (quicklist max ziplist fill factor)
      
      Compression ratio of the list is then ql_uncompressed_size / serializedlength
      
      We report ql_uncompressed_size for all quicklists because serializedlength
      is a _compressed_ representation anyway.
      
      Sample output from a large list:
      127.0.0.1:6379> llen abc
      (integer) 38370061
      127.0.0.1:6379> debug object abc
      Value at:0x7ff97b51d140 refcount:1 encoding:quicklist serializedlength:19878335 lru:9718164 lru_seconds_idle:5 ql_nodes:21945 ql_avg_node:1748.46 ql_ziplist_max:-2 ql_compressed:0 ql_uncompressed_size:1643187761
      (1.36s)
      
      The 1.36s result time is because rdbSavedObjectLen() is serializing the
      object, not because of any new stats reporting.
      
      If we run DEBUG OBJECT on a compressed list, DEBUG OBJECT takes almost *zero*
      time because rdbSavedObjectLen() reuses already-compressed ziplists:
      127.0.0.1:6379> debug object abc
      Value at:0x7fe5c5800040 refcount:1 encoding:quicklist serializedlength:19878335 lru:9718109 lru_seconds_idle:5 ql_nodes:21945 ql_avg_node:1748.46 ql_ziplist_max:-2 ql_compressed:1 ql_uncompressed_size:1643187761
      9e11d079
    • Matt Stancliff's avatar
      Allow compression of interior quicklist nodes · abdd1414
      Matt Stancliff authored
      Let user set how many nodes to *not* compress.
      
      We can specify a compression "depth" of how many nodes
      to leave uncompressed on each end of the quicklist.
      
      Depth 0 = disable compression.
      Depth 1 = only leave head/tail uncompressed.
        - (read as: "skip 1 node on each end of the list before compressing")
      Depth 2 = leave head, head->next, tail->prev, tail uncompressed.
        - ("skip 2 nodes on each end of the list before compressing")
      Depth 3 = Depth 2 + head->next->next + tail->prev->prev
        - ("skip 3 nodes...")
      etc.
      
      This also:
        - updates RDB storage to use native quicklist compression (if node is
          already compressed) instead of uncompressing, generating the RDB string,
          then re-compressing the quicklist node.
        - internalizes the "fill" parameter for the quicklist so we don't
          need to pass it to _every_ function.  Now it's just a property of
          the list.
        - allows a runtime-configurable compression option, so we can
          expose a compresion parameter in the configuration file if people
          want to trade slight request-per-second performance for up to 90%+
          memory savings in some situations.
        - updates the quicklist tests to do multiple passes: 200k+ tests now.
      abdd1414
    • Matt Stancliff's avatar
      Add quicklist info to DEBUG OBJECT · 5127e399
      Matt Stancliff authored
      Added field 'ql_nodes' and 'ql_avg_per_node'.
      
      ql_nodes is the number of quicklist nodes in the quicklist.
      ql_avg_node is the average fill level in each quicklist node. (LLEN / QL_NODES)
      
      Sample output:
      127.0.0.1:6379> DEBUG object b
      Value at:0x7fa42bf2fed0 refcount:1 encoding:quicklist serializedlength:18489 lru:8983768 lru_seconds_idle:3 ql_nodes:430 ql_avg_per_node:511.73
      127.0.0.1:6379> llen b
      (integer) 220044
      5127e399
  10. 23 Dec, 2014 1 commit
    • Matt Stancliff's avatar
      Add DEBUG JEMALLOC INFO · 27937c28
      Matt Stancliff authored
      Uses jemalloc function malloc_stats_print() to return
      stats about what jemalloc has allocated internally.
      27937c28
  11. 10 Dec, 2014 1 commit
    • antirez's avatar
      Better read-only behavior for expired keys in slaves. · 06e76bc3
      antirez authored
      Slaves key expire is orchestrated by the master. Sometimes the master
      will send the synthesized DEL to expire keys on the slave with a non
      trivial delay (when the key is not accessed, only the incremental expiry
      algorithm will expire it in background).
      
      During that time, a key is logically expired, but slaves still return
      the key if you GET (or whatever) it. This is a bad behavior.
      
      However we can't simply trust the slave view of the key, since we need
      the master to be able to send write commands to update the slave data
      set, and DELs should only happen when the key is expired in the master
      in order to ensure consistency.
      
      However 99.99% of the issues with this behavior is when a client which
      is not a master sends a read only command. In this case we are safe and
      can consider the key as non existing.
      
      This commit does a few changes in order to make this sane:
      
      1. lookupKeyRead() is modified in order to return NULL if the above
      conditions are met.
      2. Calls to lookupKeyRead() in commands actually writing to the data set
      are repliaced with calls to lookupKeyWrite().
      
      There are redundand checks, so for example, if in "2" something was
      overlooked, we should be still safe, since anyway, when the master
      writes the behavior is to don't care about what expireIfneeded()
      returns.
      
      This commit is related to  #1768, #1770, #2131.
      06e76bc3
  12. 26 Nov, 2014 1 commit
    • antirez's avatar
      Fix DEBUG OBJECT lru field to report seconds. · acf73a05
      antirez authored
      Because of (not so) recent Redis changes, now the LRU internally
      reported unit is milliseconds, not seconds, but the DEBUG OBJECT output
      was still claiming seconds while providing milliseconds.
      However OBJECT IDLETIME was working as expected, which is the correct
      API to use.
      acf73a05
  13. 11 Nov, 2014 1 commit
  14. 09 Oct, 2014 1 commit
  15. 29 Sep, 2014 1 commit
  16. 25 Sep, 2014 1 commit
    • antirez's avatar
      DEBUG POPULATE two args form implemented. · d4222e6b
      antirez authored
      The old DEBUG POPULATE form for automatic creation of test keys is:
      
          DEBUG POPULATE <count>
      
      Now an additional form is available:
      
          DEBUG POPULATE <count> <prefix>
      
      When prefix is not specified, it defaults to "key", so the keys are
      named incrementally from key:0 to key:<count-1>. Otherwise the specified
      prefix is used instead of "key".
      
      The command is useful in order to populate different Redis instances
      with key names guaranteed to don't collide. There are other debugging
      uses, for example it is possible to add additional N keys using a count
      of N and a random prefix at every call.
      d4222e6b
  17. 27 Jun, 2014 1 commit
  18. 28 May, 2014 1 commit
  19. 26 May, 2014 1 commit
  20. 12 May, 2014 1 commit
  21. 09 May, 2014 1 commit
  22. 28 Apr, 2014 1 commit
    • antirez's avatar
      CLIENT LIST speedup via peerid caching + smart allocation. · 0bcc7cb4
      antirez authored
      This commit adds peer ID caching in the client structure plus an API
      change and the use of sdsMakeRoomFor() in order to improve the
      reallocation pattern to generate the CLIENT LIST output.
      
      Both the changes account for a very significant speedup.
      0bcc7cb4
  23. 20 Mar, 2014 1 commit
  24. 10 Mar, 2014 3 commits
    • antirez's avatar
      DEBUG ERROR implemented. · 8eae54aa
      antirez authored
      The new "error" subcommand of the DEBUG command can reply with an user
      selected error, specified as its sole argument:
      
          DEBUG ERROR "LOADING please wait..."
      
      The error is generated just prefixing the command argument with a "-"
      character, and replacing newlines with spaces (since error replies can't
      include newlines).
      
      The goal of the command is to help in Client libraries unit tests by
      making simple to simulate a command call triggering a given error.
      8eae54aa
    • antirez's avatar
      DEBUG CMDKEYS: provide some guarantee to getKeysFromCommand(). · 2705306b
      antirez authored
      getKeysFromCommand() is designed to be called with the command arguments
      passing the basic arity checks described in the command table.
      
      DEBUG CMDKEYS must provide the same guarantees for calling
      getKeysFromCommand() to be safe.
      2705306b
    • antirez's avatar
      DEBUG CMDKEYS added for getKeysFromCommand() testing. · c4ef1d64
      antirez authored
      Examples:
      
          redis 127.0.0.1:6379> debug cmdkeys set foo bar
          1) "foo"
          redis 127.0.0.1:6379> debug cmdkeys mget a b c
          1) "a"
          2) "b"
          3) "c"
          redis 127.0.0.1:6379> debug cmdkeys zunionstore foo 2 a b
          1) "a"
          2) "b"
          3) "foo"
          redis 127.0.0.1:6379> debug cmdkeys ping
          (empty list or set)
      c4ef1d64
  25. 10 Dec, 2013 1 commit
    • antirez's avatar
      dict.c: added optional callback to dictEmpty(). · 2eb781b3
      antirez authored
      Redis hash table implementation has many non-blocking features like
      incremental rehashing, however while deleting a large hash table there
      was no way to have a callback called to do some incremental work.
      
      This commit adds this support, as an optiona callback argument to
      dictEmpty() that is currently called at a fixed interval (one time every
      65k deletions).
      2eb781b3
  26. 27 Aug, 2013 1 commit
    • antirez's avatar
      DEBUG SDSLEN added. · e2180334
      antirez authored
      This command is only useful for low-level debugging of memory issues due
      to sds wasting memory as empty buffer at the end of the string.
      e2180334
  27. 22 Jul, 2013 1 commit
    • antirez's avatar
      Introduction of a new string encoding: EMBSTR · 894eba07
      antirez authored
      Previously two string encodings were used for string objects:
      
      1) REDIS_ENCODING_RAW: a string object with obj->ptr pointing to an sds
      stirng.
      
      2) REDIS_ENCODING_INT: a string object where the obj->ptr void pointer
      is casted to a long.
      
      This commit introduces a experimental new encoding called
      REDIS_ENCODING_EMBSTR that implements an object represented by an sds
      string that is not modifiable but allocated in the same memory chunk as
      the robj structure itself.
      
      The chunk looks like the following:
      
      +--------------+-----------+------------+--------+----+
      | robj data... | robj->ptr | sds header | string | \0 |
      +--------------+-----+-----+------------+--------+----+
                           |                       ^
                           +-----------------------+
      
      The robj->ptr points to the contiguous sds string data, so the object
      can be manipulated with the same functions used to manipulate plan
      string objects, however we need just on malloc and one free in order to
      allocate or release this kind of objects. Moreover it has better cache
      locality.
      
      This new allocation strategy should benefit both the memory usage and
      the performances. A performance gain between 60 and 70% was observed
      during micro-benchmarks, however there is more work to do to evaluate
      the performance impact and the memory usage behavior.
      894eba07