3 ms·
Each new browser tab creates a new state. We use Redis to store the state and expire it after 30 minutes.
by picklelo 4y ago
Each new browser tab creates a new state. We use Redis to store the state and expire it after 30 minutes.
- paulgb 4y agoDoes that place some restrictions on what can be done with the state? e.g. does it need to be pickleable and relatively small since it needs to be loaded from redis on every event? (Pretty cool, btw! Congrats on the launch)
- picklelo 4y agoWe use the `cloudpickle` library which supports most data types. We found the state size doesn't impact performance too much - our main website's state is quite large but the Redis loads stay fast.
- RyEgswuCsn 4y agoNice to know, thanks! I am not very familiar with how modern Python wsgi servers manage states, but in Java e.g. states can be cached in the heap of the one and same JVM --- can one say that the need to use an external state store like Redis is a direct result of the underlying web server having to launch multiple Python processes in order to scale up for greater loads?