PAGI::Server Performance and Hardening
Source: Dev.to
Performance Test
PAGI::Server is the reference implementation of the PAGI spec. Below is a high‑concurrency test of a basic “Hello world” app:
https://github.com/jjn1056/pagi/blob/main/examples/01-hello-http/app.pl
The test was run on a MacBook Pro (2.4 GHz 8‑Core Intel Core i9) using the following command:
LIBEV_FLAGS=8 ./bin/pagi-server --workers 16 --quiet --no-access-log --loop EV ./examples/01-hello-http/app.pl
Results
% hey -z 30s -c 500 http://localhost:5000/
Summary:
Total: 30.0217 secs
Slowest: 0.1110 secs
Fastest: 0.0097 secs
Average: 0.0312 secs
Requests/sec: 16010.2544
Response time histogram:
0.010 [1] |
0.020 [376] |
0.030 [222649] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.040 [226482] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.050 [26058] |■■■■■
0.060 [4279] |■
0.070 [492] |
0.081 [123] |
0.091 [173] |
0.101 [20] |
0.111 [2] |
Latency distribution:
10% in 0.0249 secs
25% in 0.0273 secs
50% in 0.0304 secs
75% in 0.0340 secs
90% in 0.0381 secs
95% in 0.0414 secs
99% in 0.0505 secs
Details (average, fastest, slowest):
DNS+dialup: 0.0000 secs, 0.0097 secs, 0.1110 secs
DNS-lookup: 0.0000 secs, 0.0000 secs, 0.0193 secs
req write: 0.0000 secs, 0.0000 secs, 0.0091 secs
resp wait: 0.0311 secs, 0.0096 secs, 0.1110 secs
resp read: 0.0000 secs, 0.0000 secs, 0.0035 secs
Status code distribution:
[200] 480655 responses
PAGI::Server handled all requests, delivering about 30 % higher throughput than a comparable PSGI “Hello world” running under Starman. Starman, in contrast, dropped roughly 80 % of the requests at the same load on the same hardware, illustrating why Starman is typically placed behind an edge server such as Nginx.
Compliance and Security Testing
Ongoing HTTP/WebSocket compliance and security testing for PAGI::Server can be followed in the working draft:
https://github.com/jjn1056/pagi/blob/main/lib/PAGI/Server/Compliance.pod
Volunteers with experience in stress‑testing servers are welcome to contribute. In production environments you’ll still likely run PAGI::Server behind a proxy or edge server (e.g., Nginx), but the more robust it is on its own, the better.