文章

寫點文章吧.

你的 Istio Mesh 性能及格吗?
· ☕ 4 分钟
前言 话说,一年前项目响应时代的号召,引入了 Istio,从此如刘备得卧龙、凤雏,走上了 Service Mesh 的光辉大道。现到准备益州之战(上线)之时。上线前,还

ipvs load balancer
· ☕ 1 分钟
IPVS as load balancer https://medium.com/@benmeier_/a-quick-minimal-ipvs-load-balancer-demo-d5cc42d0deb4 Get stats $ sudo ipvsadm -L -n --stats --rate IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Conns InPkts OutPkts InBytes OutBytes -> RemoteAddress:Port TCP 1.2.3.4:80 80 560 400 36000 41040 -> 172.17.0.3:80 22 154 110 9900 11286 -> 172.17.0.4:80 58 406 290 26100 29754 Ref. https://medium.com/@benmeier_/a-quick-minimal-ipvs-load-balancer-demo-d5cc42d0deb4 https://debugged.it/blog/ipvs-the-linux-load-balancer/

tty
· ☕ 3 分钟
Jobs SIGHUP 默认动作:Terminate 可能动作:Terminate, Ignore, Function call 当检测到 hangup 时,UART 驱动会向整个 session 发送 SIGHUP 信号。 正常情况下,这会 kill 掉所有

Netfilter and IPTable and conntrack
· ☕ 1 分钟
Tables↓/Chains→ PREROUTING INPUT FORWARD OUTPUT POSTROUTING (routing decision) ✓ raw ✓ ✓ (connection tracking enabled) ✓ ✓ mangle ✓ ✓ ✓ ✓ ✓ nat (DNAT) ✓ ✓ (routing decision) ✓ ✓ filter ✓ ✓ ✓ security ✓ ✓ ✓ nat (SNAT) ✓ ✓ Incoming packets destined for the local system: PREROUTING -> INPUT Incoming packets destined to another host: PREROUTING -> FORWARD -> POSTROUTING Locally generated packets: OUTPUT -> POSTROUTING Connection Tracking https://arthurchiao.

Kubernetes 自动扩缩容
· ☕ 1 分钟
本文状态:草稿 配置例子 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 apiVersion:autoscaling/v2beta2kind:HorizontalPodAutoscalermetadata:name:php-apachespec:scaleTargetRef:apiVersion:apps/v1kind:Deploymentname:php-apacheminReplicas:1maxReplicas:10metrics:- type:Resourceresource:name:cputarget:type:UtilizationaverageUtilization:50 算法 desiredReplicas = ceil[currentReplicas * ( currentMetricValue / desiredMetricValue )] currentMetricValue 为相关 pod 的 metric 平均数。 If multiple metrics are specified in a HorizontalPodAutoscaler, this calculation is done for each metric, and then

内核同步原语
· ☕ 5 分钟
什么是同步原语 共享内存,多进程/线程的运行期设计模式已成主流的今天,你有好奇一下,进程/线程间的怎么同步的吗?大部分人知道,我们用的开发语言

Istio Canary(金丝雀) 上线
· ☕ 1 分钟
按比例分配分配新旧版本流量 VirtualService: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 apiVersion:networking.istio.io/v1alpha3kind:VirtualServicemetadata:name:reviewsspec:hosts:- reviewshttp:- route:- destination:host:reviewssubset:v1weight:75- destination:host:reviewssubset:v2weight:25 DestinationRule : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 apiVersion:networking.istio.io/v1alpha3kind:DestinationRulemetadata:name:bookinfo-ratingsspec:host:reviewstrafficPolicy:loadBalancer:simple:LEAST_CONNsubsets:- name:v1labels:version:v1trafficPolicy:loadBalancer:simple:ROUND_ROBIN- name:v2labels:version:v2trafficPolicy:loadBalancer:simple:ROUND_ROBIN 根据请求源 pod 的

bpftool
· ☕ 1 分钟
bpftool bpftool prog 1 $ ./execsnoop & 1 2 3 4 5 6 7 $ bpftool prog 9: kprobe name syscall__execve tag f66477d6a4dd923d gpl loaded_at 2021-03-05T16:52:05+0800 uid 0 xlated 4064B jited 2321B memlock 8192B map_ids 11 10: kprobe name do_ret_sys_exec tag 3a66f7b49f929a2e gpl loaded_at 2021-03-05T16:52:05+0800 uid 0 xlated 480B jited 314B memlock 4096B map_ids 11 The prog show subcommand lists all programs (not just those that are perf_event_open() based): 1

eBPF API
· ☕ 1 分钟
User Space API 1 2 3 4 5 6 7 8 9 10 11 # strace -ebpf ./execsnoop bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_PERF_EVENT_ARRAY, key_size=4, value_size=4, max_entries=4, map_flags=0, inner_map_fd=0, map_name="events", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0}, 120) = -1 EPERM (Operation not permitted) bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_PERF_EVENT_ARRAY, key_size=4, value_size=4, max_entries=4, map_flags=0, inner_map_fd=0, map_name="events", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0}, 120) = 3 bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_KPROBE, insn_cnt=508, insns=0x7fbdc7157000, license="GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(5, 3, 18), prog_flags=0, prog_name="syscall__execve", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, func_info_rec_size=0, func_info=NULL,