Limiting views requests

Limiting views requests

To limit the number of simultaneous view request on a server node, use the POST /internalSettings HTTP method and URI and a port-related request parameter.

Description

Couchbase Server provides limits to incoming connections on a server node. The limits are to prevent the server from becoming overwhelmed. When a limit is exceeded, the server rejects the incoming connection, responds with a 503 HTTP status code, and sets the HTTP Retry-After header.

  • If the request is made to a REST port, the response body provides the reason for the rejection.
  • If the request is made on a CAPI port, such as a views request, the server responds with a JSON object with error and reason fields.

HTTP method and URI

POST /internalSettings

Parameters:

The following are port-related request parameters:

By default, these settings do not have a limit.

  • restRequestLimit

    Maximum number of simultaneous connections each server node accepts on a REST port. Diagnostic-related requests and /internalSettings requests are not counted in this limit.

  • capiRequestLimit

    Maximum number of simultaneous connections each server node accepts on a CAPI port. This port is used for XDCR and views connections.

  • dropRequestMemoryThresholdMiB

    Value in MB. The maximum amount of memory that is used by Erlang VM. If the amount is exceeded, the server starts dropping incoming connections.

Important: Keep the default setting unless you experience issues with too many requests impacting a node. If these thresholds are set too low, too many requests are rejected by the server, including requests from the Couchbase web console.

Syntax

Curl request syntax:

curl -X POST -u [admin]:[password]
  http://[localhost]:8091/internalSettings 
  -d capiRequestLimit=[value]

Example

Curl request example:

The following example limits the number of simultaneous views requests and internal XDCR requests which can be made on a port.

curl -X POST -u Administrator:password 
  http://10.5.2.117:8091/internalSettings 
  -d capiRequestLimit=50
  -d restRequestLimit=50

Response

No response is returned with a curl request changing the rest or capi request limit. Retrieve the internal settings to see changes.

The following example retrieves and shows the internal settings with the rest and capi request limits set to 50:

curl -u Administrator:password http://10.5.2.117:8091/internalSettings
        
        
{
    "capiRequestLimit": 50, 
    "dropRequestMemoryThresholdMiB": "", 
    "indexAwareRebalanceDisabled": false, 
    "maxBucketCount": 10, 
    "maxParallelIndexers": 6, 
    "maxParallelReplicaIndexers": 2, 
    "rebalanceIgnoreViewCompactions": false, 
    "rebalanceIndexPausingDisabled": false, 
    "rebalanceIndexWaitingDisabled": false, 
    "rebalanceMovesBeforeCompaction": 64, 
    "rebalanceMovesPerNode": 1, 
    "restRequestLimit": 50, 
    "xdcrAnticipatoryDelay": 0, 
    "xdcrCheckpointInterval": 1800, 
    "xdcrDocBatchSizeKb": 2048, 
    "xdcrFailureRestartInterval": 30, 
    "xdcrMaxConcurrentReps": 32, 
    "xdcrOptimisticReplicationThreshold": 256, 
    "xdcrWorkerBatchSize": 500
}