Embedded vs Stand alone Tomcat ( HTTP ) server
Asked Answered
C

2

21

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.

Creatine answered 23/12, 2013 at 2:47 Comment(0)
A
20

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.

Aliciaalick answered 9/7, 2014 at 18:42 Comment(1)
I understand, it's an old article, but this link may help others as I came across the same question Application Servers - Sort of DeadCioffred
C
14

I have used embedded-jetty for a web app. The reason I used is was that I didn't want to set up a separate web server for just one App,. So I made a simple java program with embedding jetty in it and configure all server properties through java code. Now I can run this program on any machine without web server installed and it will act as a web app running in a server. I can associate any port and program many-to-many context/servlet mapping in it.

Cally answered 23/12, 2013 at 6:4 Comment(2)
Hmm, embedded servers would be be helpful if i will be changing the host like during a development phase. So there isn't any difference in the ease of deployment and in testing changes?Creatine
Hot swaping is available in embedded-jetty that's what i have checked but about other server properties (which may be i don't even know) i haven't checked it.Cally

© 2022 - 2024 — McMap. All rights reserved.