sebastiandaschner blog

Applying Bulkheads And Backpressure using MicroProfile (Video)

#microprofile sunday, march 03, 2019

I’ve recorded a video how to implement the bulkheads and backpressure using MicroProfile Fault Tolerance. The idea behind bulkheads is to split applications into several execution units that isolate functionality. In enterprise Java applications this typically means to define multiple thread pools.

Applying backpressure to clients results in either adding information about the current pressure on the system to the client so that they will react to it, or to explicitly deny the request with a temporary error response.

In a previous video, I showed how to implement that using plain Java EE via the Porcupine extension.

In this video, I’ll show how MicroProfile Fault Tolerance enables us to apply the same principles, with even less configuration, by combining JAX-RS asynchronous resources, completable futures, @Asynchronous, and @Bulkhead.

You’ll find the code in the GitHub project and further explanation in the MicroProfile Fault Tolerance specification. To read more on the topic of how to craft resilient enterprise applications, also have a look at the following article.

Update 2019-03-07:

It seems that the term backpressure caused some confusion with the usage within reactive architectures. In these videos, I’m referring to how to make the service behavior and responsiveness more predictable to limit queue sizes and applying backpressure to the load generated by the clients that connect to our service. This is not meant in a way that a consumer (client) signals the producer (server) to slow down data emission, but to when our server is threatened to become overloaded with the client load.

The whole purpose of defining and constraining multiple resource pools is to being predictable to whether our service is able to respond within a given time. If that is not the case, we want the service to immediately deny the request without unnecessarily consuming too much of the client’s time.

For some further background on that topic you can read the following articles on how to applying backpressure when overloaded, and my article on how to meet production requirements.


Found the post useful? Subscribe to my newsletter for more free content, tips and tricks on IT & Java: