Java中如何实现会话压缩?

发布于 2024-08-16 10:28:42 字数 70 浏览 1 评论 0原文

我正在听 .Net Rocks!播客(与 Scott Hunter)其中提到了会话压缩。我想知道如何在Java中实现会话压缩?

I was listening .Net Rocks! podcast (with Scott Hunter) where it was mentioned about session compression. I wonder how can I achieve the session compression in Java?

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

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

发布评论

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

评论(3

真心难拥有 2024-08-23 10:28:42

术语“会话压缩”在 JSP/Servlet 中没有任何意义。我认为您要么误解了它,要么它只是 .NET 特定的。在 JSP/Servlet 中,会话实际上完全位于服务器端。也许.NET出于某种(奇怪的)原因将其来回传递给客户端,然后压缩会话数据确实会节省网络带宽。但同样,这在 JSP/Servlet 中没有任何意义。压缩服务器内存中的会话数据也没有什么意义,它只会增加更多的开销。

要调整 JSP/Servlet Web 应用程序性能,我建议安装 YSlow 并遵循其 性能规则。然而,YSlow 的技术调整建议仅限于 PHP 和/或 ASP。不过,您可以在本文中找到有关在 JSP/Servlet Web 应用程序中应用 YSlow 性能规则(以及更多内容)的详细信息:Web 应用程序性能提示和技巧

希望这有帮助。

The term "session compression" makes no sense in JSP/Servlet. I think you either misunderstood it, or it is just .NET specific. In JSP/Servlet, the session lives actually entirely at the server side. Maybe .NET passes it forth and back to/from the client for some (odd) reason and then compressing the session data would indeed save network bandwidth. But again, this makes no sense in JSP/Servlet. Compressing the session data in server's memory makes also little sense, it would only add more overhead.

To tune your JSP/Servlet webapplication performance I recommend to install YSlow and follow its performance rules. The YSlow's technical tuning advices are however limited to PHP and/or ASP. You can however find details about applying the YSlow performance rules (and much more) in a JSP/Servlet webapplication in this article: Webapplication performance tips and tricks.

Hope this helps.

情域 2024-08-23 10:28:42

请参阅Servlet 和 JSP 性能调整,第 4 部分 有关设置 Content-Encoding HTTP 标头的示例。附录:检查 Accept-Encoding 并处理 Content-Encoding,如 文章说明了相应HTTP 标头,但方法有限。作为 BalusC 显示,servlet容器本身可能支持自动压缩,例如Tomcat

See Servlet and JSP performance tuning, part 4 for an example of setting the Content-Encoding HTTP header. Addendum: Checking Accept-Encoding and handling Content-Encoding as shown in the article illustrates the the use of the corresponding HTTP headers, but the approach is limited. As BalusC shows, the servlet container itself may support automatic compression, e.g. Tomcat.

烟沫凡尘 2024-08-23 10:28:42

嗯,在集群的情况下,会话可以序列化并通过 TCP 发送。

在这种情况下,会话内容的序列化格式很重要。但如果需要优化的话,这只是简单的 writeObject/readObject 编码。

Well, sessions can be serialized and send across tcp, in the case of clustering.

In that case, the serialization format of the session contents would matter. But that is just straightforward writeObject/readObject coding if optimizations were desired.

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