存储 .net 会话数据的最佳方式

发布于 2024-08-04 15:07:19 字数 1432 浏览 2 评论 0 原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

下雨或天晴 2024-08-11 15:07:19

好吧,您可以使用作为 Windows 服务运行的会话状态服务器,但为了使其在网络场场景中工作,您需要让其中一台 Web 服务器运行会话状态服务,而其他 Web 服务器将与之协调那个单一的网络服务器。如果运行该服务的 Web 服务器出现故障,这当然会出现问题。

另一种选择是使用 memcachd,它是一个分布式内存会话状态服务器。这是免费的,并且已经有一个用于该框架的 .NET 提供程序。它已经相当成熟并且已经存在了一段时间。

如果您有钱可以花,那么横向扩展服务器可能是一个选择。然而,我被告知,在非常大规模的网站上,横向扩展技术需要不时地回收。

来自 Microsoft 的 Velocity 是与 memcached 等效的 .NET。这还没有发布,也不是一项成熟的技术。

您需要选择适合您的技术和财务要求的解决方案。

Well you can use the Session State Server which runs as a windows service, but in order to make that work in a web farm scenario you will need to have one of the web servers run the Session State service and the other web servers will coordinate with that single web server. This of course is a problem if your web server goes down which is running the service.

Another option would be to use memcachd which is a distributed in memory session state server. This is free and there is already a provider for .NET for this framework. It is fairly mature and has been around for a while.

If you have money to spend then Scale Out server might be an option. I have been told however that on really large scale web sites that the scale out technology needs to be recycled from time to time.

Coming around the bend from Microsoft is Velocity, which is the .NET equivilant to memcached. This is not released yet, and is not a mature technology.

You will need to choose the solution that fits your technical and financial requirements.

娜些时光,永不杰束 2024-08-11 15:07:19

如果你是免费的话,那么MySQL 能够处理高流量(显然在正确的硬件上)

If you are talking free, then MySQL is capable of handling high volume traffic (on the right hardware obviously)

微暖i 2024-08-11 15:07:19

好吧,首先您需要确定会话中存储的内容。有些东西根本无法序列化。但是,您可以为相关对象实现自己的序列化例程,并以您编写的方式存储它们。例如,您可以在内部进行 BinarySerialization,然后将对象作为 base64 编码字符串写入缓存工具(memcached 或其他)并检索它。

而且,您想要什么样的可扩展性?您是否根据请求在服务器之间交换用户?如果是这样,您至少需要一个中央缓存系统,或者至少是镜像缓存系统。

如果您将一个用户保留在同一台服务器上,但可能有很多用户,那么这并不重要,您可以在同一台计算机上使用外部进程来缓存。

我认为您需要提供更多信息。我不熟悉在单声道上运行东西(所以我只推荐 asp.net 状态服务),但我的猜测是第 3 方缓存过程,如 memcached,可能会很好。

Well, first you need to determine what you are storing in the session. There are some things that just can't be serialised at all. You may, however, implement your own serialisation routines for relevant objects, and store them in a fashion that you make up. For example you may internally to a BinarySerialisation, then write the object as a base64 encoded string into a caching tool (memcached or whatever) and retrieve it.

But also, what sort of scalability are you going for here? Are you swapping users between servers per request? If so, you'll need a central, or at least mirroring, cache system at least.

If you'll be keeping a user on the same server, but may have many, then it doesn't really matter, you can use an external process on the same machine to cache.

I think you'll need to provide a bit more information. I'm not familiar with running things on mono, (so I'd just recommend the asp.net state service) but my guess is a 3rd party caching process, like memcached, may be good.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文