1
votes

I developed some rest services with apache camel.

After deployment of my webservice with the corresponding rest services, the first request of one of the rests needs much more time than the following requests.

In some cases the first request needs about 500ms and the following are in the range of 8-20ms (with some exceptions).

How can I solve this problem? Is there a way to call each rest service on startup? This problem affects the first request only.

What does camel do during the first request?

1

1 Answers

0
votes

This is can be to do with some set up in your java which takes a long time e.g. setting up JAXB contexts if you're doing some marshalling. Look for if there are any expensive operations in your route and try to move them to the start up of the route rather then occurring when routing happens. To answer this better, you would need to show what your route is so someone might be able to identify the expensive operation.