In our history, when we did a new release (deployment) any user who was "logged in" was logged out and that was obviously not ideal. Then I switched platform from a custom stack to a cloud provider and a "managed" platform which seems to have solved the problem. AFAIK a user can stay logged in during a deployment and the state is kept alive. How is it usually solved in practice behind the scenes?
The details are that we first used on-prem combination of tomcat connected to mysql with apache httpd, then replaced everything with Google Appengine.