Embedded vs Stand alone Tomcat ( HTTP ) server

broun picture broun · Dec 23, 2013 · Viewed 12.4k times · Source

I am working on a new project which would be a web application with a front end UI and a back end web service. I started looking into what servers to use like Tomcat / Jetty and so .. I also noticed that there is an embedded version of these HTTP servers. I don't understand when to use an embedded version against a standalone version. I tried googling but could not find a convincing answer, So would appreciate if some one to explain me the use-case for an embedded server. Thanks in advance.

Answer

kdabir picture kdabir · Jul 9, 2014

Embedded servers are useful when you treat your application as an OS process and it will be started with something like java -jar youapp.jar. In this scenario, setting up the box upfront with a given app server, say, Tomcat, is not necessary. Such applications can be run by the end user without needing extra installation and configuration of an app server.

Applications like Jenkins for example hugely benefit from such packaging. Another scenario is when deploying on cloud services like Heroku. You wrapping the app server within your jar eliminates the need to get the server installed on such cloud boxes.

Here essentially a single web app runs on a given embedded server. However if you wish to install two web apps on lets say two contexts ${root}/app1 ${root}/app2 then embedded app server is not a good option for you.