max_reuse_connections Conundrum: ColdFusion 11 Tomcat IIS Connector

Posted: December 9, 2014 in Uncategorized

This is my first attempt at IIS connector tuning for ColdFusion 11 (and 10). Most of my career has been spent developing ColdFusion code and is now focusing more on server related activities. Plus CF 10 and 11 were slow to be implemented by our customers.

It seems that most information out there for connector tuning is based around one sole blog post: http://blogs.coldfusion.com/post.cfm/coldfusion-11-iis-connector-tuning (and CF 10’s version).

My post focuses on a three instance approach, using ColdFusion 11 Enterprise, with individual site connectors (as opposed to “all IIS sites”).

The basic concept as I understand it is to set the connection_pool_size to 500 and monitor the site. Add up this number in each site, using the same instance, and use that value for maxThreads for the AJP connector setting. Then gradually increase that value by 100 under load testing conditions until stable. Then give that number some wiggle room for future growth. After that number is set, then set the max_reuse_connections and connection_pool_timeout.

So lets say, as an example, that I use the “All IIS Sites” option for my connector instead of individual connectors. If I use the recommended connection_pool_size of 500 for each site, I’d use 3000. Then based upon the equation of connection_pool_size / # of sites, I’d set “max_reuse_connections = 500”. Example:

worker.list=instance1
worker.instance1.type=ajp13
worker.instance1.host=localhost
worker.instance1.max_reuse_connections=500
worker.instance1.connection_pool_size=3000
worker.instance1.connection_pool_timeout=60

<Connector port="8013" protocol="AJP/1.3" redirectPort="8446" tomcatAuthentication="false" maxThreads="3000" connectionTimeout ="60000"/>

Now, when I looked up the workers.properties specs for Tomcat I found that max_reuse_connections is not a standard property. I’m assuming this is one of the customizations made by Adobe. Based upon how the value of this property is a division of the number of sites, that this property is per site. Therefore in conclusion, I have up to 500 connections to reuse for each site in my total pool of 3000.

Now, lets say we’re using individual connectors. Each of the six workers.properties would look like this based upon Adobe’s blog:

worker.list=instance1
worker.instance1.type=ajp13
worker.instance1.host=localhost
worker.instance1.max_reuse_connections=83
worker.instance1.connection_pool_size=500
worker.instance1.connection_pool_timeout=60

<Connector port="8013" protocol="AJP/1.3" redirectPort="8446" tomcatAuthentication="false" maxThreads="3000" connectionTimeout ="60000"/>

So, as per Adobe’s blog, connection_pool_size / # of sites rounds down to 83, instead of 500. 6 sites X 500 connection_pool_size = 3000, which is reflected in the instance’s server.xml file.

In the end, the instance still allows for 3,000 connections; 500 coming from each site.

Question: Why am I using the same calculation for max_reuse_connections when combining all sites or connecting them individually? Shouldn’t I be able to use up to the value of each connection_pool_size for each connector? If max_reuse_connections is for each site, shouldn’t that number be the same no matter individual or “All IIS” connector types?

For example:

worker.list=instance1
worker.instance1.type=ajp13
worker.instance1.host=localhost
worker.instance1.max_reuse_connections=500
worker.instance1.connection_pool_size=500
worker.instance1.connection_pool_timeout=60

<Connector port="8013" protocol="AJP/1.3" redirectPort="8446" tomcatAuthentication="false" maxThreads="3000" connectionTimeout ="60000"/>
Advertisements
Comments
  1. Anit says:

    Chris,

    As mentioned on the blog, when Tomcat connector makes a connection with Tomcat server, it does not closes the connection even after it finished serving the request. Instead it keeps the connection active, so that for the next request, the same connection can be re-used. Also, the max value for the re-use connection is determined based on the number of sites configured with same CF server and the load on each site.

    If you have connector created with “ALL” then the resources allocated, will be shared across connections. Whereas, the individual connectors would have there own dedicated connections. The reuse connection plays an important role in terms of performance, but the calculation has a little tweak to it. While creating individual connectors, we would prefer to keep the max_reuse_connections not go below 100 or 150 (if it’s a low traffic running site). For moderate traffic, the value may be 200/250. For a site running under high volume, the value may go around 500 or as higher, as needed.

    Having said that, lets look at your scenario. You have 6 sites – 1 running under load and 5 with low traffic. When you create individual connectors, theoretically, these values can be set:-

    Site with heavy traffic (only one site)
    worker.cfusion.max_reuse_connections=500
    worker.cfusion.connection_pool_size=800

    Site with low traffic (rest five sites each)
    worker.cfusion.max_reuse_connections=100
    worker.cfusion.connection_pool_size=250

    server.xml

    Note: calculation for maxThreads: 800+250*5=1750 (the value should be higher than this)

    Similarly, when connector is created with “ALL”, theoretically, these values can be set:-
    worker.cfusion.max_reuse_connections=300
    worker.cfusion.connection_pool_size=1800

    server.xml

    Note: calculation for max_reuse_connections=connection_pool_size / {no of site}=1800/6=300.

    Thus, in case of connector is created with “ALL”, the max_reuse_connections calculation is straight forward, but in case of “Individual” connector, its a bit tricky :-).

  2. […] blog is in response to Chris Tierney’s recent article on max_reuse_connections in ColdFusion. Sorry Chris, but your blog truncated the server.xml entry, when I posted back. So, I am responding […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s