Best deployment strategy for PlayFramework applications?

后端 未结 3 1452
南方客
南方客 2020-12-24 07:53

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

3条回答
  •  借酒劲吻你
    2020-12-24 08:41

    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.

提交回复
热议问题