My spring app’s page takes 5 ms to render, and using ab I was getting around 200 requests per second.
I tested on a VM that was a single core.
Now this page simply takes an xml file and parses it and initializes an object, and then inserts the object into mysql.
Now assuming mysql isn’t blocking (connection pool is not large enough, or table locks), adding another core should double my requests per second correct?
If I get 200 requests per second with a single thread hitting tomcat, I should keep doubling my rps as I increase threads correct? (up to some point obviously).
What is usually the bottle neck as mysql seems to be able to handle 3-4K inserts per second on a very simple servlet app.
Changing from single to dual core should work as you expect. If more cores and higher load come into play, you will probably face that thread-scheduling isn’t fair to all threads.
Since more memory is allocated and released in the same time garbage-collection could be an issue.
As long as all requests don’t come faster than they can be processed (200 * 5ms) 1000ms (you should have around 300ms spare time). you’re fine.
But due to scheduling, changing from user to kernel mode on each system call (mostly I/O from DB) adds additional time required to process a request. Which could leads to bottlenecks.