Say I have 100 requests coming in every second and for each query, a hash value needs to be extracted and then, the same hash needs to be updated sort of like:
redis.hget ‘value’, ‘user-123’
redis.hset ‘value’, ‘user-123’, JSON.generate({:number_of_visits => 15})
What happens if there’s a ton of read\writes per second?
Will redis just queue up both the hget and hset commands and they’ll all execute in order they came in? Will it slow down the hgets the more commands come in?
Redis uses a single thread to process commands, so the commands will be processed in the order they arrive.
Some docs here,
If you send commands at a rate faster than redis can handle them, the commands will queue in redis, and the clients will see increase latency, as they wait for their commands to be dequeued and processed. This will affect both hset and hget commands.