mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 02:50:43 +00:00
![Martin KaFai Lau](/assets/img/avatar_default.png)
This patch adds a test that has 300 VIPs listening on port 443. Each VIP:443 will have 80 listening socks by using SO_REUSEPORT. Thus, it will have 24000 listening socks. Before removing the port only listening_hash, all socks will be in the same port 443 bucket and inet_reuseport_add_sock() spends much time to walk through the bucket. After removing the port only listening_hash and move all usage to the port+addr lhash2, each bucket in the ideal case has 80 sk which is much smaller than before. Here is the test result from a qemu: Before: listen 24000 socks took 210.210485362 (~210s) After: listen 24000 socks took 0.207173 (~210ms) Signed-off-by: Martin KaFai Lau <kafai@fb.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
25 lines
564 B
Bash
Executable file
25 lines
564 B
Bash
Executable file
#!/bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2022 Meta Platforms, Inc. and affiliates.
|
|
|
|
NS='stress_reuseport_listen_ns'
|
|
NR_FILES=24100
|
|
SAVED_NR_FILES=$(ulimit -n)
|
|
|
|
setup() {
|
|
ip netns add $NS
|
|
ip netns exec $NS sysctl -q -w net.ipv6.ip_nonlocal_bind=1
|
|
ulimit -n $NR_FILES
|
|
}
|
|
|
|
cleanup() {
|
|
ip netns del $NS
|
|
ulimit -n $SAVED_NR_FILES
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
setup
|
|
# 300 different vips listen on port 443
|
|
# Each vip:443 sockaddr has 80 LISTEN sock by using SO_REUSEPORT
|
|
# Total 24000 listening socks
|
|
ip netns exec $NS ./stress_reuseport_listen 300 80
|