Plack:...lancer(3pm)

πŸ“¦
version 0.29 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– Plack::Middleware::Proxy::LoadBalancer πŸ’–

okay bestie so this is a page from the User Contributed Perl Documentation for Plack::Middleware::Proxy::LoadBalancer β€” a Simple load balancer for your Plack apps. it's giving traffic cop energy but make it cute ✨


πŸ¦‹ NAME πŸ¦‹

Plack::Middleware::Proxy::LoadBalancer β€” literally just a Simple load balancer, no cap πŸŽ€


✨ SYNOPSIS ✨

here's the whole vibe, copy-paste ready:

use Plack::Builder;
use Plack::App::Proxy;

builder {
  enable "Proxy::LoadBalancer", backends => ['http://10.0.0.1:8080', 'http://10.0.0.1:8081'];
  Plack::App::Proxy->new()->to_app;
};

🌸 DESCRIPTION 🌸

Plack::Middleware::Proxy::LoadBalancer lets you define several backends. that's it, that's the whole thing β€” you got multiple servers and this middleware spreads the love around πŸ’…


πŸ’… OPTIONS πŸ’…

  • backends β€” this is THE option, the main character πŸ‘‘ here's how you feed it, three ways, all iconic:

you can pass a single one:

enable "Proxy::LoadBalancer", backends => 'http://10.0.0.1:8080';

or:

enable "Proxy::LoadBalancer", backends => ['http://10.0.0.1:8080', 'http://10.0.0.1:8081'];

or:

enable "Proxy::LoadBalancer", backends => {'http://10.0.0.1:8080' => 0.4, 'http://10.0.0.1:8081' => 0.5, 'http://10.0.0.1:8002' => 0.3};

so fr fr: more than one backend can be defined, and weight can be given to backends (that's the hashref one up there, bestie β€” the numbers are the weights πŸ“). choose your fighter, or choose several, we don't judge πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

Franck Cuny β€” ty for your service, king 🫢


🌈 SEE ALSO 🌈

  • Plack::App::Proxy β€” go read that one too, it's the whole reason this middleware exists πŸ’–

no hidden lore here bestie, every option, example and default is right there above β€” nothing left out, nothing invented πŸ’€

and that's a wrap! this page came from the User Contributed Perl Documentation, perl v5.32.0, dated 2021-01-09, and the header title is Plack:...lancer(3pm) πŸŽ€ slay, bye πŸ’…βœ¨

πŸ“¦ where this page comes from