Why does Grails GORM latency increase only under concurrent request load?
0 reputation · 24 Mar 2021, 07:29 UTC
In a Grails 4.x application, a service method marked with @Transactional performs a simple read‑then‑write operation on a domain class using GORM. The method is invoked via a controller endpoint that is accessed by a load generator simulating multiple concurrent users. When the endpoint is called with a single request, response times remain within expected bounds, but as the concurrency level rises above ten simultaneous requests, the average latency noticeably increases.
The increase appears only under load and does not correlate with visible errors or increased database response times. Possible contributors include the Hibernate session flush mode, connection pool exhaustion, or second‑level cache lock contention, but the exact trigger remains unclear. What configuration or internal GORM behavior could cause latency to rise only under concurrent request load? How can one isolate whether the delay originates from session flushing or connection acquisition? Which Grails or Hibernate settings should be examined to mitigate this effect?