I am writing a web service in Java that needs to process a large number of requests / second. The total flow will be:
- Web service receives a request from a client
- Returns the answer "keep polling me" to the client
- Calling another web service (or services), and waiting for them to answer (with a timeout)
- A client checks our web service while it receives a response (with a timeout)
Researching on the Internet, I found two common approaches to writing web services:
- Create a stream for each request
- Use a Reactor pattern (central dispatcher thread responds to I / O events)
Do you have a recommendation, which approach is usually better, and what are the advantages / disadvantages of each approach? I would also like to draw attention to examples.
source
share