edx / edx-arch-experiments

A plugin to include applications under development by the architecture team at edx
GNU Affero General Public License v3.0
0 stars 3 forks source link

Protect against login session outage during memcached restart #272

Open robrap opened 1 year ago

robrap commented 1 year ago

At this time, when we lose our caches in Production (outage or restart), we lose all user sessions and everyone is logged out. This is probably a frustrating experience for users, and also hammers our servers with logins until the event is over.

There are a number of ways this might be solved.

  1. We could use a db-backed cache. (There might be performance implications.)
  2. We might switch to Redis cache with persistence. (There still might be situations where the cache gets lost, but fewer?)
  3. We might look at https://github.com/martinrusev/django-redis-sessions. (Discovery is needed to understand if this provides any or enough benefit beyond just switching to Redis with persistence.)

For more details on using a db-backed cache: See Using database-backed sessions and see cached_db details in Using cached sessions.

Regarding timing:

robrap commented 1 year ago

Questions:

robrap commented 1 year ago

This is mostly a duplicate of the new issue in edx-platform: https://github.com/openedx/edx-platform/issues/32984

However, this ticket could address 2U specific issues, like Memcached vs Redis, or other environment specific questions.

robrap commented 6 months ago

Update:

robrap commented 3 months ago

On May 29, 2024, the question arose about flushing parts of a cache, and it was determined that memcached only has flush_all. Another reason to switch to Redis.