We have a web application, running on Google Cloud. It's still in development at the moment. We've got a load balancer tied to three separate instance groups, for three different functions, all of them running in Tomcat 8 servers.
One of these instance groups, I'll call it the report group, had been running the same WAR file for several months, and we just, within the past hour, updated it.
Before the update, I'd never seen the report group exceed a single instance. Just before the update, I looked at Tomcat Manager on that instance, and it was showing over a thousand active sessions.
After the update, we ran a test, and POOF, we had two instances, and looking at their Tomcat Managers, they were each showing a few hundred sessions, but an aggregate total of well under 1000. At one point, as I was typing this, it briefly went up to four instances.
Can somebody offer me any insight into what happened, why the behavior changed, and how load balancers and instance groups decide to spawn off additional instances?
And how to keep the instances from multiplying like excessively frisky gerbils?
If you are using instance group the load balancers doesn't take any decision to multiplying like frisky gerbils. To allow autoscaling in a manage instance group you need to have configured some of the following policies:
Check in your GCP project the configuration of your load balancer and instances group to know what is the policy that you have configured.
About the war file, if you made modifications in the code file the new version might use more resources than the previous one. In the new version might be less sessions but the use of CPU or memory may be more high. If this is a custom .war file you can check in your source code what changes you make it and how affect this to your infrastructure.