What does Discourse use Redis for?

Currently my Discourse install uses a DigitalOcean managed PostgreSQL database and a DigitalOcean managed Redis instance. Is the managed Redis server necessary?

Does Discourse store anything permanent in Redis or is it only used for caching/other kinds of temporary data?

My current setup (definitely overkill but it will make scaling easy if it’s needed one day):

  • DigitalOcean managed PostgreSQL server
  • DigitalOcean managed Redis instance
  • DigitalOcean Load Balancer
  • Two DigitalOcean droplets, each running Discourse

A simpler setup I was thinking about is:

  • DigitalOcean managed PostgreSQL server
  • A single server running both Redis and the Discourse application with a floating IP to fallback to a backup server if needed.

My current setup can seemlessly swap web servers without the user noticing because of the external Redis server, I think the simpler setup will log out users if the fallback server is needed, is this the main downside of having Redis on the same server as Discourse?



+1 I have the same question, I would really like to see if someone would be so kind to explain a little bit more about Redis and Discourse :kissing_smiling_eyes:

Discourse uses Sidekiq which is an open source job scheduler written in Ruby. Sidekiq generally (and by default) only executes jobs and does not do the scheduling, or at least that is what the references say (maybe things have changed?); however my understanding is that the enterprise version of Sidekiq comes with scheduling OOTB.

Sidekiq uses Redis as an in-memory data structure store and is also written in Ruby. Sidekiq reads jobs from a Redis queue, using the First In First Out (FIFO) model, to process jobs. Job processing is asynchronous and allows a web thread to serve live requests, rather than process heavy tasks which can be “scheduled” to run in the background.

Sidekiq is described as “well-known queue processing software” and is used by Discourse on jobs which are designed to run as background tasks and not run directly in web application requests.

You can explore the many types of jobs that Discourse executes, based on the above brief overview in the Discourse repo:

Redis may be used by Discourse in other parts of the architecture; but off the top of my head, the main use for Redis is as the “companion” for Sidekiq, the “jobs guy”. Discourse team members smarter than me on the Discourse HLA can surely elaborate with more details on how Redis is used within the Discourse HLA.

Hope this helps.


This is a little bit of a stale post, but I figured I should expand on this reply since I ran into this when searching for some other Discourse Redis stuff.

Here’s an answer from a team member to what other than Sidekiq does Discourse use redis for: