views:

59

answers:

2

I work with a large Java web application which uses a service to return information. My key goal is to retrieve 100+ individual results as quick as possible. We've noticed that sending 100+ requests for information doesn't give us the best performance on the replies of data. Our solution was to break the 100+ requests into small batches (~15,25) and assemble them once all have been received.

I'm looking for a suggestion in Java to make 1 or 50 or 200 requests from the application, to the service, get back info to the application and perform another batch if there are more requests. If no requests left, assemble into on list and return that full list.

Any suggestions of form are welcome, thanks.

+1  A: 

I use Spring Integration for this kind of thing. You can set up a configurable message splitter that chops up your request and sends off many tiny ones, and a message aggregator that knows when it has received all responses and can then give you back a single result.

Spring also has a product called Spring Batch that might be a useful alternative, but that is more for heavy batch processing which it doesn't sound like you are doing.

SingleShot
A: 

If possible / feasible, extend the /service to support handle multiple logical requests in a single protocol request; e.g. HTTP request.

In theory, the both the client and server side should be able to do the work with less overheads if the server side gets a single request. There should be savings on both the client and server sides.

Stephen C