Slow or problematic backend? - Bulkhead is here for the rescue
Tags: api, apigateway, apimanagement, webmethods
Published: 2023-01-27 13:10:02

---
title: Slow or problematic backend? - Bulkhead is here for the rescue
published: true
date: 2023-01-02 11:59:42 UTC
tags: api, apigateway, APImanagement, webMethods
canonical_url: https://tech.forums.softwareag.com/t/slow-or-problematic-backend-bulkhead-is-here-for-the-rescue/267804
---

_webMethods API Gateway version: 10.15 and above_

## Problem Statement

Ever been in a situation where one backend service starts to malfunction and eventually, its queuing in the API Gateway exhausting all the available threads, having a knock-on effect with serving requests for the other APIs?

## Solution

_Restricting the number of concurrent API requests processed for a more robust and fault tolerant API deployment_

Microservice patterns can be extended to the API Gateway world to make the APIs resilient. One such pattern is Bulkhead, wherein elements of an application are isolated into pools so that if one fails, the others continue to function. API Gateway supports the implementation of Bulkhead pattern through a policy in the Transport section of the API policy configuration.

### What is Bulkhead?

The term _**bulkhead**_ comes from the structure reliability engineering concept that is used in ships to create partitions in the hull. In the event of a hull breach, these isolated partitions prevent water from filling up the entire hull and sinking the ship.The aim is to limit and contain the damage to the isolated partitions.

The bulkhead pattern in software systems works similarly by isolating services to prevent them from starving the system of resources.

[![without-bulkhead](https://aws1.discourse-cdn.com/techcommunity/optimized/3X/9/9/996f7eae02e4af0e054692528b06e1dd959cbbc9_2_260x250.jpeg)](https://aws1.discourse-cdn.com/techcommunity/original/3X/9/9/996f7eae02e4af0e054692528b06e1dd959cbbc9.jpeg "without-bulkhead")

A ship without bulkheads sinking as the water fills the entire hull

[![with-bulkhead](https://aws1.discourse-cdn.com/techcommunity/optimized/3X/3/6/36e31ed4e1b8cae53babe837b969dcaaa391d186_2_260x250.jpeg)](https://aws1.discourse-cdn.com/techcommunity/original/3X/3/6/36e31ed4e1b8cae53babe837b969dcaaa391d186.jpeg "with-bulkhead")

A ship with bulkheads isolates and contains the damage

### Enable Bulkhead Policy

Our approach uses a thread pool to separate the service from the caller and contain it to a subset of system resources.

[![image](https://aws1.discourse-cdn.com/techcommunity/optimized/3X/7/0/7051fb0b628ba70869707385d5d2cd820b614914_2_345x184.png)](https://aws1.discourse-cdn.com/techcommunity/original/3X/7/0/7051fb0b628ba70869707385d5d2cd820b614914.png "image")

Bulkhead configuration allows you to specify the maximum number of concurrent requests processed by an API. You can configure this setting individually for an API or globally for all APIs.

When the number of concurrent requests to an API exceeds the specified limit, the excess requests are rejected. In such scenarios, the policy violation events are generated to report the violations occurred for an API. If there are 100 violations, then 100 policy violation events are generated.

You can control the response status code and the status message using the extended settings.

[![image](https://aws1.discourse-cdn.com/techcommunity/optimized/3X/8/2/82a56ff792ecd6e949ec2c3e8df6009bff44b24e_2_345x96.png)](https://aws1.discourse-cdn.com/techcommunity/original/3X/8/2/82a56ff792ecd6e949ec2c3e8df6009bff44b24e.png "image")

For detailed documentation, please refer [Bulkhead Policy](https://docs.webmethods.io/api/10.15.0/apigateway/all_about_apis/chapter2b/#enable-bulkhead).

Want to try? Get started with our Free Forever Edition: [Sign up - Software AG Cloud](https://signup.softwareag.cloud/#/basic-b?product=apigateway)

<sub>Credit: openliberty.io</sub>

[Read full topic](https://tech.forums.softwareag.com/t/slow-or-problematic-backend-bulkhead-is-here-for-the-rescue/267804)