탭이 너무 지저분해서 아래에 일반 붙여놓고 닫기, 나중에 필요하면 열어보기
k8s 와 vegeta 로 부하 발생기 만듬. vegeta 가 결과를 잘 정리해 주는 것 같아서 해당 결과를 모아 보게끔 만들었다.
apiVersion: apps/v1
kind: Deployment
metadata:
name: ncc-vegeta
labels:
ncc.navercorp.com/instance-name: ncc-vegeta
spec:
selector:
matchLabels:
ncc.navercorp.com/instance-name: ncc-vegeta
replicas: 512
strategy:
type: Recreate
template:
metadata:
labels:
ncc.navercorp.com/instance-name: ncc-vegeta
spec:
hostNetwork: true
containers:
- name: vegeta
image: real.registry.navercorp.com/ncc-public/vegeta:v3
command: ["bash", "-c", 'echo "GET http://bluemir.me" | vegeta attack -timeout=3s -workers=20 -rate=1000 -max-body=0 -duration=5m > result.bin && tail -f /etc/hosts']
lifecycle:
preStop:
exec:
command: ["bash", "-c", "scp result.bin bluemir@dev.bluemir.me:vegeta/07/`xid`.bin"]
resources:
limits:
memory: "8Gi"
requests:
memory: "20Mi"
512개의 POD 이 개당 1000TPS 로 보낸다.
결과를 모으는 것은 volume 으로 할수도 있지만 당장은 scp 가 가장 편해서 scp로 했다.
xargs 의 template 기능 다음과 같이 xargs에서 간단한 템플릿팅을 할수 있다.
seq 1 20 | xargs -I '[]' echo hey iam '[]' middle