5

I have an application built as a spring boot fat jar. I host it in azure websites according to "official" documentation with a web.config similar too:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
        </handlers>
        <httpPlatform processPath="%JAVA_HOME%\bin\java.exe" arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\my-web-project.jar&quot;">
        </httpPlatform>
    </system.webServer>
</configuration>

The application is monolithic in structure, not too large but does some mapping and has some layers to initialize so startup time is about 12 seconds locally. It runs an H2 in memory database just for testing purposes.

Actual deployment and getting it running on azure websites were never really a problem, but there's some real performance issues, at least with the settings I have.

Some settings of interest:

  • Standard S1 instance (at the time of writing costing about ~$40USD/month).
  • Webapp configured with:
    • Tomcat8 (shouldn't really matter as the fat jar runs embedded tomcat)
    • JDK 8
    • Always on enabled

To be able to compare the numbers to something I ran the application on an Azure VM I have with similar (but not the same) specs and price range and ran the application on that one.

Here are some of the results:

Startup time of the application:

  • Azure websites: ~2 minutes
  • VM: 30 sek

Cold call:

Deployed/started the application and left it to make a call the day after.

  • Azure websites: 31119 ms
  • VM: 219 ms

Consequent call:

A call directly after the cold call, but to another endpoint.

  • Azure websites: 2685 ms
  • VM: 223 ms

My question here is: Do any one know if it is viable to run spring boot fat jars hosted on azure websites? As there is official documentation from Microsoft one would think that it is, and of course technically it is, but is it viable in production?

I'm not really after any debating about AWS vs Azure vs Google App Engine ....., or to write wars/jars or how to host it.

I have reasons to want it this way. If it's not possible I have other options but would like to explore the idea first and see if any one else has better experiences?

Edit: Just to add to the information. The database was empty for all calls. So that shouldn't add any overhead to speak off. No data was actually fetched only empty lists.

alefr
  • 318
  • 2
  • 9
  • There are not right answers for comparing Azure App Services (PaaS) with Azure Virtual Machine (IaaS) which are belong to different kind of Azure Services. Due to MS select different hardware and software to build these services, I think it's meaningless without any testing under the same hardware and software. Please refer to the link [Azure Pricing](https://azure.microsoft.com/en-us/pricing/) to know the differences between them. – Peter Pan Nov 15 '16 at 08:59
  • @Peter Pan No, it's not a "fair" comparison. But the comparison between them is not the actual question. The comparison is there to get a hint of what call time should be under "similar circumstances" The VM I'm comparing to is not too far off in specs compared to the instance running azure website. If I say it like this: The calls I make to the application are rather simple. 2685ms is a ridiculous time for that kind of call. I wanted to test it on a VM running on azure to see if I did something wrong, but the VM responded more in the lines of what I expected. – alefr Nov 15 '16 at 20:27
  • @PeterPan I highlighted the part where the actual question is to make it more clear what I'm asking for. – alefr Nov 15 '16 at 20:35
  • @alefr I have/had the same isuse. The answer I got from `azure team` is that is better to use `linux` webapp for `opensource` comparing `windows webapp`. It easy to deploy with a container there but for `java` you need to bring your own `custom container`. If you have any other solution for the slowness of java on `azure webapp` please share:) – oak Nov 15 '17 at 17:08
  • @oak That is interesting. I hadn’t heard of Webapp with containers (we moved away from webapps in to other suites). We are generally packaging our applications/services in a docker containers today and for some of them it seems like this could be a good match. Given the time this looks worth exploring. – alefr Nov 16 '17 at 18:48
  • @alefr, sounds like a good match. We probably also migrated from the classical webapp of azure on windows to containers. More information about it can be found https://learn.microsoft.com/en-us/azure/app-service/containers/tutorial-custom-docker-image – oak Nov 19 '17 at 07:48

2 Answers2

2

Although it is an old question and my answer is rather not valuable since I have no knowledge on Azure, but I would like to share results of my research. I have couple of Spring Boot microservices and one relatively big service (170 MB fat jar that on my local machine starts in about 70 seconds). Azure starts small microservices in tens (if not in hundreds) of seconds... and I mean like really small microservices (an example of config server from Spring Cloud etc... there is nothing fancy going on there). If it comes to the big one - Azure starts it and after 2 minutes... starts it again... and again... and again. As a result it never gets started.

and it was all on B3 app service plan. So quite big plan.

Wrapping up, in my (strongly subjective) opinion - Azure is not a viable option for Java apps.

Piotr Tempes
  • 1,091
  • 1
  • 12
  • 26
  • Thanks for your response Piotr. We run a couple of tests ourselfs where we had the simplest possible rest service (just responding directly from memory with a sequenced value with no caching). We setup a ping service calling the rest endpoint with different intervalls and saw different results depending on the intervall of the ping (in spite of **always on** being enabled for the site. Moving to an azure VM we didn't experience these issues. So in the end we setup our own infrastructure with VM's and load balancers and scapped azure websites, it wasn't a viable choice. – alefr Jun 16 '17 at 13:50
  • To expand on my comment we let the ping services run for a couple of days for each intervalls. The numbers are available if anyone is interested. It's too bad, Azure websites come with a lot of nice features like deployments slots, staging environments, red/green deployment out of the box. Although it's not too much of a hassle to setup ourself (and our services wouldn't work with websites now anyway since we moved to a containerized environment), it's always nice when it's done for you :) – alefr Jun 16 '17 at 13:57
0

It's viable for your question about running spring boot fat jars hosted on Azure websites, please refer to my answer for the SO thread Deploying Springboot to Azure App Service and focus on the offical document for the part of spring boot.

Hope it helps. Any concern, please feel free to let me know.

Community
  • 1
  • 1
Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • Thanks for the response @PeterPan. I read through post that you linked but my problem isn't actual deployment. I've got everything working and have used the official documentation to get it working. So that's ok. What I wanted to know is if anyone has gotten this to work in production environment as the websites call times are way too high to be viable (the vm I test use the same built jar and has reasonable call times). I know I can build a war and test that if I need to, but was more interested in knowing about the fat jar at this point. – alefr Nov 16 '16 at 09:27
  • As it stands right now my best option seems to test if a war is working better hosted on azure websites with tomcat/jetty or move away from azure websites if I want to stick with the fat jar approach. – alefr Nov 16 '16 at 09:28