]> git.ipfire.org Git - thirdparty/public-inbox.git/commit
plack_limiter: PSGI middleware to limit concurrency
authorEric Wong <e@80x24.org>
Thu, 20 Mar 2025 00:05:35 +0000 (00:05 +0000)
committerEric Wong <e@80x24.org>
Fri, 21 Mar 2025 22:01:41 +0000 (22:01 +0000)
commit76a1b52e35a592f76035f31ad5a8b7dde04be725
tree1f01063dd64b2720f9589a126e72b772850b5070
parent299c705fa81e1d171d602e0bf359c4f277e17eaa
plack_limiter: PSGI middleware to limit concurrency

While processing several concurrent requests within the same
worker process is helpful to exploit parallelism in git blob
lookups and smooth out delays; excessive parallelism is harmful
since it allows too much memory to be allocated at once for zlib
buffers and such.

While PublicInbox::WWW already uses the limiter for certain
expensive endpoints (e.g. /s/ and anything using Qspawn); some
long-running endpoints with many inexpensive steps (e.g. /T/,
/t/, /d/, *.atom, *.mbox.gz, etc.) can end up using a large
amount of memory for gzip buffers despite being fair to other
responses and being able to stream >500 messages/sec on 2010-era
hardware.

So give sysadmins an option to balance between smoothing out
delays in blob retrieval and memory usage required to compress
and spew out chunks of potentially large multi-email responses.
MANIFEST
lib/PublicInbox/PlackLimiter.pm [new file with mode: 0644]