Hi all,
I'm writing a web UI in perl + mod_perl that sends an SSE stream to the
browser full of JSON formatted updates etc. The browser then renders
that all via Javascript to the user.
I've noticed that if I reload the page multiple times, or just navigate
away, when there's ~6 existing SSE streams, apache will stop accepting
new connections completely.
I've hunted around via the normal search engines, turned up very little
- and out of desperation, asked ChatGPT's Codex...
It suggested the following apache config:
LoadModule mpm_event_module modules/mod_mpm_event.so
# Tune event MPM so we have headroom for long-lived SSE connections
<IfModule mpm_event_module>
ServerLimit 4
StartServers 2
MinSpareThreads 50
MaxSpareThreads 150
ThreadsPerChild 64
MaxRequestWorkers 256
MaxConnectionsPerChild 0
</IfModule>
## Load mod_perl
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlOptions +Parent
PerlSwitches -Mlib=/usr/local/apache2/htdocs-includes
PerlInterpStart 20
PerlInterpMinSpare 10
PerlInterpMaxSpare 20
PerlInterpMax 80
Even with this however, when I hit 6 x concurrent SSE streams being
served, Apache grinds to a halt and doesn't even load the
/server-status/ page for troubleshooting.
Once some of the 'dead' SSE streams fail and those connections
terminated, apache starts behaving again.
Has anyone come across this before and maybe knows a bit of additional
knowledge as to why this is, and what I can do about it?
Thanks.
--
Steven Haigh
📧 [email protected]
💻 https://crc.id.au