0

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.

2
  • Do you use any kind of connection pool? Commented May 31, 2019 at 16:11
  • @BorLaze we didn't set it so I'm expecting it's default Commented May 31, 2019 at 16:11

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.