简体   繁体   English

当2个tomcat位于不同机器中时,如何在tomcat中实现负载均衡?

[英]How to implement load balancer in tomcat when 2 tomcats are in different machines?

I have a web application which runs on 32 bit JDK and tomcat. 我有一个在32位JDK和tomcat上运行的Web应用程序。 This web application is intermittently crashing with OOMs and timeouts waiting for connection pool threads. 此Web应用程序间歇性崩溃,OOM和超时等待连接池线程。 So i am trying to install the application in 2 different tomcats on 2 different machines. 因此,我试图在2个不同的机器上的2个不同的tomcats中安装该应用程序。 2 different machines so that more heap space will be available to help with the OOM. 2台不同的计算机,以便有更多的堆空间可用于OOM。

Requirement is to direct the user to freely available tomcat when there are multiple parallel sessions in progress. 要求是在进行多个并行会话时将用户定向到免费可用的tomcat。

After reading about load balancing vs clustering, it looks like load balancing might be more suitable as i want all the requests from a user session to go to the same tomcat. 在阅读了有关负载平衡与群集的内容之后,看起来负载平衡可能更合适,因为我希望来自用户会话的所有请求都转到同一个tomcat。 Is this correct understanding? 这是正确的理解吗?

however, clustering and load balancing do not seem to be supporting tomcats on 2 different machines. 但是,群集和负载平衡似乎不支持2台不同机器上的tomcat。 I need tomcats on different machines so that the application(JVM) can utilize more memory. 我需要在不同的机器上安装tomcat,以便应用程序(JVM)可以利用更多的内存。

More reading resulted in more confusion in terms on "terracotta", "memcached", "session replication" etc. 更多的阅读导致在“兵马俑”,“内存缓存”,“会话复制”等方面的混乱。

It would be highly helpful if someone can point me in the right direction on what a possible solution can be in terms on increasing the resources the web application can utilize. 如果有人可以在增加Web应用程序可以利用的资源方面为我指明正确的方向,那将非常有帮助。

You can do this very easily with Apache HTTPD and its mod_proxy_loadbalancer . 您可以使用Apache HTTPD及其mod_proxy_loadbalancer轻松完成此操作。 I've had a configuration like this running for years. 我有这样的配置运行了多年。 It can do session stickiness and all that, and you can control it dynamically at runtime. 它可以完成会话粘性以及所有这些,并且您可以在运行时动态控制它。

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

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