Nats JetStream 测试

环境条件: UCloud 公网 Kubernetes 3 个 Pod 组成 Nats 集群,每个 Pod 分别编排至不同的 Node(2C4G) 测试 1 1 个发布者,发布每条 16B 共 1000000 条的信息 1 个订阅者,订阅生成的 1000000 条信息 $ nats bench bar --js --pub 1 --size 16 --msgs 1000000 -s nats://s1.kainonly.com:4222,nats://s2.kainonly.com:4222,nats://s3.kainonly.com:4222 --nkey ./weplanx.key 10:37:39 Starting JetStream benchmark [subject=bar, msgs=1,000,000, msgsize=16 B, pubs=1, subs=0, js=true, stream=benchstream, storage=memory, syncpub=false, pubbatch=100, jstimeout=30s, pull=false, consumerbatch=100, push=false, c onsumername=natscli-bench, replicas=1, purge=false, pubsleep=0s, subsleep=0s] 10:37:40 Starting publisher, publishing 1,000,000 messages Finished 3m11s [=======================================================================================================================================================================================================] 100% Pub stats: 5,210 msgs/sec ~ 81....

十二月 20, 2021

快速组建 Nats 集群

NATS 是个开源、轻量级、高性能的云原生消息系统,实现了具有高度伸缩性的、优雅的发布-订阅(pub/sub)分布式模型。天生具备的高性能,使其成为构建现代、可靠、易伸缩的云原生分布式系统的理想基础。 模拟 3 节点集群,创建 docker-compose.yml version: "3" services: nats1: image: nats:alpine restart: always command: "-c /etc/node.conf" volumes: - ./etc/node-1.conf:/etc/node.conf ports: - 4222:4222 nats2: image: nats:alpine restart: always command: "-c /etc/node.conf" volumes: - ./etc/node-2.conf:/etc/node.conf ports: - 4223:4222 nats3: image: nats:alpine restart: always command: "-c /etc/node.conf" volumes: - ./etc/node-3.conf:/etc/node.conf ports: - 4224:4222 其中节点配置分别为 # node-1.conf port: 4222 cluster { listen: "0.0.0.0:6222" routes = [ nats://nats2:6222 nats://nats3:6222 ] } # node-2.conf port: 4222 cluster { listen: "0....

六月 15, 2021