Deployment tip of military files against an executable jar with an integrated container

It seems that in java space there is a tendency to refuse to deploy Java web applications in the Java servlet container (or application server) as a military file (or ear file) and instead place the application as an executable jar with an embedded server / An HTTP server, such as a pier. And I mean this to a large extent by the fact that new structures affect how new applications are developed and deployed, and not how applications are delivered to end users (because, for example, I understand why Jenkins uses an integrated container, it’s very easy to capture and leave). Examples of frameworks using the executable flag option: Dropwizard , Spring Download and Play (well, it does not start in the servlet container, but the HTTP server is built-in).

My question is, based on the environment in which we deployed our applications (up to this point, mainly Struts2) to one tomcat application server, what changes, best practices or considerations should be made if we plan to use the approach with an integrated container? Currently, we have about 10 home applications running on the same tomcat server, and for these small applications the ability to share resources and manage on one server is good. Our applications are not intended to be distributed to end users in the environment. However, moving forward if we decide to use a newer java framework, should this approach change? Is the transition to executable banks caused by the increasing use of cloud deployments (like Heroku)?

If you have experience managing multiple deployment play style applications compared to traditional war file deployment on a single application server, please share your understanding.

+67
java spring-boot playframework war dropwizard
May 05 '14 at 17:21
source share
1 answer

Interest Ask. This is just my view on this topic, so take everything with salt. I sometimes used and managed applications using both servlet containers and embedded servers. I am sure that there are still many good reasons for using servlet containers, but I will try to just focus on why they are less popular today.

Short version: Servlet containers are great for managing multiple applications on the same host, but they don't seem very useful for managing just one application. In cloud environments, one application per virtual machine seems preferable and more common. Modern frameworks want to be compatible, so switch to embedded servers.




Therefore, I believe that cloud services are the main reason for rejecting servlet containers. Just as servlet containers let you manage applications, cloud services let you manage virtual machines, instances, data storage, and more. It sounds more complicated, but with cloud environments, there has been a shift to separate machines for applications. This means that you can often process the entire machine as an application. Each application runs on a machine with an appropriate size. Cloud instances can pop up and disappear at any time, which is great for scaling. If the application requires more resources, you create more instances.

Dedicated servers, on the other hand, are usually powerful, but with a fixed size, so you run several applications on the same machine to maximize the use of resources. Manage dozens of applications - each with its own configurations, web servers, routes and connections, etc. - not funny, so using a servlet container helps keep everything manageable by itself. However, it is more complicated. Servlet containers in the cloud do not seem very useful. They need to be customized for each small instance, without bringing much importance, since they run only one application.

In addition, the clouds are cool and the cloudy things are boring (if we still believe in the hype). Many frameworks try to scale by default so that they can be easily deployed to the clouds. Embedded servers are quick to deploy and start, so they seem like a smart solution. Servlet containers are typically supported, but require more complex configuration.

Some other points:

  • The embedded server can be optimized for the framework or better integrated with the framework tools (for example, the playback console).
  • Not all cloud environments come with customizable native images. Instead of writing initialization scripts to download and configure servlet containers, using dedicated software to deploy cloud applications is much simpler.
  • I have yet to find a Tomcat installation that does not welcome you with perm space error every few repeated deployments of your application. Taking a bit longer (restarting) the built-in servers is not a problem when you can almost instantly switch between the stages of creation and production without any downtime.
  • As already mentioned in this question, it is very convenient for the end user to simply launch the application.
  • Embedded servers are portable and easy to develop. Today everything is fast, prototypes and MVPs must be created and delivered as quickly as possible. Nobody wants to spend too much time creating an environment for each developer.
+61
May 6 '14 at 2:32
source share



All Articles