Will warming up speed up sending http request in Java?

511 Views Asked by At

I wonder whether warming up the code by sending unharmful requests for a number of times will reduce the time that we take to receive the response in Java?

1

There are 1 best solutions below

1
On

Your assumption is valid, but I would recommend other performance improvement techniques.

HTTPS calls

Creating a new connection is time consuming, but it takes a lot only the first time (during the handshake), subsequent requests being similar with HTTP. So keeping a connection alive or sending a dummy request before the real one will indeed improve the first request.

Java code

A Java app can have a lot of resources which do not load eagerly (reading properties files, static initialisation blocks...) and faking a request which will load those resources will help again, for the first request.

Other

Caching is common, so when you are requesting data, it may be cached for further access. But you need to check this on your particular case.