79722413

Date: 2025-08-01 11:12:29
Score: 0.5
Natty:
Report link

The combination of OSIV (Open Session In View) with network delay (RTT (round-trip time) between the app and Azure MySQL) can cause this.

Disable OSIV, it should significantly reduce Measure A times

spring:
  jpa:
    open-in-view: false

Also, to avoid Spring AOP overhead issues, I would recommend using TransactionTemplate instead of @Transactional annotation.

@Component
@RequiredArgsConstructor
class TransactionalTestingService {

    private final ShopTenantProvider provider;
    private final TransactionTemplate transactionTemplate;

    public Object doSomething() {
        // Measure B start
        final List<ShopTenant> result = transactionTemplate.execute(r -> provider.getAll());
        
        // Measure B stop
        return result; 
    }
} 
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Transactional
  • Low reputation (0.5):
Posted by: Oleg Cheban