diff --git a/serving/samples/autoscale-go/README.md b/serving/samples/autoscale-go/README.md index 1b021a194..ec50949a9 100644 --- a/serving/samples/autoscale-go/README.md +++ b/serving/samples/autoscale-go/README.md @@ -13,7 +13,7 @@ A demonstration of the autoscaling capabilities of a Knative Serving Revision. 1. The `hey` load generator installed (`go get -u github.com/rakyll/hey`). 1. Clone this repository, and move into the sample directory: - ``` + ```shell git clone https://github.com/knative/docs knative-docs cd knative-docs ``` @@ -28,7 +28,7 @@ A demonstration of the autoscaling capabilities of a Knative Serving Revision. 1. Find the ingress hostname and IP and export as an environment variable: - ``` + ```shell # In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`. INGRESSGATEWAY=knative-ingressgateway @@ -46,7 +46,7 @@ A demonstration of the autoscaling capabilities of a Knative Serving Revision. 1. Make a request to the autoscale app to see it consume some resources. - ``` + ```shell curl --header "Host: autoscale-go.default.example.com" "http://${IP_ADDRESS?}?sleep=100&prime=10000&bloat=5" ``` @@ -58,7 +58,7 @@ A demonstration of the autoscaling capabilities of a Knative Serving Revision. 1. Send 30 seconds of traffic maintaining 50 in-flight requests. - ``` + ```shell hey -z 30s -c 50 \ -host "autoscale-go.default.example.com" \ "http://${IP_ADDRESS?}?sleep=100&prime=10000&bloat=5" \ @@ -124,8 +124,8 @@ A demonstration of the autoscaling capabilities of a Knative Serving Revision. Knative Serving autoscaling is based on the average number of in-flight requests per pod (concurrency). The system has a default -[target concurrency of 100.0](https://github.com/knative/serving/blob/3f00c39e289ed4bfb84019131651c2e4ea660ab5/config/config-autoscaler.yaml#L35) -but [we used 10](service.yaml#L26) for our service. We loaded the service with +[target concurrency of 100](https://github.com/knative/serving/blob/3f00c39e289ed4bfb84019131651c2e4ea660ab5/config/config-autoscaler.yaml#L35-L41) +but [we used 10](service.yaml#L25-L26) for our service. We loaded the service with 50 concurrent requests so the autoscaler created 5 pods (`50 concurrent requests / target of 10 = 5 pods`) @@ -133,11 +133,11 @@ but [we used 10](service.yaml#L26) for our service. We loaded the service with The autoscaler calculates average concurrency over a 60 second window so it takes a minute for the system to stablize at the desired level of concurrency. -However the autoscaler also calculates a 6 second "panic" window and will enter +However the autoscaler also calculates a 6 second `panic` window and will enter panic mode if that window reached 2x the target concurrency. In panic mode the autoscaler operates on the shorter, more sensitive panic window. Once the panic conditions are no longer met for 60 seconds, the autoscaler will return to the -initial 60 second "stable" window. +initial 60 second `stable` window. ``` | @@ -166,7 +166,7 @@ autoscaler classes built into Knative: Example of a Service scaled on CPU: -``` +```yaml apiVersion: serving.knative.dev/v1alpha1 kind: Service metadata: @@ -189,7 +189,7 @@ spec: Additionally the autoscaler targets and scaling bounds can be specified in annotations. Example of a Service with custom targets and scale bounds: -``` +```yaml apiVersion: serving.knative.dev/v1alpha1 kind: Service metadata: @@ -240,7 +240,7 @@ kubectl port-forward --namespace knative-monitoring $(kubectl get pods --namespa 1. Send 60 seconds of traffic maintaining 100 concurrent requests. - ``` + ```shell hey -z 60s -c 100 \ -host "autoscale-go.default.example.com" \ "http://${IP_ADDRESS?}?sleep=100&prime=10000&bloat=5" @@ -248,7 +248,7 @@ kubectl port-forward --namespace knative-monitoring $(kubectl get pods --namespa 1. Send 60 seconds of traffic maintaining 100 qps with short requests (10 ms). - ``` + ```shell hey -z 60s -q 100 \ -host "autoscale-go.default.example.com" \ "http://${IP_ADDRESS?}?sleep=10" @@ -256,7 +256,7 @@ kubectl port-forward --namespace knative-monitoring $(kubectl get pods --namespa 1. Send 60 seconds of traffic maintaining 100 qps with long requests (1 sec). - ``` + ```shell hey -z 60s -q 100 \ -host "autoscale-go.default.example.com" \ "http://${IP_ADDRESS?}?sleep=1000" @@ -265,7 +265,7 @@ kubectl port-forward --namespace knative-monitoring $(kubectl get pods --namespa 1. Send 60 seconds of traffic with heavy CPU usage (~1 cpu/sec/request, total 100 cpus). - ``` + ```shell hey -z 60s -q 100 \ -host "autoscale-go.default.example.com" \ "http://${IP_ADDRESS?}?prime=40000000" @@ -273,7 +273,7 @@ kubectl port-forward --namespace knative-monitoring $(kubectl get pods --namespa 1. Send 60 seconds of traffic with heavy memory usage (1 gb/request, total 5 gb). - ``` + ```shell hey -z 60s -c 5 \ -host "autoscale-go.default.example.com" \ "http://${IP_ADDRESS?}?bloat=1000"