EMQX 版本
EMQX 5.6.0
EMQX 安装部署方式
通过 EMQX Operator 部署
EMQX 集群情况
3个core节点,10个replicant节点,10个节点配置为10C32G
部署配置:
apiVersion: apps.emqx.io/v2beta1
kind: EMQX
metadata:
name: emqx-tc
namespace: emqx
spec:
image: emqx/emqx:5.6.0
config:
data: |
cluster {
autoheal = on
autoclean = 5m
}
listeners.tcp.default.acceptors = 256
listeners.tcp.default.max_connections = 1024000
listeners.tcp.default.max_conn_rate = "10000/s"
listeners.tcp.default.messages_rate = "10000/s"
listeners.tcp.default.bytes_rate = "20MB/s"
listeners.tcp.default.tcp_options.backlog = 102400
listeners.tcp.default.tcp_options.keepalive = "240,30,5"
listeners.ssl.default.acceptors = 64
listeners.ssl.default.max_connections = 1024000
listeners.ssl.default.max_conn_rate = "10000/s"
listeners.ssl.default.messages_rate = "10000/s"
listeners.ssl.default.bytes_rate = "20MB/s"
listeners.ssl.default.tcp_options.backlog = 102400
listeners.ssl.default.tcp_options.keepalive = "240,30,5"
listeners.ws.default.acceptors = 64
listeners.ws.default.max_connections = 1024000
listeners.ws.default.max_conn_rate = "10000/s"
listeners.ws.default.messages_rate = "10000/s"
listeners.ws.default.bytes_rate = "20MB/s"
listeners.ws.default.tcp_options.backlog = 102400
listeners.ws.default.tcp_options.keepalive = "240,30,5"
mqtt.max_packet_size = "1MB"
node.cookie = "xxxxxxxxxx"
node.max_ports = 1024000
node.dist_buffer_size = 16384
slow_subs.enable = false
slow_subs.threshold = "200ms"
slow_subs.expire_interval = "300s"
log.console.level = info
log.file.level = info
listenersServiceTemplate:
spec:
type: ClusterIP
dashboardServiceTemplate:
spec:
type: ClusterIP
coreTemplate:
metadata:
name: emqx-tc-core
namespace: emqx-core
spec:
replicas: 3
env:
- name: ERL_MAX_PROCESSES
value: "2097152"
- name: ERL_MAX_PORTS
value: "1048576"
resources:
requests:
cpu: 8000m
memory: 16Gi
replicantTemplate:
metadata:
name: emqx-tc-rep
namespace: emqx-rep
spec:
replicas: 10
env:
- name: ERL_MAX_PROCESSES
value: "2097152"
- name: ERL_MAX_PORTS
value: "1048576"
resources:
requests:
cpu: 10000m
memory: 32Gi
在 EMQX 中启用的功能
启用了prometheus的pushgateway,增加了插件,在publish事件时在消息的user property中插入一个时间戳;
启用了SSL证书校验端口。
测试场景
使用20台压力机,建立了100w个连接,每秒10w qps向emqx pub数据,外部服务sub数据后,再pub数据到emqx,在emqx消息的流入和流出总的是20w/s
具体问题
当消息达到20w/s后,消息会被挤压,服务统计的很多消息在emqx延迟达到了2s多