I get really confused about incoming and outgoing connections. For instance, "worker threads accessing this host" confuses me because I think of the worker threads as being "downstream" on the Tomcats and of us accessing THEM. I want to make sure I'm not missing something here.
If our service is receiving requests from w machines, sending them all through x Apache servers (in our case x=1) and Apache is load-balancing those requests over y Tomcats, each of which has a cachesize of 10, but we're only wanting to fill up z=8 out of that 10, which of w,x,y and z should factor into maxConnectionsPerHost and maxTotalConnections? I'm being told here that w doesn't matter because the incoming requests will just queue up, x doesn't really matter since it's always 1 for us, and so just to set both parameters to y*z, or x*y*z in case we ever add more Apaches to the setup. In terms of those variables, do you agree, or do w and x come into it at all? --- J. Jeff Roberts [EMAIL PROTECTED] (859) 552-5806 On Thu, 26 Jan 2006 12:03 , Oleg Kalnichevski <[EMAIL PROTECTED]> sent: >On Wed, 2006-01-25 at 13:54 -0500, Jeff Roberts wrote: >> OK, I think I understand what we're TRYING to do better now, let me take a >> shot at explaining. >> >> The defaults for maxConnectionsPerHost and maxTotalConnections are 2 and 20, >> so I think that's where we got the *10 multiplier. We believe the >> multiplier is supposed to account for the number of http servers we're >> forwarding requests to, which in our case is only one Apache server, so we >> think we could do without the *10 - please advise if any of that's wrong. >> >> The one Apache server is load balancing via mod_jk to 1 or more Tomcat >> servers. The cachesize parameter in the workers.properties is set to 10, >> but we're trying to leave 2 slots there for other requests besides the ones >> this particular server handles, which leaves us 8 slots per server. >> >> So we're setting maxConnectionsPerHost to 8, and currently we're setting >> maxTotalConnections to 8*10, although we think the *10 may be unnecessary. >> Now we're trying to account for there being more Tomcats, so we're planning >> to set maxConnectionsPerHost to 8*num_tomcats and maxTotalConnections to >> 8*num_tomcats as well. >> >> Does that make any sense? > >Jeff, >There is no universal scheme to calculate optimal MTHCM settings. You >should experiment and see which ones work best for you. > >Generally you should set maxConnectionsPerHost at least to n, where n is >a number of worker threads accessing the this host simultaneously. Then >you should set maxTotalConnections to n * m, where m is the number of >hosts you application connects to. Say, you have 5 worker threads per >host and 4 target hosts, then the total number of connections should be >at least 20 to avoid resource contention. If you set the total limit to >something like 15, then the worker threads will start contending for >connections when running at the full capacity. > >Hope this helps > >Oleg > >> --- >> J. Jeff Roberts >> [EMAIL PROTECTED] >> (859) 552-5806 >> >> >> ----- Original Message ----- >> From: 'Jeff Roberts' [EMAIL PROTECTED]> >> To: [email protected] >> Sent: Wed, 25 Jan 2006 09:18:30 >> Subject: Fwd: 2.0.2 - maxConnectionsPerHost and maxTotalConnections >> >> >> >> I've picked up some code that everyone suddenly disavows all knowledge >> of...you know how that goes. :-) >> >> We are creating a MultiThreadedHttpConnectionManager, >> setting maxConnectionsPerHost to 8 and maxTotalConnections to 8 * 10. That >> object is passed to the constructor for HttpClient. We then receive >> requests, which we route to an Apache server, which is load balancing to 1 >> or more Tomcats via mod_jk. >> >> I am told that someone fiddled around and found the 8/80 setting works well >> if we're "balancing" over only 1 Tomcat, but that they think we should >> multiply one or both of the properties by the number of Tomcats as we add >> servers. No one seems to know where the "* 10" in the call to >> maxTotalConnections came from, or whether we still need it if we multiply >> the 8 by the number of Tomcats. >> >> 1. If any of that made sense, does anyone have a clue if we're setting these >> parameters correctly, and if either the 8 or the "* 10" makes any sense? >> >> 2. Does it sound right to multiply one or both by the number of Tomcats? >> >> 3. Can I call setMaxConnectionsPerHost() and setMaxTotalConnections() at any >> time? While requests are cranking through, in other words? Can I call them >> both with a larger and a smaller number than the current setting without >> problems, as Tomcats are added or removed? >> >> Any info much appreciated. >> >> --- >> J. Jeff Roberts >> [EMAIL PROTECTED] >> (859) 552-5806 >> >> >> >> >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
