Twiggy(3pm)
β¨ NAME β¨
Twiggy β an AnyEvent HTTP server for PSGI. Like, it's the whole thing, bestie. That's the vibe. π
π SYNOPSIS π
okay so from the command line you literally just go:
twiggy --listen :8080
and if you want the whole tea, spill it with:
twiggy -h
and if you're doing the Perl thing (iconic of you), it goes like this:
use Twiggy::Server;
my $server = Twiggy::Server->new(
host => $host,
port => $port,
);
$server->register_service($app);
AE::cv->recv;
that last line is doing a LOT of heavy lifting btw, don't forget it π
πΈ DESCRIPTION πΈ
Twiggy is a lightweight and fast HTTP server, and it has some unique features that are honestly giving main character energy:
π« PSGI
It can run any PSGI applications. Fully supports psgi.nonblocking and psgi.streaming interfaces. no cap. π«Ά
π¦ AnyEvent
This server uses AnyEvent and runs in a non-blocking event loop, so it's bestie-coded for event-driven web applications that run I/O bound jobs or delayed responses β think long-poll, WebSocket, or streaming content (server push). β¨
π°οΈ Fun little history moment: this software used to be called Plack::Server::AnyEvent but was renamed to Twiggy. glow-up fr fr.
β‘ Fast header parser
Uses an XS/C based HTTP header parser for the best performance. (It's optional β install the HTTP::Parser::XS module to enable it; see also Plack::HTTPParser for more information). periodt. π₯
π Lightweight and Fast
The memory required to run twiggy is 6MB and it can serve more than 4500 req/s with a single process on Perl 5.10 with MacBook Pro 13" late 2009. yes, that's a real sentence, and yes, it ate. π
π Superdaemon aware
Supports Server::Starter for hot deploy and graceful restarts. so iconic.
To use it, instead of the usual:
plackup --server Twiggy --port 8111 app.psgi
install Server::Starter and use:
start_server --port 8111 -- plackup --server Twiggy app.psgi
π ENVIRONMENT π
The following environment variables are supported. (yes, just the one, and she's doing her best π)
TWIGGY_DEBUGβ set to true to enable debug messages from Twiggy. πβ¨
π LICENSE π
This module is licensed under the same terms as Perl itself. π (iykyk)
π§ AUTHOR π§
- Tatsuhiko Miyagawa
- Tokuhiro Matsuno
- Yuval Kogman
- Hideki Yamamura
- Daisuke Maki
legends, all of them. π
β SEE ALSO β
PlackAnyEventTatsumaki
okay that's the whole page bestie, go forth and serve some requests π
this was brought to you by perl v5.32.0, dated 2021-01-24, and the Twiggy(3pm) era β mwah, bye!! ππ¦
π¦ where this page comes from
- debian bookworm: twiggy 0.1026+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: twiggy 0.1026+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: twiggy 0.1026+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: twiggy 0.1026+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: twiggy 0.1026+dfsg-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms