Hi Corin, On Wed, Apr 28, 2010 at 08:50:46AM +0200, Corin Langosch wrote: > Hi! > > I wonder how maxconn and weight (both in a server statement) exactly > interact. The docs in section 5 says about maxconn:
They don't interact. Weight is only used as a number of occurrences in a load balancing cycle, which contains as many places as the sum of all servers weights. So a server normally receives its share of the load corresponding to its weight / total weight. > >If the number of incoming concurrent requests goes higher than this value, > >they will be queued, waiting for a connection to be released. > > But know I wonder where the requests get queued: > 1. in the queue of this specific server - the request has to wait This happens when the request has a cookie indicating that only this server may be selected. Then yes, the request waits for this exact server to release a connection. > 2. in the global queue - other free servers can serve this request > immediately This happens with all "anonymous" requests, those which are not tied to a specific server. > My test config contains 2 servers: one with one cpu the other with 4 > cpus. Rigth now I simply set maxconn to the cpu count of each server. > The weight is the same for both. This is wrong. The maxconn is normally bound by your amount of RAM, because it limits the concurrency. Concurrency means sessions, threads, processes, contexts, file descriptors or whatever your application server runs on. A server with more CPUs will not be able to support a larger number of concurrent connections. However, it will process them faster, making it possible to accept more users in a same time frame. The weight is exactly what should be tuned to match your CPU differences, because it ensures that the servers with less CPU power will receive less work. Let's consider the classical example of Apache servers with MaxClients=256. Then set your maxconn values to 250 (leave some margin for health checks and your own test connections). This is independant on the CPUs. You should however ensure that your apache supports 256 connections with the installed RAM. Then adjust the weights to reflect the CPU power, and you're done. > I guess if queueing works according to 1. this config is bad and I'll > have to adjust the weights too. > I guess if queueing works according to 2. this config is perfectly > fine - right? it is both and the config is wrong :-) Regards, Willy

