Tomcat测试和生产环境
为一个网络应用程序提供多种环境的最佳设计是什么?在一台 Tomcat 服务器上部署多个 Tomcat 实例或多个 Web 应用程序实例哪个更好?
What is the best design to have many enviroments for one web-app? Is it better to have multiple tomcat instances or multiple web-app instances deployed on one Tomcat server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果一台服务器可以处理负载,我认为最好只有一个 Tomcat 实例,并在必要时多次部署
web-app
。这样:
If one server can handle the load, I would said it's better to have just one Tomcat instance and deploy
web-app
multiple times if necessary.This way:
多次部署同一个 Web 应用程序以减轻管理负担的想法很好。
但在我看来,这不是一个可接受的解决方案:假设您部署一个网络应用程序两次。一次用于测试环境,第二次用于生产环境。 Web 应用程序可能会遇到异常/错误(通常是与内存相关的问题),这可能会导致整个 Tomcat 服务器崩溃。在这种情况下,一个环境中遇到的问题将导致另一个环境不可用。
因此,我宁愿根据不同的环境安装尽可能多的Tomcat实例。
The idea of deploying the same web-app several times in order to reduce administration burden is good.
But in my opinion, this isn't an acceptable solution : suppose you deploy a web-app twice. Once for a TEST environment and a second time for a PRODUCTION environment. The web-app may encounter exceptions/errors (typically, memory-related issues) that may lead the whole Tomcat server to crash. In such a situation, problems that were encountered in one environment would cause the other one to be unavailable.
Therefore, I would rather install as many Tomcat instances as different environment.
理想情况下,您应该尽可能将所有生产代码保存在完全独立的环境中,以避免错误并出于安全原因。
根据您的资源和团队规模,例如,您有一个用于生产的飞地:Web 服务器、数据库、邮件服务器。这应该有规则禁止任何开发资源访问生产资源,反之亦然。如果您的开发资源受到损害或者您运行的脚本访问了错误的资源,那么就会有一层保护。
是的,这很不方便,但从长远来看,它可以让你免于头痛。
Ideally, you should keep all production code on a completely separate environment as much as possible just to avoid mistakes and for security reasons.
Depending on your resources and team size, say for example, you have an enclave for production: web server, database, mail server. This should have rules to disallow any development resources from access production resources and vice versa. If your dev resources have been compromised or you run a script going to the wrong resource, there would be a layer of protection for that.
Yes, this is all inconvenient, but it could save you from having big headaches in the long run.