For my private projects I have rented a virtual Linux server in the cloud.
Since this server has a limited amount of memory I would like my microservices to be as small as possible.
Most of my microservers expose a REST API, so I decided to test some different implementations to implement a REST service.
The source of the implementations can be found here:
I found that Spark (http://sparkjava.com/) was starting up really fast (sometimes faster then 500msec) and was 10 times smaller in memory size then using a container.
Below are the timings of all the implementations that I tried:
Java EE 7:
I tested this with TomEE 1.7.3, Wildfly 9.0.2, Glassfish 4 and Liberty profile 184.108.40.206.
The memory footprint: TomEE: 217MB, Wildfly: 300MB, Glassfish: 397MB and Libertyprofile: 345MB
The deploy time was for TomEE about 3 seconds and other containers around 10-15 seconds
Memory footprint: 280mb
Application start time: 30 sec
Memory footprint: 36mb
Application start time: 1,5 sec
Standalone Jetty with Jersey:
Memory footprint: 80mb
Application start time: 4 sec