]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
start of simple framework for performance tests
authorAlan T. DeKok <aland@freeradius.org>
Fri, 15 May 2020 19:28:04 +0000 (15:28 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 15 May 2020 19:38:40 +0000 (15:38 -0400)
13 files changed:
src/tests/performance/README.md [new file with mode: 0644]
src/tests/performance/ack.conf [new file with mode: 0644]
src/tests/performance/mods-enabled/always [new symlink]
src/tests/performance/mods-enabled/radius_acct [new file with mode: 0644]
src/tests/performance/mods-enabled/radius_auth [new file with mode: 0644]
src/tests/performance/mods-enabled/radius_coa [new file with mode: 0644]
src/tests/performance/packets/packet-acct.txt [new file with mode: 0644]
src/tests/performance/packets/packet-auth_pap.txt [new file with mode: 0644]
src/tests/performance/packets/packet-coa.txt [new file with mode: 0644]
src/tests/performance/proxy.conf [new file with mode: 0644]
src/tests/performance/quiet [new file with mode: 0755]
src/tests/performance/run [new file with mode: 0755]
src/tests/performance/stress [new file with mode: 0755]

diff --git a/src/tests/performance/README.md b/src/tests/performance/README.md
new file mode 100644 (file)
index 0000000..48905d4
--- /dev/null
@@ -0,0 +1,44 @@
+# Performance test framework
+
+These tests should be run manually for now.
+
+In one terminal window, start up the `ack` virtual server.  This
+server just "acks" every request it gets.
+
+```
+./run -n ack
+```
+
+In one terminal window, start up the `proxy` virtual server.  This
+server just proxies every request it gets, to the `ack` server.
+
+```
+./run -n proxy
+```
+
+And then send the `proxy` server packets.
+
+## Less Debug Output
+
+For less debug output, use the `quiet` script.  This will run the
+server in the foreground, and log to `stdout`:
+
+```
+./quiet -n ack
+```
+
+and
+
+```
+./quiet -n proxy
+```
+
+## Stress Testing
+
+Run the stress tests:
+
+```
+./stress
+```
+
+You will need `radperf` in your `$PATH`.
diff --git a/src/tests/performance/ack.conf b/src/tests/performance/ack.conf
new file mode 100644 (file)
index 0000000..b049e9e
--- /dev/null
@@ -0,0 +1,71 @@
+#
+#  We don't need to set anything here.
+#
+modules {
+       $INCLUDE mods-enabled/always
+}
+
+#
+#  Does nothing other than proxying.
+#
+server default {
+       namespace = radius
+
+       listen {
+               type = Access-Request
+               type = Status-Server
+               transport = udp
+               udp {
+                       ipaddr = 127.0.0.1
+                       port = 3000
+               }
+       }
+       listen {
+               type = Accounting-Request
+               transport = udp
+               udp {
+                       ipaddr = 127.0.0.1
+                       port = 3001
+               }
+       }
+       listen {
+               type = CoA-Request
+               type = Disconnect-Request
+               transport = udp
+               udp {
+                       ipaddr = 127.0.0.1
+                       port = 3002
+               }
+       }
+
+       client localhost {
+               shortname = local
+               ipaddr = 127.0.0.1
+               secret = testing123
+       }
+       recv Access-Request {
+               update control {
+                       &Auth-Type := Accept
+               }
+       }
+       send Access-Accept {
+       }
+       send Access-Reject {
+       }
+       recv Accounting-Request {
+               ok
+       }
+       send Accounting-Response {
+       }
+
+       recv CoA-Request {
+               ok
+       }
+       recv Disconnect-Request {
+               ok
+       }
+
+       recv Status-Server {
+               ok
+       }
+}
diff --git a/src/tests/performance/mods-enabled/always b/src/tests/performance/mods-enabled/always
new file mode 120000 (symlink)
index 0000000..6e65c87
--- /dev/null
@@ -0,0 +1 @@
+../../../../raddb/mods-available/always
\ No newline at end of file
diff --git a/src/tests/performance/mods-enabled/radius_acct b/src/tests/performance/mods-enabled/radius_acct
new file mode 100644 (file)
index 0000000..59e9638
--- /dev/null
@@ -0,0 +1,58 @@
+radius radius_acct {
+       transport = udp
+       type = Accounting-Request
+
+       replicate = yes
+
+       status_check {
+               type = Status-Server
+
+       }
+
+       zombie_period = 2
+       revive_interval = 10
+
+       pool {
+               start = 1
+               min = 1
+               max = 8
+               connecting = 1
+               uses = 0
+
+               lifetime = 0
+               open_delay = 0.2
+               close_delay = 1.0
+               manage_interval = 0.2
+
+               connection {
+                       connection_timeout = 1.0
+                       reconnect_delay = 2
+               }
+
+               requests {
+                       per_connection_max = 255
+                       per_connection_target = 255
+                       free_delay = 2
+               }
+       }
+
+       udp {
+               ipaddr = 127.0.0.1
+               port = 3001
+               secret = testing123
+       }
+
+       Accounting-Request {
+               initial_rtx_time = 2
+               max_rtx_time = 16
+               max_rtx_count = 5
+               max_rtx_duration = 30
+       }
+
+       Status-Server {
+               initial_rtx_time = 2
+               max_rtx_time = 5
+               max_rtx_count = 5
+               max_rtx_duration = 30
+       }
+}
diff --git a/src/tests/performance/mods-enabled/radius_auth b/src/tests/performance/mods-enabled/radius_auth
new file mode 100644 (file)
index 0000000..bfa7cff
--- /dev/null
@@ -0,0 +1,54 @@
+radius radius_auth {
+       transport = udp
+       type = Access-Request
+
+       status_check {
+               type = Status-Server
+       }
+
+       zombie_period = 2
+       revive_interval = 10
+
+       pool {
+               start = 1
+               min = 1
+               max = 8
+               connecting = 1
+               uses = 0
+               lifetime = 0
+
+               open_delay = 0.2
+               close_delay = 1.0
+               manage_interval = 0.2
+
+               connection {
+                       connection_timeout = 1.0
+               }
+
+               requests {
+                       per_connection_max = 255
+                       per_connection_target = 255
+                       free_delay = 2
+               }
+       }
+
+       udp {
+               ipaddr = 127.0.0.1
+               port = 3000
+               secret = testing123
+       }
+
+       Access-Request {
+               initial_rtx_time = 2
+               max_rtx_time = 16
+               max_rtx_count = 1
+               max_rtx_duration = 30
+       }
+
+       Status-Server {
+               initial_rtx_time = 2
+               max_rtx_time = 5
+               max_rtx_count = 5
+               max_rtx_duration = 30
+       }
+}
diff --git a/src/tests/performance/mods-enabled/radius_coa b/src/tests/performance/mods-enabled/radius_coa
new file mode 100644 (file)
index 0000000..4fa0f49
--- /dev/null
@@ -0,0 +1,56 @@
+
+radius radius_coa {
+       transport = udp
+
+       type = CoA-Request
+       type = Disconnect-Request
+
+       zombie_period = 2
+       revive_interval = 10
+
+       pool {
+               start = 1
+               min = 1
+               max = 8
+               connecting = 1
+               uses = 0
+
+               lifetime = 0
+               open_delay = 0.2
+               close_delay = 1.0
+               manage_interval = 0.2
+
+               connection {
+                       connection_timeout = 1.0
+                       reconnect_delay = 2
+               }
+
+               requests {
+                       per_connection_max = 255
+                       per_connection_target = 255
+                       free_delay = 2
+               }
+       }
+
+       udp {
+               ipaddr = 127.0.0.1
+               port = 3002
+               secret = testing123
+       }
+
+
+       CoA-Request {
+               initial_rtx_time = 2
+               max_rtx_time = 16
+               max_rtx_count = 5
+               max_rtx_duration = 30
+       }
+
+       Disconnect-Request {
+               initial_rtx_time = 2
+               max_rtx_time = 16
+               max_rtx_count = 5
+               max_rtx_duration = 30
+       }
+
+}
diff --git a/src/tests/performance/packets/packet-acct.txt b/src/tests/performance/packets/packet-acct.txt
new file mode 100644 (file)
index 0000000..e48e54f
--- /dev/null
@@ -0,0 +1,10 @@
+Acct-Status-Type = Start
+User-Name = "testuser"
+Acct-Session-ID = "0123456789"
+Service-Type = Framed-User
+NAS-IP-Address = 127.0.0.1
+NAS-Port-ID = 0
+Message-Authenticator = 0x
+Called-Station-Id = "scald_pega_pilha"
+Calling-Station-Id = "LulaLivre"
+NAS-Port = 123
diff --git a/src/tests/performance/packets/packet-auth_pap.txt b/src/tests/performance/packets/packet-auth_pap.txt
new file mode 100644 (file)
index 0000000..f99fc3a
--- /dev/null
@@ -0,0 +1,6 @@
+User-Name = "testuser"
+User-Password = "supersecret"
+Service-Type = Framed-User
+#Tunnel-Password = "supersecret"
+Called-Station-Id = "scald_pega_pilha"
+Class = 0x69616D616E6F706171756576616C756569616D616E6F706171756576616C7565
diff --git a/src/tests/performance/packets/packet-coa.txt b/src/tests/performance/packets/packet-coa.txt
new file mode 100644 (file)
index 0000000..080f08d
--- /dev/null
@@ -0,0 +1,6 @@
+User-Name = "testuser"
+Acct-Session-ID = "0123456789"
+Service-Type = Framed-User
+NAS-IP-Address = 127.0.0.1
+NAS-Port-ID = 0
+Message-Authenticator = 0x
\ No newline at end of file
diff --git a/src/tests/performance/proxy.conf b/src/tests/performance/proxy.conf
new file mode 100644 (file)
index 0000000..2499c60
--- /dev/null
@@ -0,0 +1,81 @@
+#
+#  We don't need to set anything here.
+#
+modules {
+       $INCLUDE mods-enabled/
+}
+
+#
+#  Does nothing other than proxying.
+#
+server default {
+       namespace = radius
+
+       listen {
+               type = Access-Request
+               type = Status-Server
+               transport = udp
+               udp {
+                       ipaddr = 127.0.0.1
+                       port = 1812
+               }
+       }
+       listen {
+               type = Accounting-Request
+               transport = udp
+               udp {
+                       ipaddr = 127.0.0.1
+                       port = 1813
+               }
+       }
+       listen {
+               type = CoA-Request
+               type = Disconnect-Request
+               transport = udp
+               udp {
+                       ipaddr = 127.0.0.1
+                       port = 3799
+               }
+       }
+
+       client localhost {
+               shortname = local
+               ipaddr = 127.0.0.1
+               secret = testing123
+       }
+
+       recv Access-Request {
+               update control {
+                       &Auth-Type := proxy
+               }
+       }
+       authenticate proxy {
+               radius_auth
+       }
+       send Access-Accept {
+       }
+       send Access-Reject {
+       }
+
+       recv Accounting-Request {
+               if (!&Event-Timestamp) {
+                       update request {
+                               &Event-Timestamp := "%l"
+                       }
+               }
+               radius_acct
+       }
+       send Accounting-Response {
+       }
+
+       recv CoA-Request {
+               radius_coa
+       }
+       recv Disconnect-Request {
+               radius_coa
+       }
+
+       recv Status-Server {
+               ok
+       }
+}
diff --git a/src/tests/performance/quiet b/src/tests/performance/quiet
new file mode 100755 (executable)
index 0000000..ad0596f
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+export FR_GLOBAL_POOL=4M
+
+BUILD_DIR=../../../build
+
+exec ${BUILD_DIR}/make/jlibtool --mode=execute ${BUILD_DIR}/bin/local/radiusd -f -l stdout -d . -D ../../../share/dictionary $@
diff --git a/src/tests/performance/run b/src/tests/performance/run
new file mode 100755 (executable)
index 0000000..5be7a14
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+export FR_GLOBAL_POOL=4M
+
+BUILD_DIR=../../../build
+
+exec ${BUILD_DIR}/make/jlibtool --mode=execute ${BUILD_DIR}/bin/local/radiusd -sf -xx -l stdout -d . -D ../../../share/dictionary $@
diff --git a/src/tests/performance/stress b/src/tests/performance/stress
new file mode 100755 (executable)
index 0000000..b686944
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+# Author: Jorge Pereira <jpereira@freeradius.org>
+# Dummy script to flood the server
+#
+
+fr_server="${1:-127.0.0.1}"
+fr_secret="${2:-testing123}"
+n_packets=${3:-50000}
+forks=${forks:-3}
+
+#RADPERF_DIR=/Users/alandekok/git/radperf
+#radperf="${RADPERF_DIR}/radperf -d ${RADPERF_DIR}/share"
+
+#
+#  Use this if you have "radperf" in your $PATH
+#
+radperf=radperf
+
+function _cleanup() {
+       echo "Cleanup"
+       killall -15 radperf radperf.bin 1> /dev/null 2>&1
+       kill -9 $$
+}
+
+trap _cleanup HUP INT QUIT KILL TERM
+
+echo "Flooding the server ${fr_server} with ${n_packets} of auth/acct/coa."
+
+inter=1
+rnd=1
+while true; do
+       echo "# >> Interaction $inter"
+       echo "[$inter] Start the flood of auth/acct/coa"
+       for t in $(seq 1 $forks); do
+               ${radperf} -q -s -f packets/packet-auth_pap.txt -p50 -c ${n_packets} ${fr_server}:1812 auth ${fr_secret} &
+               ${radperf} -q -s -f packets/packet-acct.txt     -p50 -c ${n_packets} ${fr_server}:1813 acct ${fr_secret} &
+               ${radperf} -q -s -f packets/packet-coa.txt      -p50 -c ${n_packets} ${fr_server}:3799 coa  ${fr_secret} &
+               echo "  > Fork $rnd";
+               let "rnd+=1"
+       done
+
+       echo "[*] Waiting"
+       wait
+
+       let "inter+=1"
+
+       [ -n "$once" ] && break
+done