I am developing an API using Clojure based on the JVM. Our server primarily utilizes GraphQL. We're encountering an issue where, at startup, CPU usage spikes to nearly 100%. This becomes problematic as our autoscaling metrics are based on CPU usage. When a server is deployed, it triggers a scale-out due to high CPU usage, leading to the creation of additional servers. These new servers, in turn, also use maximum CPU, causing unintended scaling up to the maximum limit set. I am looking for solutions to this problem.
- Is it common for JVM languages to experience near 100% CPU usage during deployment or when the server is starting up?
- Our GraphQL resolvers are dynamically linked, not statically, using strings. Could this be a contributing factor?
- Is there an alternative metric to CPU that we can use for autoscaling? If we consider metrics like the number of requests, my concern is that scaling may not occur if the volume of requests is low, but the requests are resource-intensive.