Skip to content

Latest commit

 

History

History
42 lines (37 loc) · 1.59 KB

serverless-concurrency-limits-configure-hard.adoc

File metadata and controls

42 lines (37 loc) · 1.59 KB

Configuring a hard concurrency limit

You can specify a hard concurrency limit for your Knative service by modifying the containerConcurrency spec or by using the kn service command with the correct flags.

Procedure
  • Optional: Set the containerConcurrency spec for your Knative service in the spec of the Service custom resource:

    Example service spec
    apiVersion: serving.knative.dev/v1
    kind: Service
    metadata:
      name: example-service
      namespace: default
    spec:
      template:
        spec:
          containerConcurrency: 50

    The default value is 0, which means that there is no limit on the number of requests that are permitted to flow into one pod of the service at a time.

    A value greater than 0 specifies the exact number of requests that are permitted to flow into one pod of the service at a time. This example would enable a hard concurrency limit of 50 requests at a time.

  • Optional: Use the kn service command to specify the --concurrency-limit flag:

    $ kn service create <service_name> --image <image_uri> --concurrency-limit <integer>
    Example command to create a service with a concurrency limit of 50 requests
    $ kn service create example-service --image quay.io/openshift-knative/knative-eventing-sources-event-display:latest --concurrency-limit 50