How does redis assists queueing at all when running sidekiq ? what exactly does redis queueing optimize if i'am already using sidekiq

Viewed 34

I am building a simple feature , where multiple hundreds of users will be clicking a button for adding a product as a favorite item. I am currently thinking of using redis + sidekiq , but had a question about weather redis is actaully essential at all. For simplification i am posting a incomplete diagram, so as to reduce the scope of this question only to sidekiq and redis.

Redis + sidekiq

enter image description here

Use clicks fav button -> API req to microservice -> redis -> sidekiq -> DB

I wanted to know why does redis needs to be used , will this help at all for hundreds of thousands of requests ? Keep in mind redis is being used for queueing and not permanent storage and redis needs to trigger sidekiq to run the job and enter the data in the database (i.e. sidekiq what be running batch updates or checking if redis has some data , sidekiq needs to be triggered).

Or does the below flow make more sense I.E. exclude redis completely ? let the micro service trigger sidekiq everytime a request comes in. I'am just wondering when we say "Queueing" how exactly is it helping in my fav button scenario. Excuse me being a noob , but i'am not much of a backend dev myself. any explanation would really help.

enter image description here

I.E. Use clicks fav button -> API req to microservice -> redis -> DB

0 Answers
Related