Perlba...riority(3pm)

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

🌸 NAME 🌸

Perlbal::Manual::HighPriority β€” bestie, this is all about Perlbal's high/low priority queueing system πŸ’…


πŸŽ€ VERSION πŸŽ€

Perlbal 1.78. yes that's the one we're vibing with ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

So this whole doc is the lore on Perlbal's high/low priority queueing system. buckle up, it's honestly not that deep but it IS iconic 🫢

πŸ’– Queuing system πŸ’–

Perlbal has three queues, ok:

  • the normal queue
  • the high priority queue
  • the low priority queue

As the names are literally giving, normally requests land in the normal queue and get dispatched in FIFO order. high priority requests go to a different queue that jumps ahead of the normal one, and the low priority queue only gets serviced when the high and normal queues are both empty. main character behavior, honestly πŸ‘‘

In a nutshell (iykyk): whenever Perlbal needs to pick which request to handle next, it peeks at the high priority queue first. if that one's empty, it checks the normal queue. and if the normal queue is empty too, then it finally looks at the low priority queue. slay, it's giving triage πŸ’…

πŸ“ High priority with cookies πŸ“

Perlbal can use cookies to decide whether a request deserves the high priority queue (and yeah, it's configurable, obviously ✨).

The two params that make this happen are high_priority_cookie and high_priority_cookie_contents:

  • high_priority_cookie β€” defines the name of the field to check for on the cookie πŸ‘€
  • high_priority_cookie_contents β€” defines the content in that field that will trigger the request going to the fast queue πŸ”₯

Like so:

SET myservice.high_priority_cookie = name_of_the_field
SET myservice.high_priority_cookie_contents = required_content_on_that_field

And here's a clearer example, because we love a concrete demo:

SET myservice.high_priority_cookie = highpriority
SET myservice.high_priority_cookie_contents = yes

🧚 High priority with plugins 🧚

The plugin Perlbal::Plugin::Highpri supports making requests high priority by URI or Host. also go check out make_high_priority under Perlbal::Manual::Hooks πŸ‘‘

🌈 Queue relief 🌈

Okay so sometimes, when the high priority queue is really busy, the standard queue will suffer from resource starvation. not cute. 😭 the queue relief system exists to help prevent that.

Here's the tea: when there are queue_relief_size or more connections in the standard queue, newly available backends have a queue_relief_chance percent chance of taking a request from the standard priority queue instead of the high priority queue. giving the little guys a chance fr fr 🫢

SET web_proxy.queue_relief_size = 2000
SET web_proxy.queue_relief_chance = 30 # 0-100, in percent
Heads up bestie: that chance is in percent, and the range is 0-100 β€” don't go feral with the numbers πŸ’€

⭐ SEE ALSO ⭐

  • make_high_priority and make_low_priority in Perlbal::Manual::Hooks
  • Perlbal::Plugin::HighPriority

and that's the whole page, bestie!! πŸŽ€ this was brought to you by perl v5.34.0, dated 2022-06-28, and it's a Perlba...riority(3pm) situation β€” User Contributed Perl Documentation, no cap. go forth and prioritize responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from