<p>I'm really asking this by proxy, another team at work has had a change request from our customer.</p>

<p>The problem is that our customer doesn't want their employees to login with one user more than one at the same time. That they are getting locked out and sharing logins. </p>

<p>Since this is on a web farm, what would be the best way to tackle this issue?</p>

<p>Wouldn't caching to the database cause performance issues?</p>

[{'answer_id': 33623, 'author': 'Josh', 'author_id': 3521, 'author_profile': 'https://Stackoverflow.com/users/3521', 'pm_score': 3, 'selected': False, 'text': "<p>It's just a cost of doing business.</p>\n\n<p>Yes, caching to a database is slower than caching on your webserver.  But you've got to store that state information in a centralized location, otherwise one webserver isn't going to know what users are logged into another.</p>\n\n<p>Assumption: You're trying to prevent multiple concurrent log-ins by a single user.</p>\n"}, {'answer_id': 33628, 'author': 'Orion Edwards', 'author_id': 234, 'author_profile': 'https://Stackoverflow.com/users/234', 'pm_score': 4, 'selected': True, 'text': '<p>You could look at using a distributed cache system like <a href="http://www.danga.com/memcached/" rel="noreferrer">memcached</a></p>\n\n<p>It would solve this problem pretty well (it\'s MUCH faster than a database), and is also excellent for caching pretty much anything else too</p>\n'}, {'answer_id': 33653, 'author': 'Damien B', 'author_id': 3069, 'author_profile': 'https://Stackoverflow.com/users/3069', 'pm_score': 1, 'selected': False, 'text': '<p>It depends on how the authentication is done. If you store the last successful login datetime (whatever the backend), so maybe you can change the schema to store a flag "logged_in" and that won\'t involve an extra performance cost. (ok, it\'s not clean at all)</p>\n'}, {'answer_id': 33690, 'author': 'Mark Harrison', 'author_id': 116, 'author_profile': 'https://Stackoverflow.com/users/116', 'pm_score': 2, 'selected': False, 'text': '<p>A database operation at login and logout won\'t cause a performance problem.</p>\n\n<ul>\n<li>If you are using a caching proxy, that will cause a problem:</li>\n<li>a user will log out, but won\'t be able to log back in until the logout reaches the cache</li>\n</ul>\n\n<p>Your biggest potential problem might be:</p>\n\n<ul>\n<li>if the app/box crashes without a chance for the user to log out, the user\'s state in the database will remain "logged in".</li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/33619', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1602/']