I’m posting here since my question is off-topic but I guess here someone from the developers community can help me. I’m developing a web interface based on java servlets. The JVM is on Zulu Embedded 18.104.22.168 and Debian v9.4 raspberry pi 3 model B.
When I develop on my windows pc everything works smoothly, when I release the WAR file to the raspberry pi, the html pages are loaded fast, but the first call (and only the first) to the servlet takes some seconds (too much in my opinion) and it happens not only with servlets that load data, also to simple light servlet. I tried to enable the option load-on-startup with no success.
Do you have any suggestion?
Given that this is an openHAB forum and not a Java forum you are probably better off asking on a Zulu forum or Java forum.
Based on my past experience with Java though, I think your option is to not use Java Servlets or dig deep down in how to optimize the JIT. RPis are really slow at compiling code and Java won’t actually compile your servlets until they have been called one or more times. You can find details here.
As Rich mentioned this is not a Java forum, but one thing worth trying is a larger preallocated Java heap space.
First execution might still be lame but subsequent ones should be faster if garbage collection is what hits you.
Use -Xms400m -Xmx512m as arguments to Zulu Java for a start and eventually experiment with the numbers, remember Pis only have 1GB. Putting swap on a NAS or USB stick might also help, see this post.