Tiven Wang
Wang Tiven September 05, 2017
425 favorite favorites
bookmark bookmark
share share

Pivotal Web Services (PWS) 的 Marketplace 里的 App Autoscaler 是用来根据设定的规则自动伸缩应用程序的一项服务。

Set up App Autoscaler

在 PWS 界面里创建或者使用 CLI 创建。

用命令行创建 AutoScaler 服务实例 cf cs app-autoscaler standard try-cf-autoscaler
绑定到 Application cf bind-service try-cf-spring-boot try-cf-autoscaler
然后重启应用程序 cf restage try-cf-spring-boot

Configure Autoscaling for an App

打开 AutoScaler 实例的管理界面

full-autoscaler.png

首先 AutoScaler 可以设置最小最大实例数限制。

其次 Autoscaler Scale 应用程序是通过事件机制实现的。目前事件有两种,基于 Rule 的事件,和 Scheduled 的事件。

Rules

基于 rule 的事件有三种指标:

Metric Description
CPU Utilization Average CPU percentage for all instances of the app
HTTP Latency Average Latency of applications response to HTTP requests. This does not include Gorouter processing time or other network latency. Average is calculated on the middle 99% or middle 95% of all HTTP requests.
HTTP Throughput Total HTTP Requests per second (divided by total app instances).

当规则中指标达到设定的上下限时,会产生相应的事件,Autoscaler 根据事件增加或减少应用程序实例数量。

Scheduled Limit Changes

可以设定时间去改变应用程序实例数的范围数值,以达到定时增加或减少应用程序实例的目的。

Event History

Event History 是一个简单记录事件的页面。

References

Similar Posts

  • Try Cloud Foundry 13 - Logs Loggregator is the next generation system for aggregating and streaming logs and metrics from all of the user apps and system components in an Elastic Runtime deployment. Loggregator uses Google's protocol buffers along with gRPC to deliver logs.
  • Try Cloud Foundry 12 - Config Server Config Server for Pivotal Cloud Foundry (PCF) is an externalized application configuration service, which gives you a central place to manage an application’s external properties across all environments.
  • Microservices - API Gateway Implement an API gateway that is the single entry point for all clients. The API gateway handles requests in one of two ways. Some requests are simply proxied/routed to the appropriate service. It handles other requests by fanning out to multiple services.
  • Microservices - Circuit Breaker 访问远程服务时, 比依赖超时时间更好一些的方式是一种叫断路器(Circuit Breaker)的模式. Circuit Breaker 就像一位交通警察, 在前方道路畅通的情况下, 他会放行; 当前方道路由于各种原因拥堵时, 他会告诉你前方道路不通请回; 如果他是个更智能的交警的话, 还会告诉你前方道路部分拥堵, 只允许部分车辆通过, 比如实行单双号.
  • Redis Redis
  • Microservices - Load Balancing 在微服务架构中每个服务都可能有多个运行实例, 那么服务消费者在调用服务时怎么定位应该把请求发送给哪个实例呐? 这就是负载均衡 Load Balancing 要做的事情。Load Balancing 可以在服务端也可以是在消费端。

Comments

comments powered by Disqus
Back to Top