linagora / tmail-backend

GNU Affero General Public License v3.0
36 stars 17 forks source link

Clean up Redis event bus keys data upon James crashes #941

Closed quantranhong1999 closed 3 months ago

quantranhong1999 commented 5 months ago

Why

Currently, for Redis event bus keys we use:

Upon James graceful shutdown:

However, if James crashes, likely the SETS data would not be cleaned by James. We should better clean them as Redis memory usage is critical.

How

Suggestion: write a Task/cronjob to clean redundant Redis Sets mappings. cf https://github.com/apache/james-project/pull/2028#discussion_r1502997593

Regarding Redis channel, we need to check if James crashes (no explicit UNSUBSCRIBE command), Redis would clean the channel e.g. on connection close => YES

DoD

Write the task and unit tests. Guice binding. Documentation.

Notes

Could take the chance to monitor other potential issues with Redis memory usage too e.g.:

quantranhong1999 commented 4 months ago

WIP: https://github.com/linagora/tmail-backend/pull/1022