flower icon indicating copy to clipboard operation
flower copied to clipboard

Add support for storing state in Redis

Open ghimire opened this issue 1 year ago • 3 comments

This pull request introduces support for storing the persistent state of Flower in Redis, as an alternative to the existing file-based storage mechanism. This enhancement aims to improve the reliability, scalability, and performance of state management in Flower.

This removes the limitation that prevented running multiple instances of Flower concurrently by centralizing state management in Redis.

ghimire avatar Sep 26 '24 18:09 ghimire

cc: @mher

ghimire avatar Sep 26 '24 18:09 ghimire

This is a great idea. Makes it much easier to run flower in a containerized environment.

What needs to be done here to merge this in, @mher?

iloveitaly avatar Feb 17 '25 22:02 iloveitaly

This removes the limitation that prevented running multiple instances of Flower concurrently by centralizing state management in Redis.

the other big benefit here is state is not lost when the container restarts (if you don't have a persistent volume attached to your container).

Created a PR for rediss support here

iloveitaly avatar Apr 03 '25 19:04 iloveitaly

@Nusnus Bump

ghimire avatar Sep 23 '25 09:09 ghimire

@auvipy @Nusnus Bump

ghimire avatar Oct 09 '25 17:10 ghimire

@auvipy Unit tests have been added for Redis events state storage in https://github.com/mher/flower/pull/1397/commits/0192efc12135a527a8112d2a11271df2a3d4dbf9.

ghimire avatar Oct 13 '25 19:10 ghimire

@auvipy @Nusnus

The flower/events.py:24:0: C0103: Variable name "PROMETHEUS_METRICS" doesn't conform to snake_case naming style (invalid-name) lint error is outside of the scope of this PR.

ghimire avatar Oct 28 '25 09:10 ghimire

Saving the entire state with a single redis_client.set is not scalable.

mher avatar Oct 28 '25 10:10 mher

Saving the entire state with a single redis_client.set is not scalable.

@mher Agreed, but Flower isn't scalable as it is, due to a file based state. I don't think having this Redis alternative makes it any worse. The flower database gets corrupted more frequently than one would hope. Fixing it in Redis is much easier, and it also means the Flower container doesn't need to be restarted.

Do you have any other plans or thoughts on moving the state out of filesystem to make it truly scalable?

I do think that this implementation is a start in that direction. Please share any suggestions you might have to improve the current implementation.

ghimire avatar Oct 29 '25 12:10 ghimire

Bump @Nusnus

ghimire avatar Nov 20 '25 17:11 ghimire

?

auvipy avatar Dec 05 '25 12:12 auvipy