golang CPU性能火焰图分析

step 1 获取cpu采样

go tool pprof http://localhost:6001/debug/pprof/profile

执行完成后会打印采样文件所在的位置

step 2 web端火焰图展示

go tool pprof -http=0.0.0.0:8081 /home/xxxx/pprof/pprof.gsmdatasvrd.samples.cpu.037.pb.gz

利用客户端给kafka写消息

./kafka-console-producer.sh –topic mmm_m_m_topic –bootstrap-server 9.124.353.105:9092

提供交互式终端,可以写入消息

./kafka-topics.sh –create –botstrap-server 9.134.153.105:9092 –replication-factor 1 –partition 12 –topic mmm_m_m_topic

创建topic

使用fio测试磁盘性能

yum install fio

fio -filename=test.data -direct=1 -iodepth 1 -thread -rw=randrw -ioengine=psync -bs=16k -size=500M -numjobs=10 -runtime=10 -group_reporting -name=mytest

关注write IOPS 和 read IOPS所在行的数据

etcd集群搭建

mkdir -p /etc/etcd.d
mkdir -p /var/etcd/
mkdir -p /var/etcd/wal
vi /etc/etcd.d/etcd.conf
实例1配置文件
name: 'etcd1'
data-dir: '/var/etcd'
wal-log: '/var/etcd/wal'
snapshot-count: 10000
heartbeat-interval: 100
election-timeout: 1000
listen-peer-urls: 'http://0.0.0.0:2380'
listen-client-urls: 'http://0.0.0.0:2379'
max-snapshots: 5
max-wals: 5
cors:
initial-advertise-peer-urls: 'http://0.0.0.0:2380'
advertise-client-urls: 'http://0.0.0.0:2379'
initial-cluster: 'etcd1=http://172.17.0.10:2380,etcd2=http://172.17.0.11:2380,etcd3=http://172.17.0.12:2380'
initial-cluster-token: 'etcd'
initial-cluster-state: 'new'
strict-reconfig-check: false
enable-v3: true
enable-pprof: true
debug: false
logger: zap
log-outputs: [stderr]
实例2配置文件
name: 'etcd2'
data-dir: '/var/etcd'
wal-log: '/var/etcd/wal'
snapshot-count: 10000
heartbeat-interval: 100
election-timeout: 1000
listen-peer-urls: 'http://0.0.0.0:2380'
listen-client-urls: 'http://0.0.0.0:2379'
max-snapshots: 5
max-wals: 5
cors:
initial-advertise-peer-urls: 'http://0.0.0.0:2380'
advertise-client-urls: 'http://0.0.0.0:2379'
initial-cluster: 'etcd1=http://172.17.0.10:2380,etcd2=http://172.17.0.11:2380,etcd3=http://172.17.0.12:2380'
initial-cluster-token: 'etcd'
initial-cluster-state: 'new'
strict-reconfig-check: false
enable-v3: true
enable-pprof: true
debug: false
logger: zap
log-outputs: [stderr]

实例3配置文件
name: 'etcd3'
data-dir: '/var/etcd'
wal-log: '/var/etcd/wal'
snapshot-count: 10000
heartbeat-interval: 100
election-timeout: 1000
listen-peer-urls: 'http://0.0.0.0:2380'
listen-client-urls: 'http://0.0.0.0:2379'
max-snapshots: 5
max-wals: 5
cors:
initial-advertise-peer-urls: 'http://0.0.0.0:2380'
advertise-client-urls: 'http://0.0.0.0:2379'
initial-cluster: 'etcd1=http://172.17.0.10:2380,etcd2=http://172.17.0.11:2380,etcd3=http://172.17.0.12:2380'
initial-cluster-token: 'etcd'
initial-cluster-state: 'new'
strict-reconfig-check: false
enable-v3: true
enable-pprof: true
debug: false
logger: zap
log-outputs: [stderr]
启动
setsid etcd --config-file /etc/etcd.d/etcd.conf

查看集群节点