Performance 一个Kubernetes吊舱提供的TPS多于两个或更多
我将容器部署到AWS托管的kubernetes上,并使用 我部署的应用程序有一个端点/person/all,它只返回一个整数 这里我有一个部署配置Performance 一个Kubernetes吊舱提供的TPS多于两个或更多,performance,kubernetes,Performance,Kubernetes,我将容器部署到AWS托管的kubernetes上,并使用 我部署的应用程序有一个端点/person/all,它只返回一个整数 这里我有一个部署配置 apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: Deployment metadata: name: helloworld labels: app: helloworld spec: selector: matchLabels:
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: helloworld
labels:
app: helloworld
spec:
selector:
matchLabels:
app: helloworld
replicas: 1
template:
metadata:
labels:
app: helloworld
spec:
containers:
- name: helloworld
image: alexey007gold/helloworld:1.0
imagePullPolicy: Always
resources:
requests:
cpu: 2
memory: 1G
ports:
- containerPort: 8080
volumeMounts:
- name: tmp-dir
mountPath: "/tmp"
volumes:
- name: tmp-dir
emptyDir:
{}
securityContext:
fsGroup: 59417
runAsUser: 59417
还有一项服务
apiVersion: v1
kind: Service
metadata:
name: helloworld
labels:
app: helloworld
spec:
type: LoadBalancer
ports:
- port: 8080
selector:
app: helloworld
我还部署了一个容器来运行测试
apiVersion: batch/v1
kind: Job
metadata:
name: wrk-job
labels:
app: wrk-job
spec:
template:
spec:
securityContext:
fsGroup: 59417
runAsUser: 59417
volumes:
- name: tmp-dir
emptyDir:
{}
containers:
- name: wrk-job
image: skandyla/wrk:latest
command: ["sleep"]
args: ["2h"]
imagePullPolicy: Always
resources:
limits:
memory: "8G"
cpu: "15"
requests:
memory: "8G"
cpu: "15"
volumeMounts:
- name: tmp-dir
mountPath: "/tmp"
restartPolicy: Never
然后我用ssh进入它
kubectl exec -it wrk-job-n6b8x sh
然后运行测试
wrk -t500 -c500 -d10s http://helloworld:8080/person/all
对于一个吊舱,我每秒收到大约70K个请求。当我缩放到2个豆荚时
kubectl scale deployment/helloworld --replicas=2
我只得到一半,而我希望它加倍。
我对多实例性能应该如何工作的理解有什么问题吗?我将从Kubernetes的角度回答这个问题 扩展部署将平均所有吊舱之间的负载。从1个吊舱到2个吊舱时,负载在它们之间50/50分开。因此,如果负载恒定,那么您拥有的副本越多,每个pod分配的平均负载就越少。如果您想要实现更多的测试程序集并看到结果,您可以随时增加测试负载 我认为这个话题的下一个自然步骤是熟悉: 水平吊舱自动缩放器可自动缩放一个容器中的吊舱数量 复制控制器、部署、副本集或基于状态集 在观察到的CPU利用率上(或者,在测试版支持的情况下,在其他情况下, 应用程序提供的度量)