Missing readOnly Flag in Spring Transactions Cut Connection Pool Efficiency in Half

A development team discovered that several read-only API endpoints — including category listings and dashboard summaries — were annotated with plain @Transactional, omitting the readOnly = true parameter. Without this flag, Hibernate performed unnecessary dirty checks and flush operations on every request, holding database connections open longer than required. At high traffic volumes, this overhead caused measurable connection pool congestion, forcing incoming requests to wait longer for available connections. Adding readOnly = true to the affected methods took a single afternoon and caused peak connection pool wait times to drop by approximately 50%. The incident highlighted how a seemingly minor annotation attribute can have significant performance consequences at scale.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in