Reputation: 5241
our application is built on Spring Boot 2 (spring-data, JPA, Hibernate, Postgres, tomcat). Performance of an application is very bad because there is a lot of requests in time (for instance 2000 in 1 second). We are aware we need to rewrite it in future. But my question is if there is some solution which improves performance and executing a lot of requests without big changes in the code? Thank you for any advice.
Upvotes: 0
Views: 689
Reputation: 1212
if you want to change code, I would suggest replacing hibernate with direct SQL with something like MyBatis. But if no code change, I only can suggest you to find bottle neck first.
Upvotes: 1
Reputation: 26522
Its a broad question but some techniques that come in mind:
1) Optimistic locking. Thanks to that you do not need to physically lock tables / rows thus your concurring requests do not get queued and stack up. You still would get OptimisticLockExceptions
and will need to handle them but you get some performance benefits on the flip-side.
2) Try to avoid long methods wrapped in transactions that may lock certain data for more then needed. You may need to think about setting your @Transactionl
methods with PROPAGATION=REQUIRES_NEW
and making them shorter in general.
3) Try to test around with timeouts on your queries so that they do not hang for too long when blocked etc.
Upvotes: 1