In addition to the previous answers, I think you will need to enter your own timeout so that the sessions do not remain prolonged and blocked. Instead of using sessions, if you have a login, you can track it based on logins and keep them active, recording the latest activity for each user in a dictionary / array. This should help you understand which users are using the site and which are the last active users. If you associate this with sessions, you can end the sessions used by the last active user. The effect of this is that if more than the specified number of users tries to use the website, some (the least active) will constantly need to register. Given the incoherent nature of web applications, I think you might have to allow a certain percentage of grace, so if it is limited to 20 users, you will actually allow, maybe 22 to be active at the same time.
source share