Inbound bulkhead

Use the Inbound bulkhead configuration to specify the maximum number of concurrent requests processed by an API.

You can configure the Inbound bulkhead setting individually for an API or globally for all APIs. On applying the bulkhead configuration, the excess requests are rejected when the number of concurrent requests to an API exceed the specified limit. For such rejections, API policy violations are reported with the generation of policy violation events. If 100 violations occur, then 100 policy violation events are generated.

According to the order of policies, the bulkhead limit policy is applied first. Which means that, if the multiple policies you apply includes the bulkhead limit policy, then the bulkhead limit policy is applied first.

Why configure bulkhead limit for APIs?

Consider an environment where multiple APIs run simultaneously. One of the APIs might use most of the system resources due to the number of invocations. Therefore, resulting in the under performance of other APIs.

For example, the maximum thread pool size of your system is 100 and is shared among five APIs. When one API has 100 invocations, then that API tends to use up all the available threads to process its requests. The other APIs must wait until threads are available. To prevent excessive resource usage, you can specify the maximum number of concurrent requests that an API can process. This number depends on the maximum thread pool size of your system.

Consider the same scenario after the bulkhead limit for the APIs is specified. In this example, the thread pool size is 100. If you configure 20 as the maximum concurrent limit for each API, then each of the APIs can process a maximum of 20 requests, exceeding which, the requests are rejected. The bulkhead policy helps maintain the optimal usage of the system resources.

Example of an Inbound bulkhead policy in code view.
kind: InboundBulkHead
apiVersion: api.ibm.com\v1
metadata:
  name: Inbound_bulkhead
  namespace: Policies
  version: '1.0'
  tags: []
  labels:
    gatewayTypes:
      - webMethods
spec:
  maxConcurrentCalls: 20
  enableBulkheadForCallbacks:
    maxConcurrentCallbacks: 30
  retryAfterResponseHeader:
    retryAfterValue: 100  #in seconds

For the InboundBulkhead policy kind, configure these specifications:

Property Description
spec

Denotes the various specifications that you can configure for this policy.

You can set the following specifications:

  • maxConcurrentCalls. Specifies the maximum concurrent request limit for an API, exceeding which the requests are rejected. This number does not include callbacks. You can separately specify the maximum concurrent callbacks that an API can handle.
  • enableBulkheadForCallbacks. Enable this option to specify the maximum number of concurrent callbacks for the API.
    • maxConcurrentCallbacks Specifies the maximum concurrent request limit for all APIs.
  • retryAfterResponseHeader. Select this option to include the Retry-After header in the response sent when requests are rejected. This informs the client about the waiting duration before sending consecutive requests.
    • retryAfterValue. Specifies whether retryAfterResponseHeader must be included in the response when requests are rejected. If selected, specify the duration (in seconds) before consecutive requests are sent.