2

I am thinking about using Embedded Tomcat instead of the default one with deployment and I wonder why it is not widely used. Are there any disadvantages? Is it in any way slower?

Thanks.

EDIT:

I did my own tests and seems that embedded tomcat is 25 % faster. Why is that, shouldn't it be roughly the same speed?

Vojtěch
  • 11,312
  • 31
  • 103
  • 173

1 Answers1

2

Some thoughts on embedded servers:

  • You get to configure it in code, which in my experience is better than editing some enormous inscrutable xml document.
  • You can often times distribute your web-app as a single executable jar, which makes it REALLY simple to deploy and run.
  • If you embed the server, your customer is far less likely to screw up the configuration because they'll never see it.
  • As a developer, if you embed the server then it's going to be you that has to support it, though (this might be what you want, but not always).
  • Any change in configuration requires rebuilding the whole project.
  • Can make it a little more complicated to have different configurations for different deployments.

On that last point: I ended up writing a command line launcher that has tons of possible arguments in order to deal with the different deployment environments. Then there's shell scripts for different environments so you don't have to type all the args. In the end, it's not really any cleaner than just having different containers running with their own configurations, and just deploying a war to it.

As far as performance goes, I can't really tell you why. I did find this, which is interesting but not particularly great because they do not directly compare the same server running embedded and regular.

In the end, I think the question really comes down to how many different server configurations you expect to need, and whether you want to control those yourself or let the customer's it department handle it. Some places would want to do the server stuff themselves, some would rather not have to deal with it. Hope that helps.

allTwentyQuestions
  • 1,160
  • 7
  • 11