kubernetes - 如何使用部署在 Kubernetes 上的服务的延迟来扩展部署?
问题描述
我在 GCP 上的 Kubernetes 上部署了一个简单的 Spring Boot 应用程序。该服务暴露给外部 IP 地址。我正在使用 JMeter 对该应用程序进行负载测试。它只是一个返回or的 httpGET
请求。True
False
我想随着时间的推移获取延迟指标,以将其提供给 HorizontalPodAutoscaler 以实现自定义自动缩放器。我该如何实施?
解决方案
Since you mentioned Custom Auto Scaler. I would suggest this simple solution which makes use of some of tools which you already might have.
First Part: Is to Create a service or cron or any time-based trigger which will on a regular interval make requests to your deployed application. This application will then store the resultant metrics to persistence storage or file or Database etc.
For example, if you use a simple Apache Benchmark CLI tool(you can also use Jmeter or any other load testing tool which generates structured o/p), You will get a detailed result for a single query. Use this link to get around the result for your reference.
Second Part Is that this same script can also trigger another event which will check for the latency or response time limit configured as per your requirement. If the response time is above the configured value scale if it is below scale down.
The logic for scaling down can be more trivial, But I will leave that to you.
Now for actually scaling the deployment, you can use the Kubernetes API. You can refer to the official doc or this answer for details. Here's a simple flow diagram.
推荐阅读
- android - 在 Play 商店中发布应用程序时,在应用程序内容中找不到是或否按钮
- mysql - 我使用 docker 收到 wordpress mysql 连接错误
- android - 无法解决简单获取请求中的主机错误
- c - 服务器客户端程序参数?
- java - 如何导入位于同一文件夹但不在同一位置的包?
- activemq-artemis - 支持 SSL 的 Artemis ActiveMQ 配置
- kendo-ui - 如何在电子邮件中以附件形式发送剑道 ui 网格数据?
- c++ - 如何在 Qt 中翻译变量文本?
- django-rest-framework - 重命名嵌套序列化程序中的字段 - Django Rest Framework
- sql - impute duplicate record id from conditions on other columns sql