问题原文
原帖链接 · kross · CC BY-SA 3.0
Here's a great writeup on scaling with heroku (and it applies to traditional deployments).
Given that we want containerized applications to be single process, how do we get:
- slow client protection
- slow response protection
in a Kubernetes/GKE environment that takes full advantage of horizontal pod autoscaling?
Assume my deployment looks much like the following (credit @nithinmallya4):
I have not yet selected a web server, and by default rackup is serving WEBrick. I was considering just changing this to multi-threaded Puma.
My concern is that the autoscaler works based on CPU, not based on an idea that it is consumed by a current http/s request, so it may not come into play.
- Am I understanding the autoscaler correctly?
- What is the ideal scale up/down architecture?
Our current thoughts:
nginx in a pod sidecar pattern (with a gzip
deflater) behind anIngress.pumain front of rails (in the sameimageas rails-api), assuming that it would better utilize cpu and trigger autoscalecustom metrics for HPA (still need to research this with 1.8)
已采纳解答
原帖链接 · Maks Osowski · CC BY-SA 3.0
On GKE we have been supporting HPA with custom metrics since version 1.9. If you have a group of horizontally autoscaled pods inside your cluster each exporting a custom metric then you can set an average per pod target for that metric.
An example of that would be an autoscaled deployment of a frontend where each replica exports its current QPS. One could set the average target of QPS per frontend pod and use the HPA to scale the deployment up and down accordingly. You can find the documentation and a tutorial explaining how to set this up here: https://cloud.google.com/kubernetes-engine/docs/tutorials/custom-metrics-autoscaling
Kubernetes 1.10 becoming available on GKE will extend the support for custom metrics to include metrics not attached to any Kubernetes object. This will give you the ability to scale a deployment based on any metric listed here, for example number of messages in Google Pub/Sub queue.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
