how to find a particular redis key memory size in lua script -


redis.call('select','14')  local allkeys = redis.call('keys','orgid#1:logs:email:uid#*')  = 1 , #allkeys ,1     local object11 = redis.call('debug object',allkeys[i])     print("kk",object11[1])  end 

here "debug object" run on redis-cli, if want run through lua script on multiple key. send error this.

(error) err error running script (call f_b003d960240545d9540ebc2319d863221045 3815): wrong number of args calling redis command lua script

debug object not bet. shows serialized length of value, size of object once stored on rdb file.

to have hint size of object in redis, need resort more complex techniques, can approximation. need run:

  1. type
  2. object encoding
  3. the object-type specific command length.
  4. sample few elements understand average string length of object.

based on 4 informations, need check redis source code check different memory footprints of internal structures used, , math. not easy...

a more viable approximation use:

approx_used_mem = num_elements * avg_size * overhead_factor

you may want pick overhead factor makes sense variety of data types. error big, approximation enough use cases. maybe overhead_factor may 2.

tldr: trying complex , leads errors. in future idea provide memory command able this.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -