当前位置:网站首页>How can services start smoothly under tens of millions of QPS
How can services start smoothly under tens of millions of QPS
2022-08-02 20:45:00 【InfoQ】
背景

原因分析
解决方案

- The first step is to ensure that the system runs smoothly完全启动完成后,to have traffic access;
- 第二步Small flow preheating,through a small amount of trafficJVM The virtual machine compiles high-frequency code into machine code and caches it in the JVM 缓存中,再次使用的时候不会触发临时加载;
- 第三步Gradually put traffic to full volume,When a high-traffic request uses hot code,No need to explain every pass,Finally achieve smooth start.
System fully booted
F5探活
注册中心注册

ribbon.eager-load.enabled=true
ribbon.eager-load.clients=service_id1,service_id2
probe detection

<--省略无用信息-->
spec:
containers:
- name: *****
image: *****
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8090
initialDelaySeconds: 5 # 容器启动后多久开始探测
failureThreshold: 10 # 连续探测10次失败表示失败
timeoutSeconds: 10 # 表示容器必须在10s内做出相应反馈给probe,否则视为探测失败
periodSeconds: 5 # 探测周期,每5s探测一次
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8090
initialDelaySeconds: 10 # 容器启动后多久开始探测
timeoutSeconds: 2 # 表示容器必须在2s内做出相应反馈给probe,否则视为探测失败
periodSeconds: 30 # 探测周期,每30s探测一次
successThreshold: 1 # 连续探测1次成功表示成功
failureThreshold: 3 # 连续探测3次失败表示失败
<--省略无用信息-->
Small flow preheating

开源 Dubbo

- 服务提供端在向注册中⼼注册服务的过程中,将⾃身的预热时⻓ WarmupTime、服务启动时间 StartTime 通过元数据的形式注册到注册中⼼中;
- 服务消费端在注册中⼼订阅相关服务实例列表,调⽤过程中根据 WarmupTime、StartTime 计算个实例所分批的调⽤权重;
- 刚启动 StartTime 距离调⽤时刻差值较⼩的实例权重下,从⽽实现对刚启动应⽤Allocate less traffic to achieve 其进⾏⼩流量预热.
open source meituanOCTO-RPC


Serivce Mesh Isito-proxy

message SlowStartConfig {
// Represents the size of slow start window.
// If set, the newly created host remains in slow start mode starting from its creation time
// for the duration of slow start window.
google.protobuf.Duration slow_start_window = 1;
// This parameter controls the speed of traffic increase over the slow start window. Defaults to 1.0,
// so that endpoint would get linearly increasing amount of traffic.
// When increasing the value for this parameter, the speed of traffic ramp-up increases non-linearly.
// The value of aggression parameter should be greater than 0.0.
// By tuning the parameter, is possible to achieve polynomial or exponential shape of ramp-up curve.
//
// During slow start window, effective weight of an endpoint would be scaled with time factor and aggression:
// `new_weight = weight * time_factor ^ (1 / aggression)`,
// where `time_factor=(time_since_start_seconds / slow_start_time_seconds)`.
//
// As time progresses, more and more traffic would be sent to endpoint, which is in slow start window.
// Once host exits slow start, time_factor and aggression no longer affect its weight.
core.v3.RuntimeDouble aggression = 2;
}
总结
- 实例启动,包括JVM、Springetc. initialization and initialization of some microservice components such as configuration center,It is worth noting that do not register in the registry before the resource is fully loaded,You can delay registration by setting,让应⽤在充分初始化后再注册到注册中⼼对外提供服务;
- Small flow preheating,Via client load and weight algorithm,Make the traffic of the instance node just started grow linearly,Ultimately reached normal levels;
- 全量运行,需要查看JVM、Interface corresponding time indicator monitoring and logging,Make sure that the newly launched instance goes online without any problems.
边栏推荐
猜你喜欢
随机推荐
来亲自手搭一个ResNet18网络
9月起中国给予多哥等16国98%税目产品零关税待遇
Data Governance: The Evolution of Data Integration and Application Patterns
Mini Program Graduation Works WeChat Gymnasium Reservation Mini Program Graduation Design Finished Product (8) Graduation Design Thesis Template
Enterprise cloud cost control, are you really doing it right?
Cpolar application example of data acquisition equipment
golang刷leetcode 经典(5)设计哈希集合
究极异常处理逻辑——多层次异常的处理顺序
白话电子签章原理及风险
MySQL索引
潮玩的“第二春”,在哪?
动力电池扩产潮,宁德时代遭围剿
E-Surfing Cloud 4.0 Distributed Cloud Enables Digital Transformation of Thousands of Industries
SQL 正则解析手机号码提供商
AI+医疗:使用神经网络进行医学影像识别分析
redis总结_基础
NeRF: The Secret of 3D Reconstruction Technology in the Popular Scientific Research Circle
ffmpeg cannot find libx264 after compilation
Interviewer: can you talk about optimistic locking and pessimistic locks
2021年下半年软件设计师上午真题