简体   繁体   English

Web 场中的并发登录

[英]Concurrent logins in a web farm

I'm really asking this by proxy, another team at work has had a change request from our customer.我真的是通过代理问这个问题,另一个工作团队收到了我们客户的变更请求。

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.他们被锁定并共享登录信息。

Since this is on a web farm, what would be the best way to tackle this issue?由于这是在网络农场上,解决此问题的最佳方法是什么?

Wouldn't caching to the database cause performance issues?缓存到数据库不会导致性能问题吗?

You could look at using a distributed cache system like memcached您可以考虑使用像memcached这样的分布式缓存系统

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它可以很好地解决这个问题(它比数据库快得多),并且也非常适合缓存其他任何东西

It's just a cost of doing business.这只是做生意的成本。

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.但是您必须将该状态信息存储在一个集中位置,否则一个网络服务器将不知道哪些用户登录到另一个网络服务器。

Assumption: You're trying to prevent multiple concurrent log-ins by a single user.假设:您正在尝试防止单个用户进行多次并发登录。

A database operation at login and logout won't cause a performance problem.登录和注销时的数据库操作不会导致性能问题。

  • If you are using a caching proxy, that will cause a problem:如果您使用的是缓存代理,则会导致问题:
  • a user will log out, but won't be able to log back in until the logout reaches the cache用户将注销,但在注销到达缓存之前将无法重新登录

Your biggest potential problem might be:您最大的潜在问题可能是:

  • 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".如果应用程序/框崩溃而用户没有机会注销,则用户在数据库中的状态将保持“登录”状态。

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.如果您存储上次成功登录的日期时间(无论后端如何),那么也许您可以更改架构以存储标志“logged_in”,并且不会涉及额外的性能成本。 (ok, it's not clean at all) (好吧,一点都不干净)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM