Kaka to reduce the load on Apache Tomcat (Rest)?

Good day, comrades!

Is the idea of a system that stores and queries some data in JSON format. The selected framework -spring and runtime - Apache Tomcat. Database - PostgreSQL.
Some customers periodically perform Rest requests (POST to send messages and GET to retrieve the data). When the message arrives at the tomcat, it is placed in RabbitMQ for safekeeping, when the butt on tomcat will be the time he zaberet the message and processes it, everything is clear, but when the client asks for some data, I don't know any way to quickly get a data bundle from the database and give the client except with the aid org.springframework.web.context.request.async.DeferredResult . The basic idea is that the spring sends to the client 202 ACCEPTED, climbing into the database and gets the data packet, and the client waiting for timeout and making the request gets the entire bunch of messages already from memory.

Proceeding from the aforesaid there are questions:

1) How to reduce the load on tomcat? DeferredResult is good, but what else can you do?
Same here - DeferredResult creates a thread (I guess) how to defend against that, if too large a quantity of requests I will just die from all this number of threads?
2) If the performance of one tomcat is not enough, what can you do? To put Nginx (or HProxy) and to resolve queries on multiple physical machines which are Tomcat and database to replicate?
June 10th 19 at 14:55
1 answer
June 10th 19 at 14:57
  1. Usually use a pool of threads pietromonaco size (or limit to max number)
  2. You can scale horizontally, but are usually first introduced caching at different application levels. You can split the data on the hot/cold and store the first entirely in RAM. It all depends on the amount of data and variability of the query

Find more questions by tags RESTful APISpring