没有多播的 tomcat 会话复制

发布于 2024-07-07 04:39:22 字数 219 浏览 9 评论 0原文

我计划使用在托管提供商处租用的 2 台专用根服务器。 这些机器将在集群中运行 tomcat 6。 如果我稍后添加其他计算机 - 它们不太可能通过多播访问,因为它们将位于不同的子网中。

是否可以在没有多播的情况下运行tomcat? tomcat 6 集群的所有教程都包含多播心跳。 有 SimpleTcpCluster 的替代方案吗?

或者在这种情况下其他选择更合适?

i am planning to use 2 dedicated root servers rented at a hosting provider. those machines will run tomcat 6 in a cluster.
if i will add additional machines later on - it is unlikely that they will be accessible with multicast, because they will be located in different subnets.

is it possible to run tomcat without multicast? all tutorials for tomcat 6 clustering include multicast heartbeat. are there any alternatives to SimpleTcpCluster?

or are other alternatives more appropriate in this situation?

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

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

发布评论

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

评论(4

数理化全能战士 2024-07-14 04:39:22

由于无法控制两台服务器之间的距离(它们可能位于两个不同的数据中心)并且没有专用的服务器间通信线路,我宁愿通过循环 DNS 或将客户端重定向到 www1.yourdomain 的负载均衡器来运行它们.xxx 或 www2.yourdomain.xxx 并仔细处理服务器通信。

如果服务器彼此频繁通信,您可能会考虑更改架构,优化应用程序以“适合”一台服务器(至少一段时间),或者选择可控制位置的专用托管,服务器的距离和布线。 否则,您的服务器间通信、心跳等将使用与其通信的客户端相同的通道(例如相同的网段),这可能会减慢每个人的速度。

如果你真的期望那么大的负载,我想至少涉及一些钱,不是吗? 明智地使用它,并利用您的设置技能来解决比在没有控制或专用线路的情况下设置分布式集群更困难的问题。

With no control over the distance between both servers (they might be in two different datacenters) and no dedicated inter-server-communication line, I'd rather run them via round-robin DNS or a loadbalancer that redirects clients to either www1.yourdomain.xxx or www2.yourdomain.xxx and handle server-communication carefully.

If the servers are heavily communicating with each other you might either look to change your architecture, optimize the hell out of your application to "fit" on one server (at least for a while) or go for dedicated hosting with control over the location, distance and cabling of your servers. Otherwise your inter-server-communication, heartbeat etc. would use the same channel as the clients that are communicating with it (e.g. the same network segment) which might slow everyone down.

If you are really expecting that much load I suppose there's at least some money involved, no? Use it wisely and use your setup skills for problems harder than setting up distributed clustering with no control or dedicated lines.

七秒鱼° 2024-07-14 04:39:22

在给出我的其他答案后看到对该问题的评论,我对你的问题是什么感到困惑......是关于会话复制吗? 集群通信? 最好陈述您的问题,而不是您计划的本身存在问题的解决方案。

我将陈述一些可能的问题以及快速答案:

您的应用程序是 CPU/RAM 密集型的

  • 对其进行分析、优化,然后重试
  • 购买更大/更好的服务器

带宽密集型

  • 您的应用程序很可能使用您在问题中提到的廉价集群来进行 使情况变得更糟,因为相同的(隐藏的)通道用于服务器间通信和客户端服务器通信
  • 您也许能够分离不同类型的带宽,例如通过从与静态内容不同的服务器提供动态内容:否这里需要服务器间通信

您的应用程序是存储密集型的,

  • 获取更大的服务器,
  • 进行专用托管,并根据需要安装尽可能多的旋转磁盘,
  • 看看其他模型(如亚马逊 S3 存储)是否适合您)

您的应用程序很可能要

  • 确定上述哪些因素(或其他因素)决定了您的应用程序的限制,请解决该问题。

您只需要会话复制?

  • Tomcats SessionManager 接口很小,可以轻松地自己实现/扩展。 将其用于您喜欢的任何会话复制。 请参阅 StandardManager 文档和实施以获取更多信息

更多想法

  • 着眼于更灵活的设置,例如 EC2(亚马逊)、谷歌产品或其他云计算设置。 利用他们自己的云存储和服务器间通信设施。 请注意不要过度依赖此基础设施。

我当然忘记了一些事情,但这可能提供一些起点。 更具体地了解潜在问题的性质,以获得更好的答案:)

Seeing the comment to the question after having given my other answer I'm puzzled about what your question is... Is it about session replication? Cluster communication? It might be better to state your problem instead of your planned solution that has problems itself.

I'll state some possible problems together with quick answers:

Your application is CPU/RAM intensive

  • Profile it, optimize it, try again
  • Buy a bigger/better server

Your application is bandwidth intensive

  • using the cheapo clustering you mentioned in your question will most likely make it worse, as the same (cloaked) channel is used for inter-server-communication as for client-server communication
  • You might be able to separate different kinds of bandwidth e.g. by having dynamic content served from a different server than static content: No need for inter-server-communication here

Your application is storage intensive

  • get a bigger server
  • go for dedicated hosting and fit in as many spinning disks as you need
  • see if other models (like amazons S3 storage) might work for you)

Your application is likely to be slashdotted

  • determine which of the above factors (or others) are determining the limits of your application, fix that.

You just need session replication?

  • Tomcats SessionManager interface is small and can easily be implemented/extended yourself. Use it for any session replication you like. See the StandardManager documentation and implementation for more information

More ideas

  • look at more flexible setups like EC2 (amazon), googles offerings or other cloud computing setups. Make use of their own cloud-storage and inter-server-communication-facilities. Be careful to not depend too much on this infrastructure.

I certainly have forgotten something, but this might provide some starting point. Be more concrete about the nature of your underlying problem to get better answers :)

浪菊怪哟 2024-07-14 04:39:22

我正在尝试部署耶鲁中央身份验证服务器(CAS),并且希望将其集群化以实现冗余,因为这是基础设施的关键部分。 CAS 要求复制会话,因为在用户登录应用程序 A 并导航到参与单点登录域的应用程序 B 后,应用程序 B 会向 CAS 发送请求以确定用户是否拥有活动“票证” 。 由于没有设备向应用程序 B 指示它应将自身寻址到哪个节点来验证票证,因此必须将一个节点中的所有活动票证复制到集群中的所有节点。 换句话说,会话粘性在这里不是一个解决方案,因为应用程序 B 在验证用户 cookie 中的票证时,不知道用户登录期间应用程序 A 中原始会话的 sessionId。

因此,CAS 要求会话将在所有节点上复制。 网络支持多播的要求增加了相当大的开销,并使这种方法的部署有点繁重。 我在谷歌代码上测试了这个项目:

http://code.google.com/p/memcached -session-manager

看起来非常有用且易于部署(至少在 Linux 操作系统上),但不幸的是仅提供会话故障转移,而不是会话复制解决方案。

I am attempting to deploy the yale Central Authentication Server (CAS) and I would like to cluster it for redundancy, because this is a critical piece of infrastructure. CAS requires that the session be replicated, because after a user logs in application A and navigates to application B that partakes in the single-sign-on domain, application B sends a request to CAS to determine whether the user has an active 'ticket'. Since there is no device to indicate to application B to which node it should address itself to validate the ticket, all the active tickets in one node must be replicated to all nodes in the cluster. In other words, session stickiness is not a solution here, because application B, when validating the ticket in the user's cookie, is not aware of the sessionId of the original session in application A during which the user logged in.

Thus, CAS requires that the session be replicated across all nodes. The requirement that the network support multicasting adds a non-trivial amount of overhead, and makes this approach a bit heavier to deploy. I tested this project at google code:

http://code.google.com/p/memcached-session-manager

which seems very useful and simple to deploy (at least on a linux OS), but unfortunately only provides for session failover, and is not a session replication solution.

随心而道 2024-07-14 04:39:22

只需使用 http://code.google.com/p/memcached-session-manager/ 。 效果很好。 我们多年来一直使用它来进行 20 个 Tomcat 服务器共享会话的设置。 您可以使用一台或两台 Memcached 服务器来处理会话复制。

Just use http://code.google.com/p/memcached-session-manager/ . It works great. We are using it for years for this setup with 20 Tomcat servers sharing sessions. You can have one or two memcached servers to handle the session replication.

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