Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fill redis with redis-cli with dummy data of size weigh hundreds of MB?

I am getting my hand dirty with redis monitoring. So far I came up with this metrics useful to monitor about redis:

  • memory_used
  • through put
  • latency
  • connections
  • replication

I am newbie on this. I am trying to fill the redis from redis-cli with dummy data as: for i in `seq 10000000`; do redis-cli SET users:app "{id: '$i', name: 'name$i', address: 'address$i' }" ; done but it doesn't scale my need to fillup the redis-db fast enough...

Also I need some help regarding the latency and throught put monitoring. I know what they mean, but I don't know how to measure them... My eyes don't see anything rellated to that on output for redis-cli info

Thanks, for support/guidence :D

like image 761
thapakazi Avatar asked Sep 21 '15 06:09

thapakazi


1 Answers

Use the undocumented DEBUG POPULATE command.

DEBUG POPULATE count [prefix] [size]: Create count string keys named key:<num>. If a prefix is specified it's used instead of the key prefix.

The value starts with value:<num> and is filled with null chars if needed until it achieves the given size if specified.

> DEBUG POPULATE 5 test 1000000
OK
> KEYS *
1) "test:3"
2) "test:1"
3) "test:4"
4) "test:2"
5) "test:0"
> STRLEN test:0
(integer) 1000000
> STRLEN test:4
(integer) 1000000
> GETRANGE test:1 0 10
"value:1\x00\x00\x00\x00"
like image 71
LeoMurillo Avatar answered Sep 25 '22 18:09

LeoMurillo