Microsoft Azure 中 Tomcat 的水平扩展
我安静地研究了一段时间,但仍然没有结论。
我想要在 Microsoft Azure 中对 Tomcat 实例进行水平扩展(一项服务的 1、2、3...Tomcat 实例)。我阅读了很多有关 Tomcat 的会话复制、集群等文章。由于 Azure 不支持多播,因此没有简单的方法来集群 Tomcat。此外,粘性会话也没有选项,因为 Azure 会进行循环负载平衡。设置两个服务 - 一个使用 Terracotta 或 Apache mod_jk - 另一个使用 Tomcat 实例对我来说似乎太过分了(如果可行的话)...
这可能吗?
预先感谢您阅读并回答我的问题。每一条评论/想法都受到高度赞赏。
I am working on this quiet a while, but still no conclustion.
I want to do horizontal scaling of Tomcat instances in Microsoft Azure (1,2,3,... Tomcat instances for one service). I read lots of articles about session replication, clustering,... with Tomcat. Since Azure does not support Multicasts, there is no easy way to cluster Tomcat. Also sticky sessions is no options, because Azure does round robin load balancing. Setting up two services - one with Terracotta or Apache mod_jk - and the other with Tomcat instances seems overkill for me (if even doable)...
Is this even possible?
Thanks in advance for reading and answering my question. Every comment/idea is highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用新的 appFabric 缓存服务,或者有在 Azure 上使用 Memcache 的示例,这会有帮助吗?
http://code.msdn.microsoft.com/winazurememcached
There is the new appFabric caching service you could use, or there are examples of using Memcache on Azure, would that help?
http://code.msdn.microsoft.com/winazurememcached
到底为什么你觉得运行 2 个服务太过分了?如果您对扩展到 n 个 Tomcat 实例没有任何问题,那么在我的书中添加另一个用于负载分配的服务是完全可以接受的解决方案。通过在至少 2 个实例上运行该服务,该服务本身满足 Azure SLA 要求:您的正常运行时间将与 Azure 上的正常运行时间一样好,并且可以避免 SPoF(单点故障)。
您可以使用 terracotta 这样的产品,但编写一个简单的套接字服务器将 HTTP 会话路由回 Windows Azure 中运行的特定实例也非常简单。您必须了解节点回收,但这是完全可行的。
请注意,memcached 还需要额外的 Azure 服务(Web 角色),而 appFabric 缓存服务不需要(但也有与之相关的成本)。我不知道 Tomcat,但对于 IIS,您可以轻松地将会话状态从内存中移动到持久状态(SQL Azure 或 Azure 存储)。需要注意的是:对于大容量站点,如果您将会话信息存储在 Azure 存储中,则 Azure 存储的交易成本实际上会成为部署的成本驱动因素。 SQL Azure 很可能是更具成本效益的解决方案,但另一方面,您的解决方案可能不支持开箱即用。
Why do you feel that running 2 services is overkill, exactly? If you have no issue with scaling out to n Tomcat instances, adding another service for load distribution is a perfectly acceptable solution in my book. By running that service on a minimum of 2 instances, that service itself meets the Azure SLA requirements: your uptime will be as good as it is going to get on Azure, and you avoid a SPoF (single point of failure).
You could go with a product like terracotta, but it is also pretty straightforward to write a simple socket server to route HTTP sessions back to a particular instance running in Windows Azure. You would have to be aware of node recyles, but that is quite doable.
Be aware that memcached requires an additional Azure service as well (web roles), the appFabric caching service does not (but also has cost associated with it). I do not know Tomcat, but for IIS you can easily move session state from in memory to persisted (either SQL Azure or Azure Storage). Something to be aware of: for high volume sites, the transaction cost to Azure Storage can actually become a cost driver for your deployment if you store session info there. SQL Azure could well be the more cost-effective solution, but on the other hand might not be supported out-of-the-box for your solution.
我不认为你可以在 Azure 上运行 Tomcat。即使您可以(使用虚拟机角色),在 Amazon EC2 上的 Linux VM 上运行它可能会更便宜。
编辑
我发现使用 Tomcat 解决方案加速器可以实现这一点。但请看免责声明:
这是不受支持的解决方案。我知道质疑管理决策通常很困难。但是,当有更便宜的受支持替代方案可用时,在生产系统中使用不受支持的软件通常不是一个好主意。
I do not think that you can run Tomcat on Azure. Even if you could (using the virtual machine role) it is probably cheaper to run it on a Linux VM on Amazon EC2.
Edit
I see that this is possible using the Tomcat Solution Accelerator. But look at the disclaimer:
This is an unsupported solution. I know that it is often difficult to question management decisions. But using unsupported software for production systems, when a cheaper supported alternative is available, is generally not a good idea.