upaang saxena
upaang saxena

Reputation: 789

Redis Queue Architecture

How can we assign Redis queue to take jobs parallelly? Can we place different queues inside a single Redis queue?

I am making an chat application and I want to completely reduce the delay time. If suppose more people are sending messages at a same timestamp, then there will be more messages at the redis queue. Is there a way to handle that? I am using redis for in-memory data sending.

Upvotes: 0

Views: 1605

Answers (2)

negstek
negstek

Reputation: 691

Actually you should assign more processor units to the worker that handle the queue. According to the docs of pyton-rq it is a regular pattern and you can accomplish it using supervisor.

Upvotes: 0

Lugg
Lugg

Reputation: 197

Redis is single Threaded. Therefore no items can be handled in parallel. Thats not as bad as it sounds at first as redis can handle these small operations very fast ( see http://redis.io/topics/benchmarks for futher detail on how fast it is)

an ordered list can only handle items with an unique score. So using a ordered list might not be a good idea. But you can use a normal list like this:

  1. store new message LPUSH chatquene message1
  2. store message information

HMSET message1

time 1234 user Adam message hi receiver Eve 3. retrieve most recent message key RPOP chatquene

Upvotes: 1

Related Questions