10 qps的并发连接emq,1000左右 emq就崩了,如何优化
正常安装 5.2.1 版本,在虚拟机上安装的,也按照文档进行优化,不知道为什么,10qps,接入1000多 就挂了
fs.file-max = 761816
fs.nr_open = 1048576
net.core.somaxconn = 1024
net.ipv4.tcp_max_syn_backlog = 1024
net.core.netdev_max_backlog = 1000
net.core.rmem_max = 212992
net.core.wmem_max = 212992
net.ipv4.tcp_rmem = 4096 87380 6291456
net.ipv4.tcp_wmem = 4096 16384 4194304
net.ipv4.tcp_max_tw_buckets = 5000
这些配置怎么设置?我按照之前调优文档已经在emq的服务器操作了一遍了,但是还是不行,10并发,1000多连接就打挂了。
你好,崩溃了的话可以看下 /var/log/emqx
目录下是否有 crash.dump
文件,压缩包解压安装的话则是在你解压路径的 log 目录下。
有的话可以把 crash.dump
文件的前三百行和最新的 emqx.log.*
日志文件发上来看一下。
=erl_crash_dump:0.5
Tue Dec 12 03:28:26 2023
Slogan: Kernel pid terminated (application_controller) ({application_terminated,emqx,shutdown})
System version: Erlang/OTP 25 [erts-13.2.2] [emqx] [64-bit] [smp:6:6] [ds:6:6:8] [async-threads:4]
Taints: crypto,asn1rt_nif,dyntrace,rocksdb,jiffy,quicer_nif,bcrypt_nif,jq_nif
Atoms: 59884
Calling Thread: scheduler:4
=scheduler:1
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work:
Current Port:
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK
Current Process:
=scheduler:2
Scheduler Sleep Info Flags: SLEEPING | POLL_SLEEPING | WAITING
Scheduler Sleep Info Aux Work:
Current Port:
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK
Current Process:
=scheduler:3
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work:
Current Port:
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK
Current Process:
=scheduler:4
Scheduler Sleep Info Flags:
Scheduler Sleep Info Aux Work: THR_PRGR_LATER_OP
Current Port:
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK | NONEMPTY | EXEC
Current Process: <0.0.0>
Current Process State: Running
Current Process Internal State: ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | RUNNING
Current Process Program counter: 0x00007f10723bcdd8 (init:sleep/1 + 64)
Current Process Limited Stack Trace:
8核 16g
暂时没看出来什么有用的信息,你的 crash.dump 文件大吗?看下能不能压缩下上传上来,不行的话可以放在网盘中,然后把网盘链接发到我的邮箱:zhouzb@emqx.io
已经发到你邮箱里了
2023-12-12T03:28:24.845738-05:00 [error] Supervisor: {local,mnesia_kernel_sup}. Context: child_terminated. Reason: killed. Offender: id=mnesia_locker,pid=<0.2187.0>.
2023-12-12T03:28:24.845920-05:00 [error] Supervisor: {local,mnesia_kernel_sup}. Context: shutdown. Reason: reached_max_restart_intensity. Offender: id=mnesia_locker,pid=<0.2187.0>.
2023-12-12T03:28:24.846127-05:00 [error] Mnesia(‘emqx@127.0.0.1’): ** ERROR ** (could not write core file: emfile), ** FATAL ** Cannot open log file “/home/emqx/data/mnesia/emqx@127.0.0.1/PREVIOUS.LOG”: {file_error,“/home/emqx/data/mnesia/emqx@127.0.0.1/PREVIOUS.LOG”,emfile}
2023-12-12T03:28:24.848031-05:00 [error] Supervisor: {local,mnesia_sup}. Context: child_terminated. Reason: shutdown. Offender: id=mnesia_kernel_sup,pid=<0.2184.0>.
2023-12-12T03:28:24.848160-05:00 [error] Supervisor: {local,mnesia_sup}. Context: shutdown. Reason: reached_max_restart_intensity. Offender: id=mnesia_kernel_sup,pid=<0.2184.0>.
2023-12-12T03:28:24.848414-05:00 [error] Generic server emqx_router_helper terminating. Reason: {{aborted,{node_not_running,‘emqx@127.0.0.1’}},[{mnesia,abort,1,[{file,“mnesia.erl”},{line,362}]},{mnesia_tm,prepare_items,5,[{file,“mnesia_tm.erl”},{line,1267}]},{mnesia_tm,dirty,2,[{file,“mnesia_tm.erl”},{line,1109}]},{emqx_router_helper,handle_info,2,[{file,“emqx_router_helper.erl”},{line,158}]},{gen_server,try_dispatch,4,[{file,“gen_server.erl”},{line,1123}]},{gen_server,handle_msg,6,[{file,“gen_server.erl”},{line,1200}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,250}]}]}. Last message: {membership,{mnesia,down,‘emqx@127.0.0.1’}}. State: #{nodes => }.
2023-12-12T03:28:24.848659-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.2766.0>, registered_name: emqx_router_helper, exit: {{aborted,{node_not_running,‘emqx@127.0.0.1’}},[{mnesia,abort,1,[{file,“mnesia.erl”},{line,362}]},{mnesia_tm,prepare_items,5,[{file,“mnesia_tm.erl”},{line,1267}]},{mnesia_tm,dirty,2,[{file,“mnesia_tm.erl”},{line,1109}]},{emqx_router_helper,handle_info,2,[{file,“emqx_router_helper.erl”},{line,158}]},{gen_server,try_dispatch,4,[{file,“gen_server.erl”},{line,1123}]},{gen_server,handle_msg,6,[{file,“gen_server.erl”},{line,1200}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,250}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 6772, stack_size: 28, reductions: 8006; neighbours:
2023-12-12T03:28:24.848953-05:00 [error] Supervisor: {local,emqx_router_sup}. Context: child_terminated. Reason: {aborted,{node_not_running,‘emqx@127.0.0.1’}}. Offender: id=helper,pid=<0.2766.0>.
2023-12-12T03:28:24.849641-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.9126.0>, registered_name: , error: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 224; neighbours:
2023-12-12T03:28:24.849608-05:00 [error] Supervisor: {local,emqx_router_sup}. Context: start_error. Reason: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}. Offender: id=helper,pid=<0.2766.0>.
2023-12-12T03:28:24.850215-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.9128.0>, registered_name: , error: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 224; neighbours:
2023-12-12T03:28:24.850165-05:00 [error] Supervisor: {local,emqx_router_sup}. Context: start_error. Reason: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}. Offender: id=helper,pid={restarting,<0.2766.0>}.
2023-12-12T03:28:24.850695-05:00 [error] Supervisor: {local,emqx_router_sup}. Context: start_error. Reason: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}. Offender: id=helper,pid={restarting,<0.2766.0>}.
2023-12-12T03:28:24.851031-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.9130.0>, registered_name: , error: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 224; neighbours:
2023-12-12T03:28:24.852008-05:00 [error] Supervisor: {local,emqx_router_sup}. Context: start_error. Reason: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}. Offender: id=helper,pid={restarting,<0.2766.0>}.
2023-12-12T03:28:24.852358-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.9132.0>, registered_name: , error: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 224; neighbours:
2023-12-12T03:28:24.853210-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.9134.0>, registered_name: , error: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 224; neighbours:
2023-12-12T03:28:24.853208-05:00 [error] Supervisor: {local,emqx_router_sup}. Context: start_error. Reason: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}. Offender: id=helper,pid={restarting,<0.2766.0>}.
2023-12-12T03:28:24.853727-05:00 [error] Supervisor: {local,emqx_router_sup}. Context: start_error. Reason: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}. Offender: id=helper,pid={restarting,<0.2766.0>}.
2023-12-12T03:28:24.854031-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.9136.0>, registered_name: , error: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 224; neighbours:
2023-12-12T03:28:24.854622-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.9138.0>, registered_name: , error: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 224; neighbours:
2023-12-12T03:28:24.854603-05:00 [error] Supervisor: {local,emqx_router_sup}. Context: start_error. Reason: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}. Offender: id=helper,pid={restarting,<0.2766.0>}.
2023-12-12T03:28:24.855081-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.9140.0>, registered_name: , error: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 224; neighbours:
2023-12-12T03:28:24.855056-05:00 [error] Supervisor: {local,emqx_router_sup}. Context: start_error. Reason: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}. Offender: id=helper,pid={restarting,<0.2766.0>}.
2023-12-12T03:28:24.855537-05:00 [error] crasher: initial call: emqx_router_helper:init/1, pid: <0.9142.0>, registered_name: , error: {{badmatch,{error,{node_not_running,‘emqx@127.0.0.1’}}},[{emqx_router_helper,init,1,[{file,“emqx_router_helper.erl”},{line,106}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,851}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [emqx_router_sup,emqx_sup,<0.2720.0>], message_queue_len: 0, messages: , links: [<0.2765.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 224; neighbours: