Reputation: 361
I am getting my hand dirty with redis monitoring. So far I came up with this metrics useful to monitor about redis:
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
Upvotes: 13
Views: 8420
Reputation: 1222
Using Python
redis-dummy-data-generator.py
, Creates 10000 key-value pairs
#!/usr/bin/python
for i in range(10000):
print 'set name'+str(i),'helloworld'
Run generator script and store the output in redis_commands.txt
file
python redis-dummy-data-generator.py > redis_commands.txt
Load generated dummy data into redis-server
redis-cli -a mypassword -h localhost -p 6379 < redis_commands.txt
Upvotes: 1
Reputation: 1373
following @leomurillo
I got this to work without the last parameter, and I couldn't find the documentation for this undocumented command :)
127.0.0.1:6379> DEBUG POPULATE 10000000 PHPREDIS_SESSION
OK
(15.61s)
127.0.0.1:6379> dbsize
(integer) 10000334
Upvotes: 1
Reputation: 6754
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"
Upvotes: 13
Reputation: 49932
To "fill fast", follow the instructions in the documentation about Mass Insert - the gist is using the --pipe
directive on a pre-prepared data file.
Upvotes: 1