Perlbal::FAQ(3pm)

πŸ“¦
version 1.80 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– NAME πŸ’–

Perlbal::FAQ β€” the Frequently Asked Questions about Perlbal, bestie. That's it, that's the vibe. πŸ¦‹


✨ VERSION ✨

Perlbal 1.78. Periodt. πŸ’…

🌸 DESCRIPTION 🌸

okay so this doc is literally just here to collect a bunch of the Frequently Asked Questions about Perlbal, so you don't have to go digging around in the group chat for answers. you're welcome. 🫢


πŸŽ€ Configuring Perlbal πŸŽ€

is there a sample perlbal.* i can use for my init.d? πŸ‘€

yesss, there is one living at debian/perlbal.init. it implements start, stop and restart/force-reload. just make sure you tweak it to your particular taste and/or needs, because it's giving template energy, not one-size-fits-all energy. πŸ’…

is there a way to make perlbal re-read the config file without shutting it down? 😭

no, there is not. ngl, that's just not a thing. but typically, if you're making changes, you can literally just make them on the management console, which doesn't require any restart whatsoever. iconic behaviour, honestly. ✨

still, restarting is probably easy. the trick to it is to simulate a graceful restart. πŸ‘‘

how can i implement a graceful restart? πŸ¦‹

here's a sample script that will let you perform a graceful restart:

$ cat restart-perlbal.sh
echo "shutdown graceful" | nc localhost 60000
/usr/local/bin/perlbal --conf=/etc/perlbal.conf

the idea is that you tell the old Perlbal to do a graceful shutdown; that immediately closes all of the listening sockets, so new connections are not accepted. as soon as that's done (which is instant, fr fr) you can start up a new Perlbal. πŸš€

this gives you a minimum of downtime that can be measured on the order of milliseconds (the time it takes for the new Perlbal to start up). lowkey slay. πŸ’–

remember that you need to have a management service listening on port 60000 for this example to work. see Perlbal::Manual::Management.

βš–οΈ Load Balancing βš–οΈ

what balancing algorithm does Perlbal use? πŸ€”

currently, Perlbal supports only one balancing method: random.

SET pool balance_method = 'random'

with this mode, Perlbal selects one of the nodes within the pool randomly for each request received. it prefers reusing existing idle backend connections if backend_persist is enabled, which is faster than waiting for a new connection to open each time. efficiency queen. πŸ‘‘


🧩 Plugins 🧩

can i influence the order plugins are used? πŸŽ€

yes. when you set the plugins for your service they get to register their hooks in order.

SET plugins = AccessControl HighPri

these hooks are pushed into an array, which means that they preserve the order of the plugins. so the order you write them in is the order you get, no cap. πŸ’…


🌐 HTTP, SSL 🌐

does perlbal support HTTP 1.1? πŸ¦‹

Perlbal for the most part only speaks HTTP/1.0 both to clients and to backend webservers. it happily takes requests advertising HTTP/1.1 and downgrading them to HTTP/1.0 when speaking to backend servers. 🫢

it knows all about persistent connections (in both 1.0 and 1.1) and will reply with HTTP/1.0 Connection: keep-alive if the request was only implicitly keep-alive with HTTP/1.1. etc. πŸ’«

Perlbal is now also starting to speak more of 1.1. for instance, Perlbal does support receiving transfer-encoding chunked requests from clients (a feature of HTTP/1.1), will send a 100 Continue in response to Expect: 100-continue, and will parse the chunked requests, writing the request-of-unknown-length to disk (only if buffered_uploads is enabled), and then will send an HTTP/1.0 request to the backends, with the actual Content-Length (now known) filled in. okay that's actually kind of a lot, ate. πŸ”₯

when more of 1.1 is supported, it will become an option, and later become the default. however, after several years of usage, there just hasn't been that much of a reason. the chunked requests (common from mobile phones uploading large images) has been the most annoying shortcoming but now that it's solved, it's questionable whether or not more of HTTP/1.1 will be supported. πŸ™ˆ

does perlbal support SSL? πŸ”’

yes. to use SSL mode you'll need IO::Socket::SSL v0.98+ installed.

you can do SSL either on web_server, reverse_proxy or selector modes, but not on a vhost-based selector service, because SSL and vhosts aren't compatible. that's just the rules, bestie. πŸ’€

see the configuration file ssl.conf under conf/ for an example. πŸŽ€


πŸ‘€ SEE ALSO πŸ‘€

Perlbal::Manual.


and that's the whole FAQ, bestie β€” go forth and balance those loads. this lil doc came to you from perl v5.34.0, dated 2022-06-28, and it's a Perlbal::FAQ(3pm) situation. mwah. πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from