5 ms·
I like it. Reminds me of Vaadin and friends. One question regarding the states: when do I get a new State allocated? Is it with every new tab? It's definite
by RyEgswuCsn 4y ago
I like it. Reminds me of Vaadin and friends.
One question regarding the states: when do I get a new State allocated? Is it with every new tab? It's definitely not per-browser-session: if I open a new tab I seem to get a new state, while undoing a closed tab seems to recover its state with it though.
Also are old states gc'ed?
- picklelo 4y agoEach 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?