HVD
HVD

Reputation: 251

Large number of key-value set make connection slow in redis

When I save 1 million Redis key as key-value

( Ex: TestKey:1 => 12, ...TestKey:1000000 => 24 )

it took about 8-20s to connect to my Redis server. Are there any limits on Redis?

I don't want to use HMSET because I want to set expire for these keys.

Can you guys explain to me what is going on?

( Redis is running in Docker )

Thank you.

Upvotes: 1

Views: 2177

Answers (1)

Ersoy
Ersoy

Reputation: 9614

You may check here to see how "How fast is Redis?"

The following is executing 1 million set commands and it is 75K rps

redis-benchmark -n 1000000 -t set -q
SET: 74693.76 requests per second

If you use pipeline with 16 commands per pipeline, it is 845K rps (11x)

redis-benchmark -n 1000000 -t set -P 16 -q
SET: 845308.56 requests per second

with 64 commands per pipeline, it is 1.18 million rps (15x)

redis-benchmark -n 1000000 -t set -P 64 -q
SET: 1175088.12 requests per second

So if you want to execute large number of set commands you may use pipeline to speed up 10, 15 times depending on the number of commands in a single pipeline.

Upvotes: 2

Related Questions