Confused about how session state works

I have some questions about how session state works:

  1. When you store something in session state, if it stored locally on the users’s side?

  2. Do the values used in the session state affect the resources limit of 1GB?

  3. When are the session state values removed and stop affecting the resource limits? When the user closes the tab?

  4. Do we have to make sure to delete the session state values manually or are they removed automatically? I’m just concerned about the resource limit.

  1. No
  2. Yes
  3. Yes
  4. See 3, but you might want to delete something before that (I never found a use case for that, though).

Thanks, @Goyo ! I appreciate all the answers. I’m still not sure what you mean by

you might want to delete something before that

Should I do del st.session_state [key] or should I just let the user close the tab and hope that the state session stuff is cleared?

Session data will be automatically deleted after the session ends, but you can do it before if you want. I have never done that, but I guess there may be use cases where it makes sense.

@Goyo Gotchu. That makes sense. I’m just trying to navigate how the resource limit would scale wrt session states. Your answer helps. Thanks!