0

我是负载测试的新手,但我在亚马逊上搜索了很多并配置了测试系统。系统组成:Websocket服务器,on Play框架,以及一些负载测试机。我试过这样的负载测试工具:TsungGatling. 我的测试场景:我创建了超过 10k 个用户,每个用户都连接到服务器并开始每秒发送消息。我调整了 linux 以处理超过 100k 的连接。我使用 JAVA_OPTS 来进行 gatling(增加了更多内存和 ParallelGC 使用)。我在服务器端使用 akka 来处理 100-300 个调度程序线程。我为服务器机器订购了 36 个具有 60 GB RAM 和 10GBit 通道的 vCPU 机器。但结果是相同的 Tsung 和 Gatling 从一台机器每秒发送近 10k 条消息(我只发送了 < 160Bytes 的文本消息)。谁能给我解释一下。为什么我的并发用户数不能超过 1 万(每秒 1 条消息)。我做错了什么?

actor {
            default-dispatcher = {
                fork-join-executor {
                    throughput = 1000
                    parallelism-factor = 36.0
                    parallelism-max = 154
                }
            }
        }

JAVA_OPTS="-Xmx3800m -Xms3800m -Xmn2g -XX:+UseParallelGC -XX:ParallelGCThreads=20"

Linux 配置

sudo ulimits -n > 999999 sudo vim /etc/sysctl.conf

# General gigabit tuning
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
#
# # This gives the kernel more memory for TCP
# # which you need with many (100k+) open socket connections
net.ipv4.tcp_mem = 4096 65536 16777216 
#
# # Backlog
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_syncookies = 1
# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 0 

# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0



# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65535

# Controls the maximum size of a message, in bytes
kernel.msgmax = 65535

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_synack_retries = 5
net.ipv4.tcp_orphan_retries = 5
fs.file-max = 999999 
net.ipv4.tcp_max_orphans = 819200
net.core.somaxconn = 65535
net.ipv4.tcp_congestion_control = cubic

我用 5 台客户端机器进行了测试,我发现 play 框架上的服务器端每秒可以处理来自 50k 用户的 50k 条消息。有了这样的配置。问题是一台客户端机器不能从 10k 用户发送超过 10k mps。也许有人知道其他负载测试工具可以从 10k 用户发送超过 10k mps。

4

0 回答 0