MR::IP...Cluster(3pm)

πŸ’– MR::IProto::Cluster β€” the cluster-of-servers page (3pm, bestie) πŸ’–

okay so real talk, this is MR::IProto::Cluster, and no cap, it's the lil class that handles balancing between a whole squad of servers. let's get into it 🫢


✨ NAME ✨

MR::IProto::Cluster β€” literally just a cluster of servers, that's the whole vibe πŸ’…


🌸 DESCRIPTION 🌸

so this class is used to implement balancing between several servers. that's it, that's the girl. she's the one picking which server gets the honor of your request πŸ‘‘


πŸŽ€ EXPORTED CONSTANTS πŸŽ€

these are the algorithm constants, and yes you can just use them by name:

  • RR β€” Round robin algorithm. everybody gets a turn, take turns, be fair, we love to see it πŸ’–
  • HASH β€” hashing algorithm using CRC32. ngl CRC32 is doing the heavy lifting here πŸ”₯
  • KETAMA β€” the Ketama algorithm. iconic, mysterious, consistent-hashing queen ✨

πŸ¦‹ ATTRIBUTES πŸ¦‹

  • balance β€” the balancing algorithm, bestie. possible values are the constants RR, HASH, KETAMA, or their string analogs: 'round-robin', 'hash-crc32', 'ketama'. pick your fighter 🌈
  • servers β€” an ArrayRef of MR::IProto::Cluster::Server. yes, actual server objects, plural, the whole friend group πŸ’œ

πŸ‘‘ PUBLIC METHODS πŸ‘‘

server( $key? )

get a server from balancing using $key. the optional key matters for the hashing ones, iykyk πŸ”‘

timeout( $new? )

used to set the $new timeout value to all servers. and here's the tea: if the argument is skipped and the timeout is equal for all servers, then it returns its value. if the timeout is different, then it returns undef. πŸ’€

no timeout argument + mismatched timeouts = undef. that's the rules, don't come for her πŸ™ˆ

🌟 SEE ALSO 🌟

  • MR::IProto
  • MR::IProto::Cluster::Server

go read those too, they're part of the lore πŸ“š


and that's the page, bestie!! this was perl v5.30.3, dated 2020-07-21 β€” so yeah, she's been serving since way back, and she still ate πŸ’…βœ¨ mwah, ily, go balance some servers πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from