AI Briefing
KO

Are You Using JPA @Transactional Correctly

·2025.01.23 19:00

Key point

Kakao Pay analyzed how JPA's @Transactional settings affect DB performance and improved query performance by removing unnecessary transactions.

1 / 2

Details

While operating Kakao Pay's online payment service, they discovered an issue where set_option queries were occurring abnormally frequently. Analysis revealed that numerous autocommit and transaction-related setting queries were being called, occupying DB resources.

Through actual performance testing, they confirmed that removing @Transactional for single queries improved SELECT performance by approximately 2-3x. This shows that unnecessary transaction management can have a significant impact on DB query performance.

Accordingly, Kakao Pay applied the following @Transactional usage conventions.

  • Remove @Transactional for single requests and simple queries
  • Avoid using transactions in layers that may include 3rd party API calls
  • Prohibit class-level configuration to prevent unintended settings
  • Optimize @Transactional(readOnly=true) and propagation settings to handle the CQRS pattern

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.