使用 Smack 客户端的 XMPP 负载测试 API

XMPP Load Test Using Smack Client API

我想通过执行 XMPP 负载测试来测量 XMPP 服务器的容量。所以我实现了一个负载测试器并使用 Smack Client API 进行连接处理。

但我发现它非常昂贵,因为每个连接创建了三个线程(SmackExecutor、Reader 和 Writter)。

因此我无法在强大的机器上打开超过 10K 的连接,尽管增加了机器 OS 限制,例如文件限制器,..

您是否建议一种工具或一种实现方式来在一台机器上处理超过 20K 的连接。

]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 513395
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 524288
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 262144
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

[![在此处输入图片描述][2]][2]

依赖关系:

<dependency>
    <groupId>org.igniterealtime.smack</groupId>
    <artifactId>smack</artifactId>
    <version>4.0.4</version>
</dependency>
<dependency>
    <groupId>org.igniterealtime.smack</groupId>
    <artifactId>smackx</artifactId>
    <version>4.0.4</version>
</dependency>
<dependency>
    <groupId>org.igniterealtime.smack</groupId>
    <artifactId>smack-debug</artifactId>
    <version>4.0.4</version>
</dependency>
<dependency>
    <groupId>org.igniterealtime.smack</groupId>
    <artifactId>smack-tcp</artifactId>
    <version>4.0.4</version>
</dependency>

网站上对我的问题有几种看法https://discourse.igniterealtime.org/t/maximum-concurrent-users-possible-with-smack/72868/5

    Smack was not designed to create 10.000s of connections within 
the same JVM (of course having multiple XMPPConnection within the same JVM is fine). 
I would recommend using a more lightweight XMPP library written in C or in Lua for stress testing.


    You could also use multiple JVM processes, but still, the overhead caused by the threads 
Smack uses per connection make it not the ideal library for stress testing.