{"id":100,"date":"2012-03-26T19:41:07","date_gmt":"2012-03-26T23:41:07","guid":{"rendered":"http:\/\/www.mufljuz.com\/?p=100"},"modified":"2014-09-23T10:44:55","modified_gmt":"2014-09-23T14:44:55","slug":"apache-configuration-for-pylons","status":"publish","type":"post","link":"https:\/\/www.mufljuz.com\/?p=100","title":{"rendered":"Apache configuration for pylons"},"content":{"rendered":"<p>Recently some of our pylons servers experienced mysql overflow. Pylons app is served via apache 2.2 using worker mpm on gentoo with kernel 3.2. It uses sqlalchemy to access mysql server. The pylons error is:<\/p>\n<p><tt>&gt;&gt; self.pool.connect(),<br \/>\nModule sqlalchemy.pool:210 in connect<br \/>\n&gt;&gt; return _ConnectionFairy(self).checkout()<br \/>\nModule sqlalchemy.pool:371 in __init__<br \/>\n&gt;&gt; rec = self._connection_record = pool._do_get()<br \/>\nModule sqlalchemy.pool:685 in _do_get<br \/>\n&gt;&gt; (self.size(), self.overflow(), self._timeout))<br \/>\nTimeoutError: QueuePool limit of size 5 overflow 5 reached, connection timed out, timeout 30<\/tt><\/p>\n<p>Simultaneously, RAM hit 100% capacity and swap kicked in. Looking into memory use on the machine, mysql took ~6%, apache ~1%, and everything else was eaten by pylons. My apps use beaker for caching of certain functions. In principle, turning off cache might help, however it would increase system load and slowed down server response.<\/p>\n<p>The quick workaround was to modify number requests per child in apache controlled by MaxRequestsPerChild global. This basically allows faster recycling of processes and freeing<\/p>\n<p><code>\/etc\/apache2\/modules.d\/00_mpm.conf<\/code> was modified to reduce MaxRequestsPerChild:<br \/>\n<tt><br \/>\n&lt;IfModule mpm_worker_module&gt;<br \/>\nStartServers 16<br \/>\nMinSpareThreads 85<br \/>\nMaxSpareThreads 125<br \/>\nThreadsPerChild 48<br \/>\nMaxClients 768<br \/>\nMaxRequestsPerChild 2000<br \/>\n&lt;\/IfModule&gt;<br \/>\n<\/tt><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently some of our pylons servers experienced mysql overflow. Pylons app is served via apache 2.2 using worker mpm on gentoo with kernel 3.2. It uses sqlalchemy to access mysql server. The pylons error is: &gt;&gt; self.pool.connect(), Module sqlalchemy.pool:210 in connect &gt;&gt; return _ConnectionFairy(self).checkout() Module sqlalchemy.pool:371 in __init__ &gt;&gt; rec = self._connection_record = pool._do_get() Module [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[37,3,13,20,26,27],"tags":[31,38,30,39,32],"_links":{"self":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts\/100"}],"collection":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=100"}],"version-history":[{"count":20,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts\/100\/revisions"}],"predecessor-version":[{"id":120,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts\/100\/revisions\/120"}],"wp:attachment":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}