openhie / instant

Instant OpenHIE - see docs here:
https://openhie.github.io/instant/
Apache License 2.0
18 stars 20 forks source link

Ohie 500 jvm tuning hapi fhir reduce memory usage #122

Closed Ken473 closed 3 years ago

Ken473 commented 3 years ago

If applied, this commit will:

Limit HAPI FHIR containers to use a maximum of 2GB

Explain why this change is being made

To prevent cost overruns with containers

Provide links to any relevant tickets, articles or other resources

Ticket number is OHIE-500. links are: https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/ https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ https://linuxhint.com/docker_compose_memory_limits/

Ken473 commented 3 years ago

duly noted @MattyJ007, So you'd like the limitation to be applied to the JVM itself, not the container as we could have instant implementations without docker. Do you want to apply this to Kubernetes?

MattyJ007 commented 3 years ago

Kubernetes should be limited in the same way (on the JVM)

Ken473 commented 3 years ago

Hi @MattyJ007 , the latest commit limits the memory usage on the JVM inside the HAPI FHIR container. Please note that the solution does require both configs to successfully apply. Please have a look

Ken473 commented 3 years ago

@MattyJ007 for the question about testing, it ran without issues on my side. For being able to run with only 2 GB, I did not load test it to max out the memory usage. If you know a way to do that, please share with me. What I was able to see was that the JVM starts with a memory allocation of 200MB but then returns that the max allocation is set to 2GB. Please use this commands to see the memory allocation before and after the setting has been applied: java -XX:+PrintFlagsFinal -version | grep -Ei "maxheapsize|maxram"

MattyJ007 commented 3 years ago

@Ken473 To max out the RAM write a quick script (or use postman) that will send through a few hundred requests.

For the script either write a bash script with a looping curl command - or you could use a node script - or https://www.npmjs.com/package/newman

Ken473 commented 3 years ago

Hi @MattyJ007 thanks for the tip, will give you my testing results on slack. I have cleanup all the remaining spaces