<commit_before>// Module included in the following assemblies:
//
// * serverless/configuring-knative-serving-autoscaling.adoc

[id="knative-serving-concurrent-autoscaling-requests_{context}"]
= Configuring concurrent requests for Knative Serving autoscaling

You can specify the number of concurrent requests that should be handled by each instance of an application (revision container) by adding the `target` annotation or the `containerConcurrency` field in the revision template.

Here is an example of `target` being used in a revision template:

[source,yaml]
----
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  name: myapp
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/target: 50
    spec:
      containers:
      - image: myimage
----

Here is an example of `containerConcurrency` being used in a revision template:
[source,yaml]
----
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  name: myapp
spec:
  template:
    metadata:
      annotations:
    spec:
      containerConcurrency: 100
      containers:
      - image: myimage
----

Adding a value for both `target` and `containerConcurrency` will target the `target` number of concurrent requests, but impose a hard limit of the `containerConcurrency` number of requests.

For example, if the `target` value is 50 and the `containerConcurrency` value is 100, the targeted number of requests will be 50, but the hard limit will be 100.
<commit_msg>[WIP] Change v1alpha1 to v1 in Serverless docs code samples<commit_after>// Module included in the following assemblies:
//
// * serverless/configuring-knative-serving-autoscaling.adoc

[id="knative-serving-concurrent-autoscaling-requests_{context}"]
= Configuring concurrent requests for Knative Serving autoscaling

You can specify the number of concurrent requests that should be handled by each instance of an application (revision container) by adding the `target` annotation or the `containerConcurrency` field in the revision template.

Here is an example of `target` being used in a revision template:

[source,yaml]
----
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: myapp
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/target: 50
    spec:
      containers:
      - image: myimage
----

Here is an example of `containerConcurrency` being used in a revision template:
[source,yaml]
----
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: myapp
spec:
  template:
    metadata:
      annotations:
    spec:
      containerConcurrency: 100
      containers:
      - image: myimage
----

Adding a value for both `target` and `containerConcurrency` will target the `target` number of concurrent requests, but impose a hard limit of the `containerConcurrency` number of requests.

For example, if the `target` value is 50 and the `containerConcurrency` value is 100, the targeted number of requests will be 50, but the hard limit will be 100.

{'fraction_non_alphanumeric': 0.07789613848202397, 'fraction_numerical': 0.012982689747003996, 'mean_word_length': 3.9101307189542482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7319180', 'n_tokens_mistral': 871, 'n_tokens_neox': 808, 'n_words': 339}