State management for Streamlit in ECS

I have deployed a streamlit app using ECS (fargate). The number of containers automatically increase or decrease depending on the load. The issue is that I have many variables stored in my session state (like user_uuid, image_index, prev_frame_uuid etc…) for individual user. So when the number of containers change and a user is connected to a different container which doesn’t have their state, the app breaks. One solution to this, which I can think of is, to store all the state variables in redis and fetch it from there but it would require a significant change in the codebase. (essentially making the app stateless)

Is there a better way to solve this? or has anyone faced this issue while deploying a streamlit app?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.