logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: How to Calculate "max" variable for each balance m
Author
apishdad



Joined: 01 Jul 2019
Posts: 44
Location: Canada, Toronto

PostPosted: Sat 02 Mar '24 12:05    Post subject: How to Calculate "max" variable for each balance m Reply with quote

Hi,
I had a question in regards to whats the proper value to set for the variable "max" in a load balancer.

Lets assume that my load balancer is like this:


RewriteCond %{TIME} (.+)
RewriteRule .* - [E=DT:%1,NE]
Header add Set-Cookie "ROUTEID=%{DT}e.%{BALANCER_WORKER_ROUTE}e; path=/; HttpOnly" env=BALANCER_ROUTE_CHANGED

<Proxy "balancer://${COMPUTERNAME}">
BalancerMember https://URL1:8080 loadfactor=1 max=??? connectiontimeout=300 timeout=600 retry=60 route=Server1
BalancerMember https://URL2:8080 loadfactor=2 max=??? connectiontimeout=300 timeout=600 retry=60 route=Server2
BalancerMember https://URL3:8080 loadfactor=3 max=?? connectiontimeout=300 timeout=600 retry=60 route=Server3
ProxySet stickysession=ROUTEID scolonpathdelim=On lbmethod=byrequests nofailover=On
</Proxy>

and lets say that we are going to use windows NT mpm module with these settings

<IfModule mpm_winnt_module>
ThreadLimit 1200
ThreadsPerChild 1200
MaxConnectionsPerChild 0
</IfModule>

What is the proper value to use for "max". Is it
ThreadsPerChild / # of servers
So in here will be 1200 / 3 = 400
so "max=400"

Thanks
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Wed 06 Mar '24 18:10    Post subject: Reply with quote

ThreadsPerChild determines the maximum number of concurrent client connections, so 1200 on your case.

If you had that many client connections, and you had set "max" to 400, what would happen if one or more of your backend servers went down? Clients would obviously get a proxy error rather than a frontend server busy error.

So for me the issue is what's the maximum number of client requests each of your backend servers can handle, relative to your defined limit of 1200 client connections.

If each one can handle say 600 requests, then I'd set "max" to 600 which would then scale should one of your three backend servers be down for maintenance, patching, etc.

Does this seem reasonable?
Back to top
apishdad



Joined: 01 Jul 2019
Posts: 44
Location: Canada, Toronto

PostPosted: Thu 07 Mar '24 7:47    Post subject: Reply with quote

Yes, understood.
So basically we are saying that assuming that back end server can handle the following:

# of Max Connections (MC for short) = Threads Per Child / # Servers In Load Balancer

Then the value of "max" (load balancer value) at a minimum should equal MC, but it can be set higher if the server can handle it.
Back to top


Reply to topic   Topic: How to Calculate "max" variable for each balance m View previous topic :: View next topic
Post new topic   Forum Index -> Apache