Reputation: 5182
I'm trying to store in Redis some entities which have an id and some properties:
id string(30)
firstname string(20)
lastname string(20)
bio string(150)
I've read in the docs that the best way to store this in Redis would be hashes. is this correct? I am receiving this entities in batches of 1000 and i would need to bulk store them in Redis, since doing it one by one, i assume would be very slow. Is this possible? Any better idea on how to store and import this?
Upvotes: 1
Views: 1110
Reputation: 2613
Your assumption about doing it one by one will be slow is wrong. It will not be slow. Redis is very fast. You can get the idea from below benchmark:-
./redis-benchmark -r 1000000 -n 2000000 -t get,set,lpush,lpop -P 16 -q
SET: 552028.75 requests per second
GET: 707463.75 requests per second
LPUSH: 767459.75 requests per second
LPOP: 770119.38 requests per second
More benchmark statistics:-
http://redis.io/topics/benchmarks
As you mentioned entities are in the batch of 1000 which should not take more than few milliseconds. Just make sure you are using PIPELINE.
Upvotes: 1