I try to understand backpressure on Camel routes better. For this purpose,
I set up a load test. This test contains 5 routes that are connected
through direct or seda endpoints. At the end of all routes, I put a delay
or throttle. The routes are getting more messages than the throttle/delay
can handle.

The reason of the test is that I like to notify users when backpressure is
applied, and what the impact on the resources.

In the test I measure the inflight messages on each route. I noticed that
the maximum inflight exchanges on each route is 10. Thus total inflight is
maximum of 50. I try to change the maximum inflight exchanges by setting a
route policy:

ThrottlingInflightRoutePolicy routePolicy = new ThrottlingInflightRoutePolicy();
routePolicy.setScope(ThrottlingInflightRoutePolicy.ThrottlingScope.Context);
routePolicy.setMaxInflightExchanges(10000);
routePolicy.setCamelContext(context);

Bind it to the registry:

context.getRegistry().bind("myPolicy", routePolicy);

And then apply it to a route with

routePolicyRef

I can see that policy is applied (route.getRoutePolicyList()), but it
doesn't seem to have any effect. The max inflight exchanges on a route
remain 10.

My questions:

1. Where does this number "10" of max inflight exchanges per route come
from?
2. How can the max inflight exchanges be changed/configured?
3. What is the impact of changing this value? Is it just more memory that
is used by caching exchanges?
4. Is backpressure only related to routePolicy or there other settings
(threadpool, streamcache etc) that has influence?
5. Is there documentation available that has a detailed explanation on how
backpressure works, what the impact is and how to tune it?

Raymond

Reply via email to