RE:NODE
Обзор хостинга

Базы данных5 мин чтения

Redis, and whether you actually need it yet

Sessions, caches, queues and rate limits are the real reasons. Speed on its own is not, and adding it too early buys you a second thing that can be down.

Эта статья пока на английском. Мы её переводим.


Redis is fast, which is why it gets added to projects that did not need it. It is a second service to run, monitor and lose data from, so it should earn its place with a specific job rather than a general hope of speed.

Good reasons

  • Sessions shared between more than one application process.
  • A cache for something genuinely expensive to compute, with an expiry you have thought about.
  • A queue for work that should not happen during a request.
  • Rate limiting, where an in-memory counter per process would be wrong.

Bad reasons

My database is slow, which is usually a missing index. Everybody uses it, which is not a reason. And storing anything you cannot afford to lose in a cache that may be configured not to persist.