Corona(3pm)

πŸ“¦
version 0.1004 Β· 2 versions
  • 0.1004 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.1004 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Corona(3pm) ✨

okay bestie, welcome to the Corona(3pm) page β€” this is the manual for Corona, and no it's not the beer and no it's not the virus, it's a Coro based PSGI web server πŸ¦‹ and she's gorgeous. sit down, get comfy, we're gonna read this together.


🌸 SYNOPSIS 🌸

corona --listen :9090 app.psgi

that's literally it. that's the whole vibe. πŸ’…


πŸ’– DESCRIPTION πŸ’–

okay so. Corona is a Coro based Plack web server. she runs on Net::Server::Coro under the hood, which β€” and this is the fun part β€” means we've got coroutines (think threads) for each socket, for active connections, and a main loop. it's giving very organized. very multitasking. very main character. πŸ‘‘

and here's why you should be obsessed: because she's Coro based, your web application can actually block with I/O wait β€” for real, no cap β€” as long as it yields when being blocked. that yield goes to the other coroutine, either:

  • explicitly, with cede, or
  • automatically, through the Coro::* magic ✨

look at this:

# your web application
use Coro::LWP;
my $content = LWP::Simple::get($url); # this yields to other threads when IO blocks

see how the LWP::Simple::get($url) call just yields to other threads when IO blocks?? that's the magic. she's handling other people's whole lives while you're waiting on a URL. multitasking icon. 🧚

Corona also uses Coro::AIO (and IO::AIO) if available, to send the static filehandle using sendfile(2). iffy on whether it's there? then it's not doing that. but when it is? slay.

and the numbers?? the simple benchmark shows this server gives 2000 requests per second in the simple Hello World app, and 300 requests to serve 2MB photo files when used with AIO modules. brilliantly fast. no notes. πŸ”₯

one tiny thing bestie: this web server sets the psgi.multithread env var on. just so you know. πŸ’œ

πŸŽ€ AUTHOR πŸŽ€

Tatsuhiko Miyagawa β€” king behavior honestly πŸ‘‘


🌈 LICENSE 🌈

this module is licensed under the same terms as Perl itself. simple as that. 🫢


⭐ SEE ALSO ⭐

  • Coro
  • Net::Server::Coro
  • Coro::AIO

and that's the page!! πŸ’– this one came from the Perl documentation, version perl v5.36.0, dated 2022-12-04 β€” so if you're reading this in the future, hi, ily, go check the current docs too πŸ˜­πŸ¦‹ bye bestie!!

πŸ“¦ where this page comes from