PlayFramework应用程序的最佳部署策略? [英] Best deployment strategy for PlayFramework applications?

查看:109
本文介绍了PlayFramework应用程序的最佳部署策略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是面向服务器的。
我有一个托管服务器(一个相当小的,1,6Ghz原子,2Go,200 GO)与一对(4或5)播放应用程序和更多的来临。这些应用程序中的大多数都有一个很小的用处,我们假设每天有一百个请求。


  1. 使用Play!的嵌入式服务器部署每个应用程序最好?因此每个应用程序使用64MB的内存?


  2. 或者在Tomcat内部部署所有应用程序的Tomcat?所有应用程序共享更大的内存?


编辑:



< >我会补充一些关于我的情况的进一步信息。
服务器还托管:




  • Apache2 上约10,15个 PHP / strong>

  • 经过Apache mod_dav_svn的SVN服务器

  • 用于 Sonar

  • 独立安装 Jenkins (通过Jetty)



我的原始计划是部署所有这些东西在Tomcat。拥有应用程序,Sonar& Jenkins在Tomcat和Apache2上运行静态资源。 (图像,脚本)



评论



最后一点,我知道有声纳&詹金斯,生产环境上的持续集成系统并不是最佳的。但是由于这些仅在夜间运行(自动构建),所以它们不会重载系统。另外我是一名学生,在财务上,额外的CI /构建服务器是我的财务能力。

解决方案

最好的方法是使用附带的Play服务器,将NGinx作为反向代理,以处理所有重定向/请求管理。



为什么这不是Tomcat?您可以从比较性能的这篇文章开始。一个额外的参数将是Tomcat加载所有的Java EE环境,Play不需要或不使用,消耗您的应用程序所需的内存和资源(特别是如果您使用内存缓存)。



在Nginx作为反向代理,这个应该提示为什么要使用它而不是Apache。



编辑(问题编辑):



在你的情况下,你可以优化资源。



首先用Nginx替代Apache 2。 Nginx可以很好的服务PHP(如果你使用Ubuntu,请参阅)。它将非常有效地播放,并可以作为Java服务器的代理。



然后,您可以将所有Java应用程序移动到Jetty,并摆脱Tomcat。 Jetty平均消耗的资源较少,即使您的应用程序只能在晚上运行,服务器仍然在线,并且囤积RAM。越少越好。



SVN怎么样?可悲的是,您将需要Apache 2和Nginx作为Apache 2的反向代理。为什么不保留Apache?争论就是用法。理论上,PHP应用程序将拥有比SVN服务器更多的流量,这使得他们拥有更多的资源消耗。使用nginx,ram和cpu分配给PHP服务将会减少您的机器的响应速度。 Apache只会在你使用SVN的时候采取行动,这不会那么频繁。



如果你不想把努力移动到Nginx(我可以理解),然后将Java应用程序移动到Jetty,并使用Apache 2作为Play的反向代理。但是使用Play嵌入式服务器,不要在Tomcat中加载应用程序。这样会更有效率。


This question is server oriented. I have a hosted server (a rather small one, 1,6Ghz atom, 2Go, 200 GO) with a couple (4 or 5) play apps and more coming. Most of these apps have a real small usage, let's say a hundred requests a day each.

  1. Is it better to deploy each of those applications using the embedded server of Play! and thus use 64mb of memory for each application?

  2. Or deploy a Tomcat with all the applications inside the tomcat? With a bigger memory shared by all the apps?

EDIT :

I'll add a little further information about my situation. The server also hosts :

  • About 10,15 PHP websites on Apache2
  • A SVN server going through Apache mod_dav_svn
  • A tomcat used for Sonar
  • A standalone installation of Jenkins (via Jetty)

My original plan was to deploy all these stuff in Tomcat. Having the apps, Sonar & Jenkins running on Tomcat and Apache2 for static ressources. (Images, scripts)

COMMENT

Last point, I'm aware that having Sonar & Jenkins, Continuous integration systems on a production environment isn't really optimal. But since these are only running at night (automated builds) they are not overloading the system. Plus I'm a student, financially an additional "CI/build" server is out of my financial capacities.

解决方案

The best approach is to use the included Play server, putting NGinx as reverse proxy in front of it to tackle all the redirection/request managing.

Why this and not Tomcat? You can start with this article that compares performance. An extra argument would be that Tomcat loads all the Java EE environment which Play doesn't require nor use, consuming memory and resources you want free for your apps (specially if you use in-memory caching).

On Nginx as reverse proxy, this should give a hint on why to use it instead of Apache.

EDIT (on question's edit):

In your situation, you can optimize your resources.

First replace Apache 2 by Nginx. Nginx can serve PHP, quite well (if you use Ubuntu see this). It will serve Play very efficiently, and can be used as proxy to Java servers.

Then you can move all your Java apps to Jetty, and get rid of Tomcat. Jetty consumes less resources in average, and even if your apps will only run at night, the server is still online and hoarding ram. The less it takes the better.

What about SVN? Sadly you will need Apache 2 and Nginx as reverse proxy to Apache 2. Why not to keep Apache then? The argument would be usage. In theory the PHP apps will have more traffic than the SVN server, which makes more relevant the resource consumption they have. With nginx, ram and cpu allocated to serve PHP will be less making your machine more responsive. Apache will only act when you use SVN, which will not be so often.

If you don't want to put the effort on moving stuff to Nginx (which I can understand), then just move Java apps to Jetty and use Apache 2 as reverse proxy for Play. But use Play embedded server, don't load the app in Tomcat. It will be more efficient this way.

这篇关于PlayFramework应用程序的最佳部署策略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆