Performance tuning the Apiman Gateway (WildFly, EAP, Tomcat)

· apiman, gateway, performance
Avatar for Marc Savy
Co-founder & maintainer of Apiman. Founded Black Parrot Labs to support enterprise Apiman users.
/ Black Parrot Labs /

In this blog, we’ll outline a few simple tweaks you can make to improve the performance of the Apiman Gateway when running on servlet platforms (WildFly, EAP, Tomcat, etc).

Most of the focus will be on WildFly and EAP, but others will be more broadly applicable.

Naturally, these are very rough pointers and should merely be hints for areas that could prove fruitful. There’s no one-size-fits all approach to tuning, so always profile and keep tweaking to find the best settings for your workloads.

Increase maximum allowed connections

At the time of publishing (1.3.0.Final), the OkHttpClient max connections setting can be increased by setting the http.maxConnections system property [1]:

-Dhttp.maxConnections=100

This should increase the number of connections that can be handled between apiman and the backend API.

WildFly/EAP

You can also increase the WildFly/EAP connection limit. In your standalone.xml, look for the Undertow subsystem, and add a request-limit to the filters section.

<request-limit name="limit-connections" max-concurrent-requests="15000" queue-size="100"/>

Here are some config examples:

This should improve the number of connections that can be handled between the client (caller) and the apiman gateway.

Tomcat

For Tomcat, the equivalent options appear to be maxConnections and maxThreads. Refer to the documentation for more.

Some community-contributed IO tweaks

Community member Harry Trinta shared some tweaks to IO settings he found useful for WildFly 10 when running Apiman at high load.

If you’re seeing broken pipe errors or dropped connections, it may be worth tweaking these parameters.

The usual JVM and OS tweaks

This is an entire speciality in of itself and out of scope for t his brief blog, but it’s worth mentioning in passing. You should run some profiling on your workloads to see whether various JVM tweaks could improve your performance.

In your list of things to try should be heap size, garbage collector and collector settings [2]. It is also likely worth evaluating your system as a whole; do you have other processes on the system which may be causing hiccups; do you have enough file handles available; have you tweaked your protocol settings?

Use the Vert.x gateway implementation

To get superior performance, consider using the Vert.x gateway distribution. Vert.x is an async platform, optimised for high-throughput scenarios and is ideally suited to the apiman gateway.


1. This option is valid as of OkHttpClient 2.4.0, and is changed in later versions. We will endeavour to provide backwards compatibility when apiman upgrades.
2. Anyone want to try Shenandoah GC :-)?