Skip to content

(feat): Redis Implementation for Datastore (using rdb for snapshots)

Ben Sykes requested to merge feat-redis into master

Created by: SystemFiles

For a number of reasons, I felt that utilizing Redis as a key-value store for my simple data needs at this point in the project was a good idea. Partially for the performance increase (not that I noticed a whole lot of difference since postgres was doing a fine job, although there is evidence to suggest this may have changed if the service had been running for weeks or more).

There were mainly 2 reason against continuing to use Postgres. Those were namely:

  • Bloated update tables in Postgres for data that is constantly changing. There was obviously a solution to this, but again I didn't really see the need (see point 2). The solution I found seemed to simply be a HOT mode for Postgres: https://stackoverflow.com/questions/55093428/repetitive-postgres-updates-of-arrays-leading-to-bloat

  • Since the only data needing to persist is the service definitions, using a full-fledged relational db like postgres seemed overkill. Redis is a simple flat key-value store which provided the flexibility and simplicity I wanted.

There were some downsides regarding the safety of the data (in redis) as pointed out in the article below, however, those seem to relate more to risk of losing deltas and less so losing the entire service definitions which are really the main thing we want to persist anyways. For these reasons I am choosing to replace Postgres as the default data store for StayUp

https://redis.io/topics/persistence

Merge request reports

Loading