<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CRIN Trac: Ticket #9: Monitor and adjust server settings after Crin1 and Crin2 server go live</title>
    <link>https://trac.crin.org/trac/ticket/9</link>
    <description>&lt;p&gt;
After the &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/Crin1"&gt;Crin1&lt;/a&gt; and &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/Crin2"&gt;Crin2&lt;/a&gt; server go live there will, no doubt, need to be some monitoring and adjustment of memory allocations, process numbers etc for MySQL, Memcache, Nginx and MySQL, this task will depend on having a &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/Munin"&gt;Munin&lt;/a&gt; server and clients set up.
&lt;/p&gt;
</description>
    <language>en-us</language>
    <image>
      <title>CRIN Trac</title>
      <url>https://trac.crin.org/trac/chrome/site/logo.gif</url>
      <link>https://trac.crin.org/trac/ticket/9</link>
    </image>
    <generator>Trac 1.0.2</generator>
    <item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Sat, 13 Jun 2015 11:53:37 GMT</pubDate>
      <title>hours changed; totalhours set</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:1</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:1</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.15&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                set to &lt;em&gt;0.15&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
It appears from &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin2.crin.org/index.html#php-apc"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;the Munin graphs that APC isn't doing anything&lt;/a&gt; -- this needs more investigation.
&lt;/p&gt;
&lt;p&gt;
Memcache &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin2.crin.org/index.html#memcache"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;is working fine&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
There was this issue on &lt;a class="ext-link" href="https://www.crin.org/en/admin/reports/status"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;the status page&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
Apache Solr        Your site was unable to contact the Apache Solr server.
Default environment url:
&lt;a class="ext-link" href="http://web1:8080/solr"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;http://web1:8080/solr&lt;/a&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
So this was changed to &lt;tt&gt;localhost&lt;/tt&gt; on &lt;a class="ext-link" href="https://www.crin.org/en/admin/config/search/apachesolr/settings"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;the solr settings page&lt;/a&gt;.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Sun, 14 Jun 2015 12:48:19 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:2</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:2</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.35&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.15&lt;/em&gt; to &lt;em&gt;0.5&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Regarding APC, according to &lt;tt&gt;/usr/share/doc/php5-apcu/INSTALL.gz&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;Suggested Configuration (in your php.ini file)
----------------------------------------------
  extension=apcu.so
  apc.enabled=1
  apc.shm_size=32M
  apc.ttl=7200
  apc.enable_cli=1
Next you must edit your php.ini file, which is normally located in
/usr/local/php/lib/php.ini, and add the following line:
    extension="apcu.so"
&lt;/pre&gt;&lt;p&gt;
We have &lt;tt&gt;/etc/php5/fpm/conf.d/20-apcu.ini&lt;/tt&gt; which is a symlink to &lt;tt&gt;/etc/php5/mods-available/apcu.ini&lt;/tt&gt; and contains:
&lt;/p&gt;
&lt;pre class="wiki"&gt;extension=apcu.so
apc.enabled=1
apc.shm_size=128M
apc.max_file_size=1M
&lt;/pre&gt;&lt;p&gt;
But we don't have &lt;tt&gt;extension="apcu.so"&lt;/tt&gt; in a &lt;tt&gt;php.ini&lt;/tt&gt; file, so &lt;tt&gt;/etc/php5/fpm/php.ini&lt;/tt&gt; was edited to add:
&lt;/p&gt;
&lt;pre class="wiki"&gt;extension=apcu.so
&lt;/pre&gt;&lt;p&gt;
And &lt;tt&gt;php-fpm&lt;/tt&gt; was restarted:
&lt;/p&gt;
&lt;pre class="wiki"&gt;service php5-fpm restart
&lt;/pre&gt;&lt;p&gt;
Test to see if we now have some stats on the command line:
&lt;/p&gt;
&lt;pre class="wiki"&gt;cd /etc/munin/plugins
munin-run php_apc_files
used.value 32992
free.value 134184600
hits.value 0.00
misses.value 0.00
request_rate.value 0.00
hit_rate.value 0.00
miss_rate.value 0.00
insert_rate.value 0.00
entries.value 0
inserts.value 0
purges.value U
purge_rate.value 100.00
fragmented.value 0.00
fragment_segments.value 0
fragment_percentage.value 0.00
optcode_size.value 0
user_size.value 0
user_hits.value 0.00
user_misses.value 0.00
user_request_rate.value 0.00
user_hit_rate.value 0.00
user_miss_rate.value 0.00
user_insert_rate.value 0.00
user_entries.value 0
user_inserts.value 0
user_purges.value U
user_purge_rate.value 0.00
&lt;/pre&gt;&lt;p&gt;
We don't, so this hasn't solve the issues of APC not being used.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Sun, 14 Jun 2015 13:01:09 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;crin-apc-phpinfo.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Sun, 14 Jun 2015 13:04:17 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:3</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:3</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.1&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.5&lt;/em&gt; to &lt;em&gt;0.6&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
I created a php info file containing:
&lt;/p&gt;
&lt;pre class="wiki"&gt;&amp;lt;?php phpinfo(); ?&amp;gt;
&lt;/pre&gt;&lt;p&gt;
To check if APC is enabled and it is:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/crin-apc-phpinfo.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/crin-apc-phpinfo.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
So more investigation is needed regarding why it isn't being used.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Sun, 14 Jun 2015 13:50:18 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:4</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:4</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.1&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.6&lt;/em&gt; to &lt;em&gt;0.7&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
The server just sent this email:
&lt;/p&gt;
&lt;pre class="wiki"&gt;Date: Sun, 14 Jun 2015 13:39:01 +0000
From: Cron Daemon &amp;lt;root@crin2.crin.org&amp;gt;
To: root@crin2.crin.org
Subject: Cron &amp;lt;root@crin2&amp;gt;   [ -x /usr/lib/php5/sessionclean ] &amp;amp;&amp;amp; /usr/lib/php5/sessionclean
PHP Warning:  Module 'apcu' already loaded in Unknown on line 0
&lt;/pre&gt;&lt;p&gt;
So I have commented &lt;tt&gt;extension=apcu.so&lt;/tt&gt; out from &lt;tt&gt;/etc/php5/fpm/php.ini&lt;/tt&gt; and restarted &lt;tt&gt;php5-fpm&lt;/tt&gt;.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Mon, 15 Jun 2015 08:42:41 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:5</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:5</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.25&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.7&lt;/em&gt; to &lt;em&gt;0.95&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Jenny sent a email saying:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
The speed seems to be slow.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
So, I have allocated more memory to memcache:
&lt;/p&gt;
&lt;pre class="wiki"&gt;# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
# Note that the daemon will grow to this size, but does not start out holding this much
# memory
#-m 64
-m 256
&lt;/pre&gt;&lt;p&gt;
I have also increased the max number of &lt;tt&gt;php-fpm&lt;/tt&gt; processes from 5 to 10, in &lt;tt&gt;/etc/php5/fpm/pool.d/www.conf&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;;pm.max_children = 5
pm.max_children = 10
&lt;/pre&gt;&lt;p&gt;
I'll keep an eye on the &lt;a class="ext-link" href="https://munin.crin.org/munin/"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;Munin graphs&lt;/a&gt; today and also try to get to the bottom of why APC isn't working.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Mon, 15 Jun 2015 09:21:49 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:6</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:6</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.45&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.95&lt;/em&gt; to &lt;em&gt;1.4&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Email from Jenny:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
I'm afraid we can't edit any pages - we just get a blank page when we try, eg: node/41556
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
To test this, generate a one time login:
&lt;/p&gt;
&lt;pre class="wiki"&gt;su - www-data -s /bin/bash
cd drupal/
drush uli
&lt;/pre&gt;&lt;p&gt;
And I get:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
502 Bad Gateway
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
In the Nginx error log there are a lot of errors like this:
&lt;/p&gt;
&lt;pre class="wiki"&gt;2015/06/15 08:51:17 [error] 6144#0: *2879 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /status HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "127.0.0.1:80"
&lt;/pre&gt;&lt;p&gt;
php-fpm appears to be running:
&lt;/p&gt;
&lt;pre class="wiki"&gt;service php5-fpm status
● php5-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
   Active: active (running) since Mon 2015-06-15 08:39:08 GMT; 17min ago
  Process: 6902 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
 Main PID: 6908 (php5-fpm)
   Status: "Processes active: 10, idle: 0, Requests: 744, slow: 0, Traffic: 0req/sec"
   CGroup: /system.slice/php5-fpm.service
           ├─6908 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
           ├─7749 php-fpm: pool www
           ├─8158 php-fpm: pool www
           ├─8159 php-fpm: pool www
           ├─8160 php-fpm: pool www
           ├─8161 php-fpm: pool www
           ├─8162 php-fpm: pool www
           ├─8163 php-fpm: pool www
           ├─8164 php-fpm: pool www
           ├─8165 php-fpm: pool www
           └─8166 php-fpm: pool www
&lt;/pre&gt;&lt;p&gt;
Note the &lt;tt&gt;Traffic: 0req/sec"&lt;/tt&gt; -- this appears to indicvate a problem, restarting it...
&lt;/p&gt;
&lt;pre class="wiki"&gt;php5-fpm stop
php5-fpm status
● php5-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
   Active: inactive (dead) since Mon 2015-06-15 08:57:31 GMT; 3s ago
  Process: 6908 ExecStart=/usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.conf (code=exited, status=0/SUCCESS)
  Process: 6902 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
 Main PID: 6908 (code=exited, status=0/SUCCESS)
   Status: "Processes active: 10, idle: 0, Requests: 762, slow: 0, Traffic: 1.1req/sec"
service php5-fpm start
service php5-fpm status
● php5-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
   Active: active (running) since Mon 2015-06-15 08:57:42 GMT; 28s ago
  Process: 9451 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
 Main PID: 9459 (php5-fpm)
   Status: "Processes active: 2, idle: 4, Requests: 20, slow: 0, Traffic: 0.9req/sec"
   CGroup: /system.slice/php5-fpm.service
           ├─9459 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
           ├─9464 php-fpm: pool www
           ├─9465 php-fpm: pool www
           ├─9466 php-fpm: pool www
           ├─9467 php-fpm: pool www
           └─9468 php-fpm: pool www
&lt;/pre&gt;&lt;p&gt;
Regarding the edit problem, this is confirmed:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class="ext-link" href="https://www.crin.org/en/node/41556/edit"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;https://www.crin.org/en/node/41556/edit&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
Looking at the HTTP headers, it is a 500 internal server error:
&lt;/p&gt;
&lt;pre class="wiki"&gt;GET /en/node/41556/edit HTTP/1.1
Host: www.crin.org
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Cookie: has_js=1; ccShowCookieIcon=no; crin_cookiecontrol=yes; SSESSXXXX
Referer: https://www.crin.org/
Connection: keep-alive
If-Modified-Since: Mon, 15 Jun 2015 09:04:09 +0000
If-None-Match: "1434359049"
HTTP/1.1 500 Internal Server Error
Server: nginx/1.6.2
Date: Mon, 15 Jun 2015 09:05:36 GMT
Content-Type: text/html; charset=utf-8
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Mon, 15 Jun 2015 09:05:27 +0000
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Etag: "1434359127"
Content-Language: en
X-Firefox-Spdy: 3.1
&lt;/pre&gt;&lt;p&gt;
All we have in the &lt;tt&gt;php-fpm&lt;/tt&gt; log are a lot of entries like this:
&lt;/p&gt;
&lt;pre class="wiki"&gt;[15-Jun-2015 09:02:36] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[15-Jun-2015 09:04:59] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[15-Jun-2015 09:07:18] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 9 total children
[15-Jun-2015 09:07:42] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 8 total children
[15-Jun-2015 09:08:07] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 8 total children
&lt;/pre&gt;&lt;p&gt;
(Note the server is on GMT so 9:08 is actually 10:08 BST.)
&lt;/p&gt;
&lt;p&gt;
We don't have &lt;tt&gt;php-fpm&lt;/tt&gt; error logs, so uncommenting these lines in &lt;tt&gt;/etc/php5/fpm/pool.d/www.conf&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
&lt;/pre&gt;&lt;p&gt;
And &lt;tt&gt;php-fpm&lt;/tt&gt; was restarted -- without some indication regarding the resons for the 500 Internal Server Error it will be very hard to solve.
&lt;/p&gt;
&lt;p&gt;
Touch the chown the log, so that it is written to:
&lt;/p&gt;
&lt;pre class="wiki"&gt;touch /var/log/fpm-php.www.log
chown www-data:www-data /var/log/fpm-php.www.log
service php5-fpm restart
&lt;/pre&gt;&lt;p&gt;
Now we have lots of issues to address:
&lt;/p&gt;
&lt;pre class="wiki"&gt;[15-Jun-2015 10:17:34 Europe/London] PHP Parse error:  syntax error, unexpected end of file in /var/www/drupal/sites/default/themes/crin/templates/node--country.tpl.php on line 522
[15-Jun-2015 10:18:15 Europe/London] PHP Parse error:  syntax error, unexpected end of file in /var/www/drupal/sites/default/themes/crin/templates/node--country.tpl.php on line 522
[15-Jun-2015 10:18:38 Europe/London] PHP Parse error:  syntax error, unexpected end of file in /var/www/drupal/sites/default/themes/crin/templates/node--country.tpl.php on line 522
[15-Jun-2015 10:18:56 Europe/London] PHP Notice:  MemcachePool::set(): Server 127.0.0.1 (tcp 11211, udp 0) failed with: SERVER_ERROR object too large for cache
 (3) in /var/www/drupal/sites/all/modules/memcache/dmemcache.inc on line 51
[15-Jun-2015 10:18:57 Europe/London] PHP Strict Standards:  Only variables should be passed by reference in /var/www/drupal/sites/all/modules/views/plugins/views_plugin_argument_default_php.inc(53) : eval()'d code on line 1
[15-Jun-2015 10:18:58 Europe/London] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4147733 bytes) in /var/www/drupal/includes/theme.inc on line 1520
[15-Jun-2015 10:19:05 Europe/London] PHP Parse error:  syntax error, unexpected end of file in /var/www/drupal/sites/default/themes/crin/templates/node--country.tpl.php on line 522
[15-Jun-2015 09:19:42 UTC] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[15-Jun-2015 10:19:52 Europe/London] PHP Parse error:  syntax error, unexpected end of file in /var/www/drupal/sites/default/themes/crin/templates/node--country.tpl.php on line 522
[15-Jun-2015 09:20:02 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 54
[15-Jun-2015 09:20:02 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 71
[15-Jun-2015 09:20:02 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 79
[15-Jun-2015 09:20:02 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 80
[15-Jun-2015 09:20:02 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 88
[15-Jun-2015 09:20:03 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 54
[15-Jun-2015 09:20:03 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 71
[15-Jun-2015 09:20:03 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 79
[15-Jun-2015 09:20:03 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 80
[15-Jun-2015 09:20:03 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 88
[15-Jun-2015 10:20:05 Europe/London] PHP Parse error:  syntax error, unexpected end of file in /var/www/drupal/sites/default/themes/crin/templates/node--country.tpl.php on line 522
[15-Jun-2015 09:20:05 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 54
[15-Jun-2015 09:20:05 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 71
[15-Jun-2015 09:20:05 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 79
[15-Jun-2015 09:20:05 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 80
[15-Jun-2015 09:20:05 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 88
[15-Jun-2015 09:20:06 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 54
[15-Jun-2015 09:20:06 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 71
[15-Jun-2015 09:20:06 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 79
[15-Jun-2015 09:20:06 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 80
[15-Jun-2015 09:20:06 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 88
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Mon, 15 Jun 2015 09:51:10 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:7</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:7</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.2&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;1.4&lt;/em&gt; to &lt;em&gt;1.6&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
This is the error we get when trying to edit pages:
&lt;/p&gt;
&lt;pre class="wiki"&gt;[15-Jun-2015 10:38:53 Europe/London] PHP Notice:  MemcachePool::set(): Server 127.0.0.1 (tcp 11211, udp 0) failed with: SERVER_ERROR object too large for cache
 (3) in /var/www/drupal/sites/all/modules/memcache/dmemcache.inc on line 51
&lt;/pre&gt;&lt;p&gt;
In &lt;tt&gt;/etc/php5/fpm/conf.d&lt;/tt&gt; we have these sym links:
&lt;/p&gt;
&lt;pre class="wiki"&gt;20-memcached.ini -&amp;gt; ../../mods-available/memcached.ini
20-memcache.ini -&amp;gt; ../../mods-available/memcache.ini
&lt;/pre&gt;&lt;p&gt;
And those file contain:
&lt;/p&gt;
&lt;pre class="wiki"&gt;; uncomment the next line to enable the module
extension=memcached.so
&lt;/pre&gt;&lt;pre class="wiki"&gt;; uncomment the next line to enable the module
extension=memcache.so
[memcache]
memcache.dbpath="/var/lib/memcache"
memcache.maxreclevel=0
memcache.maxfiles=0
memcache.archivememlim=0
memcache.maxfilesize=0
memcache.maxratio=0
&lt;/pre&gt;&lt;p&gt;
Looking at documentation for &lt;tt&gt;memcache.maxfilesize&lt;/tt&gt; ...
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Mon, 15 Jun 2015 10:16:33 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:8</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:8</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.25&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;1.6&lt;/em&gt; to &lt;em&gt;1.85&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
I have tried increasing the memory allocated to memcache to 2GB, in &lt;tt&gt;/etc/memcached.conf&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
# Note that the daemon will grow to this size, but does not start out holding this much
# memory
#-m 64
-m 2048
&lt;/pre&gt;&lt;p&gt;
But still trying to edit pages results in:
&lt;/p&gt;
&lt;pre class="wiki"&gt;[15-Jun-2015 11:08:34 Europe/London] PHP Notice:  MemcachePool::set(): Server 127.0.0.1 (tcp 11211, udp 0) failed with: SERVER_ERROR object too large for cache
 (3) in /var/www/drupal/sites/all/modules/memcache/dmemcache.inc on line 51
[15-Jun-2015 11:08:35 Europe/London] PHP Strict Standards:  Only variables should be passed by reference in /var/www/drupal/sites/all/modules/views/plugins/views_plugin_argument_default_php.inc(53) : eval()'d code on line 1
[15-Jun-2015 11:08:40 Europe/London] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4104 bytes) in /var/www/drupal/sites/all/modules/admin_menu/admin_menu.inc on line 222
&lt;/pre&gt;&lt;p&gt;
I can't find any documentation regarding settings for &lt;tt&gt;memcache.maxfilesize&lt;/tt&gt; on &lt;a class="ext-link" href="https://www.php.net/"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;https://www.php.net/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Trying to increase the memory allocated to php-fpm processes, in &lt;tt&gt;/etc/php5/fpm/php.ini&lt;/tt&gt; this variable was changed:
&lt;/p&gt;
&lt;pre class="wiki"&gt;; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
;memory_limit = 128M
memory_limit = 256M
&lt;/pre&gt;&lt;p&gt;
And &lt;tt&gt;php-fpm&lt;/tt&gt; was restarted and now editing documents works, so reducing memcache memory back to 512M, in &lt;tt&gt;/etc/memcached.conf&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;#-m 64
-m 512
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Mon, 15 Jun 2015 11:09:43 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.68&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;1.85&lt;/em&gt; to &lt;em&gt;2.53&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Trying to get to the bottom of the APC issue, &lt;tt&gt;/etc/munin/plugin-conf.d/munin-node&lt;/tt&gt; contains:
&lt;/p&gt;
&lt;pre class="wiki"&gt;[php_apc_*]
user root
env.url http://localhost/apc-info.php?auto
&lt;/pre&gt;&lt;p&gt;
Accessing that URL generates a timeout:
&lt;/p&gt;
&lt;pre class="wiki"&gt;lynx -dump http://localhost/apc-info.php?auto
                            504 Gateway Time-out
     __________________________________________________________________
                                 nginx/1.6.2
&lt;/pre&gt;&lt;p&gt;
And a bad gateway:
&lt;/p&gt;
&lt;pre class="wiki"&gt;lynx -dump http://localhost/apc-info.php?auto
                               502 Bad Gateway
     __________________________________________________________________
                                 nginx/1.6.2
&lt;/pre&gt;&lt;p&gt;
And these errors in &lt;tt&gt;/var/log/fpm-php.www.log&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;[15-Jun-2015 10:34:07 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 54
[15-Jun-2015 10:34:07 UTC] PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 71
[15-Jun-2015 10:34:07 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 79
[15-Jun-2015 10:34:07 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 80
[15-Jun-2015 10:34:07 UTC] PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 88
&lt;/pre&gt;&lt;p&gt;
php-fpm appears to be stuck:
&lt;/p&gt;
&lt;pre class="wiki"&gt;service php5-fpm status
● php5-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
   Active: active (running) since Mon 2015-06-15 10:12:44 GMT; 24min ago
  Process: 19697 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
 Main PID: 19703 (php5-fpm)
   Status: "Processes active: 10, idle: 0, Requests: 970, slow: 0, Traffic: 0.1req/sec"
   CGroup: /system.slice/php5-fpm.service
           ├─19703 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
           ├─20431 php-fpm: pool www
           ├─21005 php-fpm: pool www
           ├─21007 php-fpm: pool www
           ├─21008 php-fpm: pool www
           ├─21009 php-fpm: pool www
           ├─21010 php-fpm: pool www
           ├─21011 php-fpm: pool www
           ├─21012 php-fpm: pool www
           ├─21013 php-fpm: pool www
           └─21014 php-fpm: pool www
&lt;/pre&gt;&lt;p&gt;
So:
&lt;/p&gt;
&lt;pre class="wiki"&gt;service php5-fpm stop
service php5-fpm status
● php5-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
   Active: inactive (dead) since Mon 2015-06-15 10:37:45 GMT; 3s ago
  Process: 19703 ExecStart=/usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.conf (code=exited, status=0/SUCCESS)
  Process: 19697 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
 Main PID: 19703 (code=exited, status=0/SUCCESS)
   Status: "Processes active: 10, idle: 0, Requests: 973, slow: 0, Traffic: 0.1req/sec"
service php5-fpm start
service php5-fpm status
● php5-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
   Active: active (running) since Mon 2015-06-15 10:37:55 GMT; 27s ago
  Process: 23057 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
 Main PID: 23065 (php5-fpm)
   Status: "Processes active: 10, idle: 0, Requests: 11, slow: 0, Traffic: 0.5req/sec"
   CGroup: /system.slice/php5-fpm.service
           ├─23065 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
           ├─23067 php-fpm: pool www
           ├─23068 php-fpm: pool www
           ├─23069 php-fpm: pool www
           ├─23070 php-fpm: pool www
           ├─23071 php-fpm: pool www
           ├─23072 php-fpm: pool www
           ├─23073 php-fpm: pool www
           ├─23074 php-fpm: pool www
           ├─23075 php-fpm: pool www
           └─23076 php-fpm: pool www
service php5-fpm status
● php5-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
   Active: active (running) since Mon 2015-06-15 10:37:55 GMT; 27s ago
  Process: 23057 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
 Main PID: 23065 (php5-fpm)
   Status: "Processes active: 10, idle: 0, Requests: 11, slow: 0, Traffic: 0.5req/sec"
   CGroup: /system.slice/php5-fpm.service
           ├─23065 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
           ├─23067 php-fpm: pool www
           ├─23068 php-fpm: pool www
           ├─23069 php-fpm: pool www
           ├─23070 php-fpm: pool www
           ├─23071 php-fpm: pool www
           ├─23072 php-fpm: pool www
           ├─23073 php-fpm: pool www
           ├─23074 php-fpm: pool www
           ├─23075 php-fpm: pool www
           └─23076 php-fpm: pool www
&lt;/pre&gt;&lt;p&gt;
Things appears to be working better with fewer &lt;tt&gt;php-fpm&lt;/tt&gt; processes, so droppig the max back to 5 from 10, but that didn't help, in fact things seemed to get worse, so it has now been increased to 20, but still lot of 502 errors and the site is &lt;strong&gt;very slow&lt;/strong&gt;... so dropping it back to the original 5 max processes...
&lt;/p&gt;
&lt;p&gt;
Trying to get APC working:
&lt;/p&gt;
&lt;pre class="wiki"&gt;su www-data -s /bin/bash
cd /var/www/localhost
apc-info.php
PHP Warning:  apc_sma_info(): No APC SMA info available.  Perhaps APC is disabled via apc.enabled? in /var/www/localhost/apc-info.php on line 15
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 79
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 80
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 88
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 89
size: 0 used: 0 free: 0 hits: 0.00 misses: 0.00 request_rate: 0.00 hit_rate: 0.00 miss_rate: 0.00 insert_rate: 0.00 entries:  inserts:  purges:  purge_rate: 100.00 fragment_percentage: 0.00 fragmented: 0.00 fragment_segments: 0 optcode_size:  user_size:  user_hits: 0.00 user_misses: 0.00 user_request_rate: 0.00 user_hit_rate: 0.00 user_miss_rate: 0.00 user_insert_rate: 0.00 user_entries:  user_inserts:  user_purges:  user_purge_rate: 0.00
&lt;/pre&gt;&lt;p&gt;
Following the &lt;a class="ext-link" href="https://www.drupal.org/node/1214668#comment-4749396"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;suggestion here&lt;/a&gt; &lt;tt&gt;/etc/php5/mods-available/apcu.ini&lt;/tt&gt; was edited to add:
&lt;/p&gt;
&lt;pre class="wiki"&gt;apc.enable_cli=1
&lt;/pre&gt;&lt;p&gt;
That solved one problem:
&lt;/p&gt;
&lt;pre class="wiki"&gt;php apc-info.php
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 49
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 50
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 51
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 52
PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 54
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 66
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 67
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 68
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 69
PHP Notice:  Undefined index: expunges in /var/www/localhost/apc-info.php on line 71
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 79
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 80
PHP Warning:  Division by zero in /var/www/localhost/apc-info.php on line 88
size: 134217592 used: 32992 free: 134184600 hits: 0.00 misses: 0.00 request_rate: 0.00 hit_rate: 0.00 miss_rate: 0.00 insert_rate: 0.00 entries: 0 inserts: 0 purges:  purge_rate: 100.00 fragment_percentage: 0.00 fragmented: 0.00 fragment_segments: 0 optcode_size: 0 user_size: 0 user_hits: 0.00 user_misses: 0.00 user_request_rate: 0.00 user_hit_rate: 0.00 user_miss_rate: 0.00 user_insert_rate: 0.00 user_entries: 0 user_inserts: 0 user_purges:  user_purge_rate: 0.00
&lt;/pre&gt;&lt;p&gt;
But still people are getting 502's and the site is &lt;tt&gt;&lt;/tt&gt;&lt;tt&gt;very&lt;/tt&gt;&lt;tt&gt;&lt;/tt&gt; slow.
&lt;/p&gt;
&lt;p&gt;
php-fpm is almost managing to serve two requests a second:
&lt;/p&gt;
&lt;pre class="wiki"&gt;service php5-fpm status
● php5-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
   Active: active (running) since Mon 2015-06-15 11:00:09 GMT; 6min ago
  Process: 26752 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
 Main PID: 26758 (php5-fpm)
   Status: "Processes active: 5, idle: 0, Requests: 234, slow: 0, Traffic: 1.1req/sec"
   CGroup: /system.slice/php5-fpm.service
           ├─26758 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
           ├─26762 php-fpm: pool www
           ├─26763 php-fpm: pool www
           ├─26895 php-fpm: pool www
           ├─26896 php-fpm: pool www
           └─26897 php-fpm: pool www
&lt;/pre&gt;&lt;p&gt;
This is clearly hopeless given the server has 4GB of RAM...
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Mon, 15 Jun 2015 12:53:34 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:10</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:10</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;1.3&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;2.53&lt;/em&gt; to &lt;em&gt;3.83&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Trying to debug the APC issue:
&lt;/p&gt;
&lt;pre class="wiki"&gt;locate locate apc.php
/usr/share/doc/php5-apcu/apc.php
cp /usr/share/doc/php5-apcu/apc.php /var/www/localhost/
&lt;/pre&gt;&lt;p&gt;
Edit &lt;tt&gt;/etc/nginx/sites-available/localhost&lt;/tt&gt; and add:
&lt;/p&gt;
&lt;pre class="wiki"&gt;        location ~ /apc\.php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
                include fastcgi_params;
                access_log off;
                allow 127.0.0.1;
                deny all;
        }
&lt;/pre&gt;&lt;p&gt;
Restart Nginx and then:
&lt;/p&gt;
&lt;pre class="wiki"&gt;lynx -dump http://localhost/apc.php
   [1]APCu
   User Cache
   [2]Login
     __________________________________________________________________
    1. [3]Refresh Data
    2. View Host Stats
    3. [4]User Cache Entries
    4. [5]Version Check
General Cache Information
   APCu Version        4.0.7
   PHP Version         5.6.9-0+deb8u1
   APCu Host           localhost (crin2.crin.org) (127.0.0.1)
   Server Software     nginx/1.6.2
   Shared Memory       1 Segment(s) with 128.0 MBytes
                       (mmap memory)
   Start Time          2015/06/15 11:00:09
   Uptime              42 minutes
   File Upload Support 1
Cache Information
   Cached Variables            0 ( 0.0 Bytes)
   Hits                        0
   Misses                      0
   Request Rate (hits, misses) 0.00 cache requests/second
   Hit Rate                    0.00 cache requests/second
   Miss Rate                   0.00 cache requests/second
   Insert Rate                 0.00 cache requests/second
   Cache full count            0
Runtime Settings
   apc.coredump_unmap   0
   apc.enable_cli       1
   apc.enabled          1
   apc.entries_hint     4096
   apc.gc_ttl           3600
   apc.mmap_file_mask
   apc.preload_path
   apc.rfc1867          0
   apc.rfc1867_freq     0
   apc.rfc1867_name     APC_UPLOAD_PROGRESS
   apc.rfc1867_prefix   upload_
   apc.rfc1867_ttl      3600
   apc.serializer       php
   apc.shm_segments     1
   apc.shm_size         128M
   apc.slam_defense     1
   apc.smart            0
   apc.ttl              0
   apc.use_request_time 1
   apc.writable         /tmp
Host Status Diagrams
   Memory Usage                 Hits &amp;amp; Misses
    Free: 128.0 MBytes (100.0%)  Hits: 0 (0.0%)
    Used: 32.2 KBytes (0.0%)     Misses: 0 (0.0%)
Detailed Memory Usage and Fragmentation
   Fragmentation: 0%
References
   1. http://pecl.php.net/package/APCu
   2. http://localhost/apc.php
   3. http://localhost/apc.php?SCOPE=A&amp;amp;SORT1=H&amp;amp;SORT2=D&amp;amp;COUNT=20&amp;amp;OB=1&amp;amp;SH=
   4. http://localhost/apc.php?SCOPE=A&amp;amp;SORT1=H&amp;amp;SORT2=D&amp;amp;COUNT=20&amp;amp;OB=2
   5. http://localhost/apc.php?SCOPE=A&amp;amp;SORT1=H&amp;amp;SORT2=D&amp;amp;COUNT=20&amp;amp;OB=3
&lt;/pre&gt;&lt;p&gt;
Still don't understand why APC isn't being used.
&lt;/p&gt;
&lt;p&gt;
Have spent some time watching the logs and have changed these settings as a result, in &lt;tt&gt;/etc/php5/fpm/php.ini&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;memory_limit = 384M
&lt;/pre&gt;&lt;p&gt;
And in &lt;tt&gt;/etc/php5/fpm/pool.d/www.conf&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;pm.max_children = 50
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 6
&lt;/pre&gt;&lt;p&gt;
Things seem to be running better now... but more needs to be done to optimise the servers...
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Mon, 15 Jun 2015 13:39:01 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:11</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:11</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.68&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;3.83&lt;/em&gt; to &lt;em&gt;4.51&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Spend some time trying to track down why APC isn't working, still no joy, the latest results from the stats script:
&lt;/p&gt;
&lt;pre class="wiki"&gt;lynx -dump http://localhost/apc.php
   [1]APCu
   User Cache
   [2]Login
     __________________________________________________________________
    1. [3]Refresh Data
    2. View Host Stats
    3. [4]User Cache Entries
    4. [5]Version Check
General Cache Information
   APCu Version        4.0.7
   PHP Version         5.6.9-0+deb8u1
   APCu Host           localhost (crin2.crin.org) (127.0.0.1)
   Server Software     nginx/1.6.2
   Shared Memory       1 Segment(s) with 256.0 MBytes
                       (mmap memory)
   Start Time          2015/06/15 13:24:52
   Uptime              13 minutes
   File Upload Support 1
Cache Information
   Cached Variables            0 ( 0.0 Bytes)
   Hits                        0
   Misses                      0
   Request Rate (hits, misses) 0.00 cache requests/second
   Hit Rate                    0.00 cache requests/second
   Miss Rate                   0.00 cache requests/second
   Insert Rate                 0.00 cache requests/second
   Cache full count            0
Runtime Settings
   apc.coredump_unmap   0
   apc.enable_cli       1
   apc.enabled          1
   apc.entries_hint     4096
   apc.gc_ttl           3600
   apc.mmap_file_mask   /dev/shm/apc.7ByvRj
   apc.preload_path
   apc.rfc1867          0
   apc.rfc1867_freq     0
   apc.rfc1867_name     APC_UPLOAD_PROGRESS
   apc.rfc1867_prefix   upload_
   apc.rfc1867_ttl      3600
   apc.serializer       php
   apc.shm_segments     1
   apc.shm_size         256M
   apc.slam_defense     1
   apc.smart            0
   apc.ttl              3600
   apc.use_request_time 1
   apc.writable         /tmp
Host Status Diagrams
   Memory Usage                 Hits &amp;amp; Misses
    Free: 256.0 MBytes (100.0%)  Hits: 0 (0.0%)
    Used: 32.2 KBytes (0.0%)     Misses: 0 (0.0%)
Detailed Memory Usage and Fragmentation
   Fragmentation: 0%
References
   1. http://pecl.php.net/package/APCu
   2. http://localhost/apc.php
   3. http://localhost/apc.php?SCOPE=A&amp;amp;SORT1=H&amp;amp;SORT2=D&amp;amp;COUNT=20&amp;amp;OB=1&amp;amp;SH=
   4. http://localhost/apc.php?SCOPE=A&amp;amp;SORT1=H&amp;amp;SORT2=D&amp;amp;COUNT=20&amp;amp;OB=2
   5. http://localhost/apc.php?SCOPE=A&amp;amp;SORT1=H&amp;amp;SORT2=D&amp;amp;COUNT=20&amp;amp;OB=3
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Tue, 16 Jun 2015 10:45:25 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:12</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:12</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.38&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;4.51&lt;/em&gt; to &lt;em&gt;4.89&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Perhaps the &lt;a class="ext-link" href="https://www.drupal.org/project/apc"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;Drupal APC modules&lt;/a&gt; is needed for APC to cache things (though I have used APC on other servers with applications that don't have any APC specific code), in any case I think I have spent enough time trying to get it working -- the site will have to live without it for now (I don't think it was working on the GreenCloud servers either but there we had twice as much RAM).
&lt;/p&gt;
&lt;p&gt;
So disablng the config:
&lt;/p&gt;
&lt;pre class="wiki"&gt;cd /etc/php5/fpm/conf.d/
rm 20-apcu.ini
cd cd /etc/munin/plugins
rm php_apc_*
aptitude remove php5-apcu
service php5-fpm restart
service munin-node restart
&lt;/pre&gt;&lt;p&gt;
The server does have a lot more memory allocated to memcache that the previous server &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin2.crin.org/memcached_counters.html"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;see the Munin stats&lt;/a&gt; (the units used are KiB, 1 kibibyte is 1024 bytes, so the current usage of 1400000 KiB equates to 170MB) -- 512MB has been made available compared with 64MB -- so this should help, especially as more things are cached.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Tue, 16 Jun 2015 12:50:47 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:13</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:13</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.21&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;4.89&lt;/em&gt; to &lt;em&gt;5.1&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Checking the MySQL memory allocation on &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/Crin2"&gt;Crin2&lt;/a&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;mysqltuner
 &amp;gt;&amp;gt;  MySQLTuner 1.3.0 - Major Hayden &amp;lt;major@mhtx.net&amp;gt;
 &amp;gt;&amp;gt;  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 &amp;gt;&amp;gt;  Run with '--help' for additional options and output filtering
[OK] Logged in using credentials from debian maintenance account.
[OK] Currently running supported MySQL version 5.5.43-0+deb8u1
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in InnoDB tables: 820M (Tables: 512)
[--] Data in MyISAM tables: 1G (Tables: 79)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 0B (Tables: 1)
[!!] Total fragmented tables: 528
-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 33d 2h 14m 57s (63M q [22.092 qps], 499K conn, TX: 700B, RX: 23B)
[--] Reads / Writes: 87% / 13%
[--] Total buffers: 1.1G global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 1.5G (38% of installed RAM)
[OK] Slow queries: 0% (209/63M)
[OK] Highest usage of available connections: 35% (54/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/241.6M
[OK] Key buffer hit rate: 99.9% (5B cached / 6M reads)
[OK] Query cache efficiency: 90.0% (54M cached / 60M selects)
[!!] Query cache prunes per day: 124076
[OK] Sorts requiring temporary tables: 0% (6K temp sorts / 1M sorts)
[OK] Temporary tables created on disk: 6% (40K on disk / 657K total)
[OK] Thread cache hit rate: 99% (2K created / 499K connections)
[!!] Table cache hit rate: 0% (400 open / 85K opened)
[OK] Open file limit used: 16% (167/1K)
[OK] Table locks acquired immediately: 99% (8M immediate / 8M locks)
[OK] InnoDB buffer pool / data size: 1.0G/820.9M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Enable the slow query log to troubleshoot bad queries
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
    query_cache_size (&amp;gt; 32M)
    table_open_cache (&amp;gt; 400)
&lt;/pre&gt;&lt;p&gt;
Based on the above I have doubles the size of the &lt;tt&gt;query_cache_size&lt;/tt&gt; (from 32M to 64M) and also changed the directory where temp files are created from &lt;tt&gt;/tmp&lt;/tt&gt; to &lt;tt&gt;/dev/shm&lt;/tt&gt; (which is RAM rather than disk):
&lt;/p&gt;
&lt;pre class="wiki"&gt;#tmpdir         = /tmp
tmpdir          = /dev/shm
#query_cache_size        = 32M
query_cache_size        = 64M
&lt;/pre&gt;&lt;p&gt;
This should speed things up a bit, I'll check the results later this week, MySQL was restarted.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Tue, 16 Jun 2015 13:22:09 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:14</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:14</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.43&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;5.1&lt;/em&gt; to &lt;em&gt;5.53&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
When the web server, Nginx, can't connect to the PHP processor, php-fpm, users get 502/503/504 errors, this is bad and it was an issue when the GreenQloud servers were first set up and I'm concerned that it might be an issue now, with the new servers.
&lt;/p&gt;
&lt;p&gt;
On the GreenQloud server the &lt;tt&gt;/etc/logrotate.d/nginx&lt;/tt&gt; config was amended from the default to add a check for errors each night:
&lt;/p&gt;
&lt;pre class="wiki"&gt;/var/log/nginx/*.log {
        daily
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 0640 www-data adm
        sharedscripts
        prerotate
                /usr/local/sbin/nginx-logwatch root@localhost
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                        run-parts /etc/logrotate.d/httpd-prerotate; \
                fi; \
        endscript
        postrotate
                [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
        endscript
}
&lt;/pre&gt;&lt;p&gt;
The &lt;tt&gt;/usr/local/sbin/nginx-logwatch&lt;/tt&gt; script contained:
&lt;/p&gt;
&lt;pre class="wiki"&gt;#!/bin/bash
# The log file we are checking, best run the script via logrotate,
# for example edit /etc/logrotate.d/nginx to:
#
#   prerotate
#          /usr/local/bin/nginx-logwatch chris@webarchitects.co.uk
#          if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
#                  run-parts /etc/logrotate.d/httpd-prerotate; \
#          fi \
#   endscript
LOGFILE="/var/log/nginx/crin.org.access.log"
# Optional email address to send the results to
EMAIL=$1
# check that the script is being run by root
if [[ "$(id -u)" != "0" ]] ; then
  echo "You must run $0 as root or via sudo"
  exit 2
fi
# grep for all the lines with error codes
#ERRORS=$(grep '1.[0|1]" [4|5]0[2|3|4] ' $LOGFILE)
#ERRORS=$(grep '1.[0|1]" [4|5]0[2|3|4] ' $LOGFILE)
ERRORS=$(grep '1.[0|1]" 50[2|3|4] ' $LOGFILE)
# grep for to totals for these errors codes
#ERRORS_403=$(grep -c '1.[0|1]" 403 ' $LOGFILE)
#ERRORS_404=$(grep -c '1.[0|1]" 404 ' $LOGFILE)
ERRORS_502=$(grep -c '1.[0|1]" 502 ' $LOGFILE)
ERRORS_503=$(grep -c '1.[0|1]" 503 ' $LOGFILE)
ERRORS_504=$(grep -c '1.[0|1]" 504 ' $LOGFILE)
# check to see if any errors were found
if [[ $ERRORS ]]; then
  # check for a email address
  if [[ $EMAIL ]]; then
    # name of the server
    HOSTNAME=$(hostname)
    # email subject line
    #SUBJECT="$ERRORS_403 403, $ERRORS_404 404, $ERRORS_502 502, $ERRORS_503 503 and $ERRORS_504 504 errors from $HOSTNAME"
    #SUBJECT="$ERRORS_403 403, $ERRORS_502 502, $ERRORS_503 503 and $ERRORS_504 504 errors from $HOSTNAME"
    SUBJECT="$ERRORS_502 502, $ERRORS_503 503 and $ERRORS_504 504 errors from $HOSTNAME"
    # we were supplied with a email address so send the results by email using mutt
    echo "$ERRORS" | mutt -s "$SUBJECT" $EMAIL
  # we don't have a email address so display the results of the grep
  else [[ ! $EMAIL ]]
    echo "Supply a email address on the command line to send the following results by email"
    echo ""
    #echo "Total 403 errors: $ERRORS_403"
    #echo "Total 404 errors: $ERRORS_404"
    echo "Total 502 errors: $ERRORS_502"
    echo "Total 503 errors: $ERRORS_503"
    echo "Total 504 errors: $ERRORS_504"
    echo ""
    echo "Lines with errors from $LOGFILE"
    echo ""
    echo "$ERRORS"
    echo ""
    echo "This script is best piped into a pager, eg:"
    echo "$0 | less"
  fi
else
   # we don't want any output if a email address is specified as the script is run via cron
   if [[ ! $EMAIL ]] ; then
     #echo "No recent 403, 404, 502, 503 or 504 errors were found"
     #echo "No recent 403, 502, 503 or 504 errors were found"
     echo "No recent 502, 503 or 504 errors were found"
   fi
fi
&lt;/pre&gt;&lt;p&gt;
The above script is a bit of a cludge, it only checks the HTTP access log and not the HTTPS access log for starters, so I have changed that and run it on the HTTP log and got these totals:
&lt;/p&gt;
&lt;pre class="wiki"&gt;Total 502 errors: 1351
Total 503 errors: 0
Total 504 errors: 0
&lt;/pre&gt;&lt;p&gt;
And on the HTTPS log:
&lt;/p&gt;
&lt;pre class="wiki"&gt;Total 502 errors: 793
Total 503 errors: 0
Total 504 errors: 0
&lt;/pre&gt;&lt;p&gt;
So there is clearly a problem here.
&lt;/p&gt;
&lt;p&gt;
I have posted the script to &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/NginxLogWatch"&gt;wiki:NginxLogWatch&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I have edited the &lt;tt&gt;/etc/logrotate.d/nginx&lt;/tt&gt; config file:
&lt;/p&gt;
&lt;pre class="wiki"&gt;/var/log/nginx/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 0640 www-data adm
        sharedscripts
        prerotate
                /usr/local/bin/nginx-logwatch /var/log/nginx/crin.org.ssl_access.log root@localhost
                /usr/local/bin/nginx-logwatch /var/log/nginx/crin.org.access.log root@localhost
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                        run-parts /etc/logrotate.d/httpd-prerotate; \
                fi \
        endscript
        postrotate
                invoke-rc.d nginx rotate &amp;gt;/dev/null 2&amp;gt;&amp;amp;1
        endscript
}
&lt;/pre&gt;&lt;p&gt;
So now we should get a two daily emails with the totals and this should help track down the issue.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Wed, 17 Jun 2015 10:32:23 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:15</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:15</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.32&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;5.53&lt;/em&gt; to &lt;em&gt;5.85&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Replying to &lt;a class="ticket" href="https://trac.crin.org/trac/ticket/9#comment:14" title="Comment 14"&gt;chris&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
So now we should get a two daily emails with the totals and this should help track down the issue.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
Yesterday I missed that the logrotation is set to happen weekly, so I have edited &lt;tt&gt;/etc/logrotate.d/nginx&lt;/tt&gt; and changed &lt;tt&gt;weekly&lt;/tt&gt; to &lt;tt&gt;daily&lt;/tt&gt;.
&lt;/p&gt;
&lt;p&gt;
Checking on the 50x errors since yesterday:
&lt;/p&gt;
&lt;pre class="wiki"&gt;/usr/local/bin/nginx-logwatch /var/log/nginx/crin.org.access.log | less
Total 502 errors: 1522
Total 503 errors: 0
Total 504 errors: 0
&lt;/pre&gt;&lt;p&gt;
The last error was at 16/Jun/2015:14:18:25.
&lt;/p&gt;
&lt;pre class="wiki"&gt;/usr/local/bin/nginx-logwatch /var/log/nginx/crin.org.ssl_access.log | less
Total 502 errors: 816
Total 503 errors: 0
Total 504 errors: 0
&lt;/pre&gt;&lt;p&gt;
The last error was at 16/Jun/2015:14:18:17.
&lt;/p&gt;
&lt;p&gt;
So this problem looks like it has already been solved.
&lt;/p&gt;
&lt;p&gt;
Checking on the &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/Crin1"&gt;Crin1&lt;/a&gt; MySQL stats:
&lt;/p&gt;
&lt;pre class="wiki"&gt;mysqltuner
 &amp;gt;&amp;gt;  MySQLTuner 1.3.0 - Major Hayden &amp;lt;major@mhtx.net&amp;gt;
 &amp;gt;&amp;gt;  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 &amp;gt;&amp;gt;  Run with '--help' for additional options and output filtering
[OK] Logged in using credentials from debian maintenance account.
[OK] Currently running supported MySQL version 5.5.43-0+deb8u1
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in InnoDB tables: 839M (Tables: 512)
[--] Data in MEMORY tables: 0B (Tables: 1)
[--] Data in MyISAM tables: 1G (Tables: 79)
[!!] Total fragmented tables: 524
-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 21h 32m 44s (10M q [140.211 qps], 74K conn, TX: 124B, RX: 3B)
[--] Reads / Writes: 88% / 12%
[--] Total buffers: 1.1G global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 1.5G (38% of installed RAM)
[OK] Slow queries: 0% (39/10M)
[OK] Highest usage of available connections: 35% (53/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/241.7M
[OK] Key buffer hit rate: 99.9% (1B cached / 1M reads)
[OK] Query cache efficiency: 91.7% (9M cached / 10M selects)
[!!] Query cache prunes per day: 510672
[OK] Sorts requiring temporary tables: 0% (1K temp sorts / 276K sorts)
[OK] Temporary tables created on disk: 4% (4K on disk / 99K total)
[OK] Thread cache hit rate: 97% (1K created / 74K connections)
[!!] Table cache hit rate: 2% (400 open / 17K opened)
[OK] Open file limit used: 14% (153/1K)
[OK] Table locks acquired immediately: 99% (1M immediate / 1M locks)
[OK] InnoDB buffer pool / data size: 1.0G/839.8M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Enable the slow query log to troubleshoot bad queries
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
    query_cache_size (&amp;gt; 64M)
    table_open_cache (&amp;gt; 400)
&lt;/pre&gt;&lt;p&gt;
I have read the document at &lt;a class="ext-link" href="http://bit.ly/1mi7c4C"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;http://bit.ly/1mi7c4C&lt;/a&gt; and note that the MySQL databases have a total of 609 tables so I have doubled the &lt;tt&gt;table_open_cache&lt;/tt&gt; from the default of 400 and also increased the &lt;tt&gt;query_cache_size&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;table_open_cache        = 800
query_cache_size        = 128M
&lt;/pre&gt;&lt;p&gt;
And that might be good enough, in the last 21 hours there have been 10 million MySQL queries and 39 of them were slow, the default value for slow is over 1 second. The slow and long log has also been uncommented so we can check what these are if needs be:
&lt;/p&gt;
&lt;pre class="wiki"&gt;slow_query_log_file = /var/log/mysql/mysql-slow.log
slow_query_log      = 1
long_query_time = 2
log_queries_not_using_indexes
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Wed, 17 Jun 2015 10:58:32 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;phpinfo.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Wed, 17 Jun 2015 11:28:19 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:16</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:16</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.5&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;5.85&lt;/em&gt; to &lt;em&gt;6.35&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
I have realised why I couldn't get APC to work (it was removed yesterday, see &lt;a class="closed ticket" href="https://trac.crin.org/trac/ticket/9#comment:12" title="task: Monitor and adjust server settings after Crin1 and Crin2 server go live (closed: fixed)"&gt;ticket:9#comment:12&lt;/a&gt;) -- it is because PHP 5.5 comes with Zend Opcache:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
Because OPcache is designed to replace the APC module, it is not possible to run them in parallel in PHP.
&lt;/p&gt;
&lt;p&gt;
&lt;a class="ext-link" href="https://stackoverflow.com/a/17224811"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;https://stackoverflow.com/a/17224811&lt;/a&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
These were the Zend OPcache default settings:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/phpinfo.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/phpinfo.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
And these values were changed in &lt;tt&gt;/etc/php5/fpm/php.ini&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;;opcache.enable=0
opcache.enable=1
;opcache.memory_consumption=64
opcache.memory_consumption=256
;opcache.interned_strings_buffer=4
opcache.interned_strings_buffer=12
;opcache.max_accelerated_files=2000
opcache.max_accelerated_files=10000
opcache.validate_timestamps=1
;opcache.revalidate_freq=2
opcache.revalidate_freq=240
;opcache.error_log=
opcache.error_log=/var/log/php5-opcache.log
&lt;/pre&gt;&lt;p&gt;
Create logfile and restart:
&lt;/p&gt;
&lt;pre class="wiki"&gt;touch /var/log/php5-opcache.log
chown www-data:www-data /var/log/php5-opcache.log
service php5-fpm restart
&lt;/pre&gt;&lt;p&gt;
In order to get some Munin stats for opcache, &lt;a class="ext-link" href="https://github.com/unreal4u/munin_opcache"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;this plugin&lt;/a&gt; was installed:
&lt;/p&gt;
&lt;pre class="wiki"&gt;wget https://github.com/unreal4u/munin_opcache/archive/master.zip -O munin_opcache.zip
unzip munin_opcache.zip
cp munin_opcache-master/src/scripts/*.php /var/www/localhost/
cp munin_opcache-master/src/plugins/* /usr/local/share/munin/plugins/
cd /etc/munin/plugins/
ln -s /usr/local/share/munin/plugins/php_opcache_memoryusage
ln -s /usr/local/share/munin/plugins/php_opcache_restarts
&lt;/pre&gt;&lt;p&gt;
Nigix config added to &lt;tt&gt;/etc/nginx/sites-available/localhost&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;        location ~ /munin_opcache\.php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
                include fastcgi_params;
                access_log off;
                allow 127.0.0.1;
                deny all;
        }
        location ~ /opc\.php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
                include fastcgi_params;
                access_log off;
                allow 127.0.0.1;
                deny all;
        }
&lt;/pre&gt;&lt;p&gt;
Munin config added to &lt;tt&gt;/etc/munin/plugin-conf.d/munin-node&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;[php_opcache_*]
env.URL http://localhost/munin_opcache.php
&lt;/pre&gt;&lt;p&gt;
Restart Nginx and munin-node and test the munin plugins on the command line:
&lt;/p&gt;
&lt;pre class="wiki"&gt;cd /etc/munin/plugins
munin-run php_opcache_memoryusage
mem_used.value 49809568
mem_free.value 218625888
mem_wasted.value 0
oom_restarts.value 0
hash_restarts.value 0
manual_restarts.value 0
in-run php_opcache_memoryusage
mem_used.value 49809568
mem_free.value 218625888
mem_wasted.value 0
oom_restarts.value 0
hash_restarts.value 0
manual_restarts.value 0
&lt;/pre&gt;&lt;p&gt;
So in a while we should get some opcache munin stats and with compiled php being cached for 5 mins the site should be faster.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Wed, 17 Jun 2015 12:54:18 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;Opcache.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Wed, 17 Jun 2015 13:07:26 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:17</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:17</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;1.1&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;6.35&lt;/em&gt; to &lt;em&gt;7.45&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Reading &lt;a class="ext-link" href="https://jpauli.github.io/2015/03/05/opcache.html"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;this document on opcache&lt;/a&gt; and checking the status:
&lt;/p&gt;
&lt;pre class="wiki"&gt;lynx -dump http://localhost/opc.php | less
   memory
   256M
       207M 81% free
       49M  18% used
       0        wasted
   keys
   16K
      15K 96% free
      565 3%  scripts
      17      wasted
   hits
   759K
       759K 99% hits
       634      misses
       0        blacklist
   restarts
   0
    0 manual
    0 keys
    0 memory
general
   Host            crin2.crin.org
   PHP Version     PHP 5.6.9-0+deb8u1 fpm-fcgi Linux
   Opcache Version Zend OPcache 7.0.4-dev
   Opcode Caching      Up and Running
   Optimization        Enabled
   Startup             OK
   Shared memory model mmap
   Uptime 49 minutes and 20 seconds
memory
   Used Memory               48.5M
   Free Memory               207.5M
   Wasted Memory             0
   Current Wasted Percentage 0
statistics
   Num Cached Scripts   565
   Num Cached Keys      582
   Max Cached Keys      16229
   Hits                 758616
   Oom Restarts         0
   Hash Restarts        0
   Manual Restarts      0
   Misses               634
   Blacklist Misses     0
   Blacklist Miss Ratio 0
   Opcache Hit Rate     99.9
&lt;/pre&gt;&lt;p&gt;
The amount of memory allocated to opcache can be reduced by the looks of it (49M is used, 18%) and as long as php-fpm is restarted after any new code is deployed the file date checks can also be turned off, so these variables in &lt;tt&gt;/etc/php5/fpm/php.ini&lt;/tt&gt; were changed:
&lt;/p&gt;
&lt;pre class="wiki"&gt;;opcache.memory_consumption=256
opcache.memory_consumption=96
;opcache.interned_strings_buffer=12
opcache.interned_strings_buffer=8
;opcache.max_accelerated_files=10000
opcache.max_accelerated_files=2000
;opcache.validate_timestamps=1
opcache.validate_timestamps=0
;opcache.save_comments=1
opcache.save_comments=0
;opcache.log_verbosity_level=1
opcache.log_verbosity_level=3
&lt;/pre&gt;&lt;p&gt;
After a restart it now looks like this:
&lt;/p&gt;
&lt;pre class="wiki"&gt;lynx -dump http://localhost/opc.php | less
   memory
   96M
      58M 60% free
      38M 39% used
      0       wasted
   keys
   3907
       3370 86% free
       520  13% scripts
       17       wasted
   hits
   148K
       148K 99% hits
       568      misses
       0        blacklist
   restarts
   0
    0 manual
    0 keys
    0 memory
general
   Host            crin2.crin.org
   PHP Version     PHP 5.6.9-0+deb8u1 fpm-fcgi Linux
   Opcache Version Zend OPcache 7.0.4-dev
   Opcode Caching      Up and Running
   Optimization        Enabled
   Startup             OK
   Shared memory model mmap
   Uptime 9 minutes and 34 seconds
memory
   Used Memory               37.7M
   Free Memory               58.3M
   Wasted Memory             0
   Current Wasted Percentage 0
statistics
   Num Cached Scripts   520
   Num Cached Keys      537
   Max Cached Keys      3907
   Hits                 147750
   Oom Restarts         0
   Hash Restarts        0
   Manual Restarts      0
   Misses               568
   Blacklist Misses     0
   Blacklist Miss Ratio 0
   Opcache Hit Rate     99.6
&lt;/pre&gt;&lt;p&gt;
You can also get a graphical version of the above via a ssh tunnel to the server.
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/Opcache.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/Opcache.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The files stats are also interesting, you can sort files by size, hits and last acceess time.
&lt;/p&gt;
&lt;p&gt;
I don't think there is much more that can be done to optimise this for now, the sites still doesn't seem that fast, testing with &lt;a class="ext-link" href="http://tools.pingdom.com/fpt/"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;http://tools.pingdom.com/fpt/&lt;/a&gt; it is still taking 4-5 seconds for the front page to load which isn't ideal.
&lt;/p&gt;
&lt;p&gt;
But I can't think of any else to tweak for now, it would be worth checking how things look in a few days.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Wed, 17 Jun 2015 13:18:44 GMT</pubDate>
      <title></title>
      <link>https://trac.crin.org/trac/ticket/9#comment:18</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:18</guid>
      <description>
        &lt;p&gt;
It is perhaps worth noting that the front page loads:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;37 images
&lt;/li&gt;&lt;li&gt;32 style sheets
&lt;/li&gt;&lt;li&gt;14 Javascript files
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
A lot of the Javascript files and CSS files could potentially be compressed into a small number using a Drupal modules such as &lt;a class="ext-link" href="https://www.drupal.org/project/minify"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;Minify&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The total size of the front page is 2MB and 91 files are served to generate it.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Wed, 17 Jun 2015 16:12:47 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:19</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:19</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.37&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;7.45&lt;/em&gt; to &lt;em&gt;7.82&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Looking at the &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin1.crin.org/mysql_qcache_mem.html"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;MySQL query cache&lt;/a&gt; and also the &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin1.crin.org/mysql_slow.html"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;slow query log&lt;/a&gt; graph and the &lt;tt&gt;/var/log/mysql/mysql-slow.log&lt;/tt&gt; a selection of the slow queries (ones over 2 seconds):
&lt;/p&gt;
&lt;pre class="wiki"&gt;SELECT * FROM languages ORDER BY weight ASC, name ASC;
# Time: 150617 10:28:30
# User@Host: drupal[drupal] @ crin2 [93.95.228.180]
# Query_time: 2.122526  Lock_time: 0.000098 Rows_sent: 1  Rows_examined: 1
SELECT domain_id, alias_id, pattern, redirect FROM domain_alias;
# Time: 150617 10:28:31
# User@Host: drupal[drupal] @ crin2 [93.95.228.180]
# Query_time: 2.031516  Lock_time: 0.000051 Rows_sent: 1  Rows_examined: 1
SELECT 1 FROM quicktabs LIMIT 0, 1;
# User@Host: drupal[drupal] @ crin2 [93.95.228.180]
# Query_time: 2.950658  Lock_time: 0.000179 Rows_sent: 1  Rows_examined: 1
SELECT p.language, p.path FROM i18n_path p INNER JOIN i18n_path ps ON p.tsid = ps.tsid WHERE ps.path = 'taxonomy/term/226';
# Time: 150617 10:28:44
# User@Host: drupal[drupal] @ crin2 [93.95.228.180]
# Query_time: 2.614113  Lock_time: 0.000036 Rows_sent: 1  Rows_examined: 1
SET timestamp=1434536940;
SELECT node.title AS node_title, node.nid AS nid, node.language AS node_language, menu_links.weight AS menu_links_weight, node.created AS node_created, 'menu_children:block' AS view_name
FROM
node node
LEFT JOIN menu_node menu_node ON node.nid = menu_node.nid
LEFT JOIN menu_links menu_links ON menu_node.mlid = menu_links.mlid
WHERE (( (menu_links.plid = '2944' ) )AND(( (node.status = '1') )))AND ( EXISTS  (SELECT na.nid AS nid
FROM
node_access na
WHERE (( (na.gid = '0') AND (na.realm = 'all') )OR( (na.gid = '0') AND (na.realm = 'domain_site') )OR( (na.gid = '1') AND (na.realm = 'domain_id') ))AND (na.grant_view &amp;gt;= '1') AND (node.nid = na.nid) ))
ORDER BY menu_links_weight ASC, node_created DESC;
# User@Host: drupal[drupal] @ crin2 [93.95.228.180]
# Query_time: 3.420401  Lock_time: 0.000049 Rows_sent: 1  Rows_examined: 1
SELECT node.title AS node_title, node.nid AS nid, node.language AS node_language, menu_links.weight AS menu_links_weight, node.created AS node_created, 'menu_children:block' AS view_name
FROM
node node
LEFT JOIN menu_node menu_node ON node.nid = menu_node.nid
LEFT JOIN menu_links menu_links ON menu_node.mlid = menu_links.mlid
WHERE (( (menu_links.plid = '3355' ) )AND(( (node.status = '1') )))AND ( EXISTS  (SELECT na.nid AS nid
FROM
node_access na
WHERE (( (na.gid = '0') AND (na.realm = 'all') )OR( (na.gid = '0') AND (na.realm = 'domain_site') )OR( (na.gid = '1') AND (na.realm = 'domain_id') ))AND (na.grant_view &amp;gt;= '1') AND (node.nid = na.nid) ))
ORDER BY menu_links_weight ASC, node_created DESC;
# Time: 150617 10:29:10
# User@Host: drupal[drupal] @ crin2 [93.95.228.180]
# Query_time: 2.497067  Lock_time: 0.000052 Rows_sent: 1  Rows_examined: 1
SELECT p.language, p.path FROM i18n_path p INNER JOIN i18n_path ps ON p.tsid = ps.tsid WHERE ps.path = 'library/organisations/news/695';
# User@Host: drupal[drupal] @ crin2 [93.95.228.180]
# Query_time: 3.127029  Lock_time: 0.000058 Rows_sent: 1  Rows_examined: 1
SELECT cid, data, created, expire, serialized FROM cache_bootstrap WHERE cid IN ('variables');
# Time: 150617 10:29:51
# User@Host: drupal[drupal] @ crin2 [93.95.228.180]
# Query_time: 2.688887  Lock_time: 0.000033 Rows_sent: 1  Rows_examined: 1
SET timestamp=1434536992;
SELECT p.language, p.path FROM i18n_path p INNER JOIN i18n_path ps ON p.tsid = ps.tsid WHERE ps.path = 'node/6797';
# User@Host: drupal[drupal] @ crin2 [93.95.228.180]
# Query_time: 3.167818  Lock_time: 0.000051 Rows_sent: 1  Rows_examined: 1
&lt;/pre&gt;&lt;p&gt;
Checking for numbers of slow queries by time:
&lt;/p&gt;
&lt;pre class="wiki"&gt;grep "Query_time: 1\." /var/log/mysql/mysql-slow.log | wc -l
91
grep "Query_time: 2\." /var/log/mysql/mysql-slow.log | wc -l
6780
grep "Query_time: 3\." /var/log/mysql/mysql-slow.log | wc -l
3113
grep "Query_time: 4\." /var/log/mysql/mysql-slow.log | wc -l
1399
grep "Query_time: 5\." /var/log/mysql/mysql-slow.log | wc -l
697
grep "Query_time: 6\." /var/log/mysql/mysql-slow.log | wc -l
432
grep "Query_time: 7\." /var/log/mysql/mysql-slow.log | wc -l
278
grep "Query_time: 8\." /var/log/mysql/mysql-slow.log | wc -l
232
grep "Query_time: 9\." /var/log/mysql/mysql-slow.log | wc -l
161
grep "Query_time: 10\." /var/log/mysql/mysql-slow.log | wc -l
116
grep "Query_time: 11\." /var/log/mysql/mysql-slow.log | wc -l
95
grep "Query_time: 12\." /var/log/mysql/mysql-slow.log | wc -l
82
grep "Query_time: 13\." /var/log/mysql/mysql-slow.log | wc -l
55
grep "Query_time: 14\." /var/log/mysql/mysql-slow.log | wc -l
52
grep "Query_time: 15\." /var/log/mysql/mysql-slow.log | wc -l
22
grep "Query_time: 16\." /var/log/mysql/mysql-slow.log | wc -l
31
grep "Query_time: 1[0-9]\." /var/log/mysql/mysql-slow.log | wc -l
489
grep "Query_time: 2[0-9]\." /var/log/mysql/mysql-slow.log | wc -l
15
grep "Query_time: 3[0-9]\." /var/log/mysql/mysql-slow.log | wc -l
0
grep "Query_time: [0-9]\." /var/log/mysql/mysql-slow.log | wc -l
28274
grep "Query_time: [2-9]\." /var/log/mysql/mysql-slow.log | wc -l
13297
grep "Query_time: 0\." /var/log/mysql/mysql-slow.log | wc -l
14933
&lt;/pre&gt;&lt;p&gt;
So the above shows that since the slowlog was enabled there have been 15 queries that took over 20 seconds but less than 30 (none took 30 or more seconds), alomst 500 queries took between 10 and 20 seconds, 13k queries took between 2 and 9 seconds, so based on this and the mysqltuner report:
&lt;/p&gt;
&lt;pre class="wiki"&gt;mysqltuner
 &amp;gt;&amp;gt;  MySQLTuner 1.3.0 - Major Hayden &amp;lt;major@mhtx.net&amp;gt;
 &amp;gt;&amp;gt;  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 &amp;gt;&amp;gt;  Run with '--help' for additional options and output filtering
[OK] Logged in using credentials from debian maintenance account.
[OK] Currently running supported MySQL version 5.5.43-0+deb8u1-log
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MEMORY tables: 0B (Tables: 1)
[--] Data in MyISAM tables: 1G (Tables: 79)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in InnoDB tables: 839M (Tables: 512)
[!!] Total fragmented tables: 524
-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 5h 37m 48s (3M q [191.998 qps], 26K conn, TX: 46B, RX: 1B)
[--] Reads / Writes: 85% / 15%
[--] Total buffers: 1.2G global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 1.6G (40% of installed RAM)
[OK] Slow queries: 0% (28K/3M)
[OK] Highest usage of available connections: 33% (51/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/241.8M
[OK] Key buffer hit rate: 99.9% (387M cached / 483K reads)
[OK] Query cache efficiency: 91.8% (3M cached / 3M selects)
[!!] Query cache prunes per day: 136416
[OK] Sorts requiring temporary tables: 0% (491 temp sorts / 98K sorts)
[OK] Temporary tables created on disk: 1% (803 on disk / 44K total)
[OK] Thread cache hit rate: 94% (1K created / 26K connections)
[OK] Table cache hit rate: 30% (800 open / 2K opened)
[OK] Open file limit used: 18% (317/1K)
[OK] Table locks acquired immediately: 99% (444K immediate / 444K locks)
[OK] InnoDB buffer pool / data size: 1.0G/839.8M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
Variables to adjust:
    query_cache_size (&amp;gt; 128M)
mysqltuner
 &amp;gt;&amp;gt;  MySQLTuner 1.3.0 - Major Hayden &amp;lt;major@mhtx.net&amp;gt;
 &amp;gt;&amp;gt;  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 &amp;gt;&amp;gt;  Run with '--help' for additional options and output filtering
[OK] Logged in using credentials from debian maintenance account.
[OK] Currently running supported MySQL version 5.5.43-0+deb8u1-log
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MEMORY tables: 0B (Tables: 1)
[--] Data in MyISAM tables: 1G (Tables: 79)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in InnoDB tables: 839M (Tables: 512)
[!!] Total fragmented tables: 524
-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 5h 37m 48s (3M q [191.998 qps], 26K conn, TX: 46B, RX: 1B)
[--] Reads / Writes: 85% / 15%
[--] Total buffers: 1.2G global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 1.6G (40% of installed RAM)
[OK] Slow queries: 0% (28K/3M)
[OK] Highest usage of available connections: 33% (51/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/241.8M
[OK] Key buffer hit rate: 99.9% (387M cached / 483K reads)
[OK] Query cache efficiency: 91.8% (3M cached / 3M selects)
[!!] Query cache prunes per day: 136416
[OK] Sorts requiring temporary tables: 0% (491 temp sorts / 98K sorts)
[OK] Temporary tables created on disk: 1% (803 on disk / 44K total)
[OK] Thread cache hit rate: 94% (1K created / 26K connections)
[OK] Table cache hit rate: 30% (800 open / 2K opened)
[OK] Open file limit used: 18% (317/1K)
[OK] Table locks acquired immediately: 99% (444K immediate / 444K locks)
[OK] InnoDB buffer pool / data size: 1.0G/839.8M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
Variables to adjust:
    query_cache_size (&amp;gt; 128M)
&lt;/pre&gt;&lt;p&gt;
These variables in &lt;tt&gt;/etc/mysql/my.cnf&lt;/tt&gt; were edited:
&lt;/p&gt;
&lt;pre class="wiki"&gt;#query_cache_size        = 128M
query_cache_size        = 256M
#log_queries_not_using_indexes
&lt;/pre&gt;&lt;p&gt;
This will result in only things that take more than two seconds being logged and queries not using indexes won't be logged.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 09:53:58 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;mysql_qcache_mem-day-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 09:54:13 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;mysql_slow-day-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 09:56:05 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;multips_memory-day-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 10:03:40 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:20</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:20</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.2&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;7.82&lt;/em&gt; to &lt;em&gt;8.02&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Looking at the &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin1.crin.org/index.html#mysql2"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;MySQL Munin graphs&lt;/a&gt;, the query cache hit it's limit in the early hours:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/mysql_qcache_mem-day-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/mysql_qcache_mem-day-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
And there also appears to be a correlation between the number of slow queries and the size of the query cache:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/mysql_slow-day-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/mysql_slow-day-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Also note that the increased in the query cache size haven't made a significant impact on the overall MySQL memory footprint:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/multips_memory-day-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/multips_memory-day-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
So I think it would make sense to double the size of the query cache again.
&lt;/p&gt;
&lt;p&gt;
The latest output from &lt;tt&gt;mysqltuner&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt; &amp;gt;&amp;gt;  MySQLTuner 1.3.0 - Major Hayden &amp;lt;major@mhtx.net&amp;gt;
 &amp;gt;&amp;gt;  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 &amp;gt;&amp;gt;  Run with '--help' for additional options and output filtering
[OK] Logged in using credentials from debian maintenance account.
[OK] Currently running supported MySQL version 5.5.43-0+deb8u1-log
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in InnoDB tables: 821M (Tables: 512)
[--] Data in MyISAM tables: 1G (Tables: 79)
[--] Data in MEMORY tables: 0B (Tables: 1)
[!!] Total fragmented tables: 534
-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 17h 47m 5s (6M q [104.288 qps], 50K conn, TX: 86B, RX: 2B)
[--] Reads / Writes: 70% / 30%
[--] Total buffers: 1.3G global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 1.7G (43% of installed RAM)
[OK] Slow queries: 0% (25K/6M)
[OK] Highest usage of available connections: 31% (47/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/241.8M
[OK] Key buffer hit rate: 99.8% (339M cached / 712K reads)
[OK] Query cache efficiency: 92.0% (5M cached / 6M selects)
[!!] Query cache prunes per day: 81274
[OK] Sorts requiring temporary tables: 0% (683 temp sorts / 110K sorts)
[OK] Temporary tables created on disk: 6% (4K on disk / 69K total)
[OK] Thread cache hit rate: 98% (781 created / 50K connections)
[!!] Table cache hit rate: 18% (800 open / 4K opened)
[OK] Open file limit used: 11% (198/1K)
[OK] Table locks acquired immediately: 99% (839K immediate / 840K locks)
[OK] InnoDB buffer pool / data size: 1.0G/821.4M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Increasing the query_cache size over 128M may reduce performance
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
    query_cache_size (&amp;gt; 256M) [see warning above]
    table_open_cache (&amp;gt; 800)
&lt;/pre&gt;&lt;p&gt;
This setting in &lt;tt&gt;/etc/mysql/my.cnf&lt;/tt&gt; has been changed and MySQL has been restarted:
&lt;/p&gt;
&lt;pre class="wiki"&gt;#query_cache_size        = 256M
query_cache_size        = 512M
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 10:07:44 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;memcached_counters-day-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 10:08:34 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;memcached_counters-week-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 10:15:42 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;php_opcache_memoryusage-day-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 10:25:07 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;phpfpm_processes-day-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 10:25:19 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;phpfpm_status-day-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 10:28:26 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;crin2-multips_memory-day-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 10:36:09 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;phpfpm_average-week-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 11:19:41 GMT</pubDate>
      <title>attachment set</title>
      <link>https://trac.crin.org/trac/ticket/9</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;attachment&lt;/strong&gt;
                set to &lt;em&gt;phpfpm_memory-day-2015-06-18.png&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 11:25:21 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:21</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:21</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;1&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;8.02&lt;/em&gt; to &lt;em&gt;9.02&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
In comments above I was under the impression that &lt;tt&gt;memcache&lt;/tt&gt; Munin units, KiB, were kilobits but looking at the &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin2.crin.org/multips_memory.html"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;memory usage&lt;/a&gt; it is clear they are kilobytes.
&lt;/p&gt;
&lt;p&gt;
The &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin2.crin.org/index.html"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;Munin stats&lt;/a&gt; for &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/Crin2"&gt;Crin2&lt;/a&gt;, &lt;tt&gt;memcache&lt;/tt&gt; has switched to caching items smaller that a kilobyte -- the bytes allocated is now smaller than the number of items in cache.
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/memcached_counters-week-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/memcached_counters-week-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The current memory usage, 220k kilobytes is almost 215M, which makes the current setting in &lt;tt&gt;/etc/memcached.conf&lt;/tt&gt; look reasonable:
&lt;/p&gt;
&lt;pre class="wiki"&gt;# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
# Note that the daemon will grow to this size, but does not start out holding this much
# memory
#-m 64
-m 512
&lt;/pre&gt;&lt;p&gt;
As it says above &lt;tt&gt;memcache&lt;/tt&gt; doesn't allocate the max memory to start with, unlike Zend OPcache which does, so it's probably fine to leave it as it is (allowed to use twice as much RAM as it is at the moment), in addition we should do our best to avoid memcache restarts and these will have a significant negative impact on the speed of the website.
&lt;/p&gt;
&lt;p&gt;
Looking at the &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin2.crin.org/php_opcache_memoryusage.html"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;Zend OPcache Munin graph&lt;/a&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/php_opcache_memoryusage-day-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/php_opcache_memoryusage-day-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The current setting seem fine, 48M of compiled PHP looks like the size of the site code, the only thing that perhaps might make a difference is switching from &lt;tt&gt;mmap&lt;/tt&gt; memory  to using &lt;tt&gt;shm&lt;/tt&gt; (shm is RAM, but mmap probably also results in RAM being used):
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
&lt;strong&gt;opcache.preferred_memory_model&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The preferred memory model for OPcache to use. If left empty, OPcache will choose the most appropriate model, which is the correct behaviour in virtually all cases. Possible values include mmap, shm, posix and win32.
&lt;/p&gt;
&lt;p&gt;
&lt;a class="ext-link" href="http://files.zend.com/help/Zend-Server/content/zendserverapi/zend_opcache-configuration_directives.htm#dir-opcache.preferred_memory_model"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;http://files.zend.com/help/Zend-Server/content/zendserverapi/zend_opcache-configuration_directives.htm#dir-opcache.preferred_memory_model&lt;/a&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
Looking at the &lt;a class="ext-link" href="https://munin.crin.org/munin/crin.org/crin2.crin.org/index.html#php"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;php-fpm memory usage&lt;/a&gt;, it has hit 2.8G in the last 24 hours, at peak:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/phpfpm_memory-day-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/phpfpm_memory-day-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
And at this peak there were 40 php-fpm processes:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/phpfpm_processes-day-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/phpfpm_processes-day-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/phpfpm_status-day-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/phpfpm_status-day-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
However given that php-fpm is the only thing on &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/Crin2"&gt;Crin2&lt;/a&gt; that uses a significant amount of memory I don't think this is a problem:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/crin2-multips_memory-day-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/crin2-multips_memory-day-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Note that the php-fpm process size is steady:
&lt;/p&gt;
&lt;p&gt;
&lt;a style="padding:0; border:none" href="https://trac.crin.org/trac/attachment/ticket/9/phpfpm_average-week-2015-06-18.png"&gt;&lt;img src="https://trac.crin.org/trac/raw-attachment/ticket/9/phpfpm_average-week-2015-06-18.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
It looks like it would be worth increasing the minimum number of php-fpm processes from the current settings in &lt;tt&gt;/etc/php5/fpm/pool.d/www.conf&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
;pm.max_children = 5
pm.max_children = 50
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
;pm.start_servers = 2
pm.start_servers = 3
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
;pm.min_spare_servers = 1
pm.min_spare_servers = 2
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
;pm.max_spare_servers = 3
pm.max_spare_servers = 6
&lt;/pre&gt;&lt;p&gt;
Given that spawing new process' will have a time cost, and the &lt;tt&gt;/var/log/php5-fpm.log&lt;/tt&gt; contains a lot of entries like this:
&lt;/p&gt;
&lt;pre class="wiki"&gt;[18-Jun-2015 09:00:29] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 1 idle, and 19 total children
[18-Jun-2015 09:00:30] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 20 total children
[18-Jun-2015 09:00:31] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 22 total children
[18-Jun-2015 09:00:32] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 24 total children
[18-Jun-2015 09:00:33] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 26 total children
[18-Jun-2015 09:00:34] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 28 total children
[18-Jun-2015 09:00:35] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 30 total children
[18-Jun-2015 09:20:31] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 14 total children
[18-Jun-2015 09:20:32] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 16 total children
[18-Jun-2015 09:20:33] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 1 idle, and 18 total children
[18-Jun-2015 09:20:34] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 1 idle, and 19 total children
[18-Jun-2015 09:45:31] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 1 idle, and 12 total children
[18-Jun-2015 10:12:06] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 1 idle, and 15 total children
&lt;/pre&gt;&lt;p&gt;
So &lt;tt&gt;/etc/php5/fpm/pool.d/www.conf&lt;/tt&gt; has been edited to change:
&lt;/p&gt;
&lt;pre class="wiki"&gt;;pm.start_servers = 3
pm.start_servers = 9
;pm.min_spare_servers = 2
pm.min_spare_servers = 6
;pm.max_spare_servers = 6
pm.max_spare_servers = 18
&lt;/pre&gt;&lt;p&gt;
And &lt;tt&gt;php5-fpm&lt;/tt&gt; has been restarted, not this will also cause the Zend OPcache to be flushed so we need to try to avoid doing this too often.
&lt;/p&gt;
&lt;p&gt;
Looking at the Nginx logs, there have been no 502 errors since 6:26 GMT this morning for HTTPS connections and 4 for HTTP connections:
&lt;/p&gt;
&lt;pre class="wiki"&gt;Total 502 errors: 4
Total 503 errors: 0
Total 504 errors: 0
Lines with errors from /var/log/nginx/crin.org.access.log
XX.XX.XX.XX - - [18/Jun/2015:11:04:56 +0000] "GET /en/library/publications/unaids-2008-report-global-aids-epidemic HTTP/1.1" 502 172 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
XX.XX.XX.XX - - [18/Jun/2015:11:04:56 +0000] "GET /resources/news/xml01.asp?pageID=1010&amp;amp;FeedTitle=CRIN+News+Feed+-+Resources%20-%20CRC%20Documentation HTTP/1.1" 502 574 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; .NET4.0E; Microsoft Outlook 14.0.7143; ms-office; MSOffice 14)"
XX.XX.XX.XX - - [18/Jun/2015:11:04:56 +0000] "GET /en/email/crinmail_detail.asp?crinmailID=2594 HTTP/1.1" 502 172 "-" "Mozilla/5.0 (compatible; DotBot/1.1; http://www.opensiteexplorer.org/dotbot, help@moz.com)"
XX.XX.XX.XX - - [18/Jun/2015:11:04:56 +0000] "GET /en/resources/news/xml01.asp?pageID=1016&amp;amp;FeedTitle=CRIN%20News%20Feed%20-%20For%20Children&amp;amp;destination=resources/news/xml01.asp&amp;amp;qt-countr-tabs=2#qt-countr-tabs HTTP/1.1" 502 172 "http://www.crin.org/en/resources/news/xml01.asp?pageID=1016&amp;amp;FeedTitle=CRIN%20News%20Feed%20-%20For%20Children&amp;amp;destination=resources/news/xml01.asp&amp;amp;qt-countr-tabs=2#qt-countr-tabs" "Alltop/1.1"
&lt;/pre&gt;&lt;p&gt;
The first one was bingbot requesting &lt;a class="ext-link" href="https://www.crin.org/en/library/publications/unaids-2008-report-global-aids-epidemic"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;this page&lt;/a&gt; and the other 3 were all for old &lt;tt&gt;.asp&lt;/tt&gt; URLs.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 11:51:59 GMT</pubDate>
      <title>cc, hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:22</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:22</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;cc&lt;/strong&gt;
              &lt;em&gt;jenny&lt;/em&gt; &lt;em&gt;gillian&lt;/em&gt; added; &lt;em&gt;jonas&lt;/em&gt; removed
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.05&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;9.02&lt;/em&gt; to &lt;em&gt;9.07&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Very sorry I have only just noticed that Jonas and not Jenny and Gillian were CCs for this ticket, that has now been changed.
&lt;/p&gt;
&lt;p&gt;
Also I'm afraid 9 hours has been spent on this ticket so far rather than the estimated 4 hours, but the site is still slower than it was at GreenQloud -- I haven't got to the bottom of the performance problem.
&lt;/p&gt;
&lt;p&gt;
Checking the sites using the &lt;a class="ext-link" href="http://tools.pingdom.com/fpt/"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;Pingdom Full Page Test&lt;/a&gt; the main issues I can see are:
&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;The front page, &lt;tt&gt;index.php&lt;/tt&gt; at &lt;a class="ext-link" href="https://www.crin.org/"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;https://www.crin.org/&lt;/a&gt; seems to generally take between 4 and 5 seconds to generate, this is really slow, I don't know why it is so slow.
&lt;/li&gt;&lt;li&gt;The number of CSS and Javascript files (32 and 14) could be dramatically reduced through the use of a plugin such as &lt;a class="ext-link" href="https://www.drupal.org/project/minify"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;Minify&lt;/a&gt;.
&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;
I don't, at the moment, know what can be done about 1., 2. is a Drupal issue.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 18 Jun 2015 20:04:06 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:23</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:23</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.15&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;9.07&lt;/em&gt; to &lt;em&gt;9.22&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
I saw this error in the &lt;a class="ext-link" href="https://www.crin.org/en/admin/reports/dblog"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;dblog&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
Type                backup_migrate
Message        Could not complete the backup because the script timed out. Try increasing your PHP max_execution_time setting.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
So these settings were edited in &lt;tt&gt;/etc/php5/fpm/php.ini&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;;max_execution_time = 30
max_execution_time = 240
;max_input_time = 60
max_input_time = 120
;default_socket_timeout = 60
default_socket_timeout = 120
&lt;/pre&gt;&lt;p&gt;
And &lt;tt&gt;php5-fpm&lt;/tt&gt; was restarted.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Tue, 30 Jun 2015 10:15:23 GMT</pubDate>
      <title></title>
      <link>https://trac.crin.org/trac/ticket/9#comment:24</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:24</guid>
      <description>
        &lt;p&gt;
I think this ticket can probably be closed?
&lt;/p&gt;
&lt;p&gt;
Looking at the &lt;a class="ext-link" href="https://munin.crin.org/"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;Munin graphs&lt;/a&gt; everything seems fine (the number of &lt;tt&gt;pfp5-fpm&lt;/tt&gt; and &lt;tt&gt;nginx&lt;/tt&gt; processes could probably be reduced since the number of services started was set before the network driver fix).
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>gillian</dc:creator>

      <pubDate>Wed, 01 Jul 2015 16:55:04 GMT</pubDate>
      <title></title>
      <link>https://trac.crin.org/trac/ticket/9#comment:39</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:39</guid>
      <description>
        &lt;pre class="wiki"&gt;Hi, Yes unless Jenny has any reservations.
Best,Gillian
On 30 June 2015 at 11:15, CRIN Trac &amp;lt;trac@trac.crin.org&amp;gt; wrote:
&amp;gt; #9: Monitor and adjust server settings after Crin1 and Crin2 server go live
&amp;gt; -------------------------------------+-------------------------------------
&amp;gt;                  Reporter:  chris    |                Owner:  chris
&amp;gt;                      Type:  task     |               Status:  new
&amp;gt;                  Priority:  major    |            Milestone:  Make Crin1
&amp;gt;                                      |  and Crin2 live and monitor
&amp;gt;                 Component:  crin1    |              Version:
&amp;gt;                Resolution:           |             Keywords:
&amp;gt; Estimated Number of Hours:  4        |  Add Hours to Ticket:  0
&amp;gt;                 Billable?:  1        |          Total Hours:  9.22
&amp;gt; -------------------------------------+-------------------------------------
&amp;gt;
&amp;gt; Comment (by chris):
&amp;gt;
&amp;gt;  I think this ticket can probably be closed?
&amp;gt;
&amp;gt;  Looking at the [https://munin.crin.org/ Munin graphs] everything seems
&amp;gt;  fine (the number of `pfp5-fpm` and `nginx` processes could probably be
&amp;gt;  reduced since the number of services started was set before the network
&amp;gt;  driver fix).
&amp;gt;
&amp;gt; --
&amp;gt; Ticket URL: &amp;lt;https://trac.crin.org/trac/ticket/9#comment:24&amp;gt;
&amp;gt; CRIN Trac &amp;lt;https://trac.crin.org/trac&amp;gt;
&amp;gt; Trac project for CRIN website and servers.
&amp;gt;
--
Gillian Harrow
Organisational Development Manager
*Child Rights International Network - CRIN*
Unit W125-127, Westminster Business Square
1-45 Durham Street
London SE11 5JH
United Kingdom
E: gillian@crin.org
T: +44 (0)20 7401 2257
Website: www.crin.org
Twitter: @CRINwire
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>jenny</dc:creator>

      <pubDate>Wed, 01 Jul 2015 17:00:04 GMT</pubDate>
      <title></title>
      <link>https://trac.crin.org/trac/ticket/9#comment:40</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:40</guid>
      <description>
        &lt;pre class="wiki"&gt;Sorry I missed this one - yes, fine!
On 1 July 2015 at 17:53, Gillian Harrow &amp;lt;gillian@crin.org&amp;gt; wrote:
&amp;gt; Hi, Yes unless Jenny has any reservations.
&amp;gt; Best,Gillian
&amp;gt;
&amp;gt; On 30 June 2015 at 11:15, CRIN Trac &amp;lt;trac@trac.crin.org&amp;gt; wrote:
&amp;gt;
&amp;gt;&amp;gt; #9: Monitor and adjust server settings after Crin1 and Crin2 server go
&amp;gt;&amp;gt; live
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; -------------------------------------+-------------------------------------
&amp;gt;&amp;gt;                  Reporter:  chris    |                Owner:  chris
&amp;gt;&amp;gt;                      Type:  task     |               Status:  new
&amp;gt;&amp;gt;                  Priority:  major    |            Milestone:  Make Crin1
&amp;gt;&amp;gt;                                      |  and Crin2 live and monitor
&amp;gt;&amp;gt;                 Component:  crin1    |              Version:
&amp;gt;&amp;gt;                Resolution:           |             Keywords:
&amp;gt;&amp;gt; Estimated Number of Hours:  4        |  Add Hours to Ticket:  0
&amp;gt;&amp;gt;                 Billable?:  1        |          Total Hours:  9.22
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; -------------------------------------+-------------------------------------
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; Comment (by chris):
&amp;gt;&amp;gt;
&amp;gt;&amp;gt;  I think this ticket can probably be closed?
&amp;gt;&amp;gt;
&amp;gt;&amp;gt;  Looking at the [https://munin.crin.org/ Munin graphs] everything seems
&amp;gt;&amp;gt;  fine (the number of `pfp5-fpm` and `nginx` processes could probably be
&amp;gt;&amp;gt;  reduced since the number of services started was set before the network
&amp;gt;&amp;gt;  driver fix).
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; --
&amp;gt;&amp;gt; Ticket URL: &amp;lt;https://trac.crin.org/trac/ticket/9#comment:24&amp;gt;
&amp;gt;&amp;gt; CRIN Trac &amp;lt;https://trac.crin.org/trac&amp;gt;
&amp;gt;&amp;gt; Trac project for CRIN website and servers.
&amp;gt;&amp;gt;
&amp;gt;
&amp;gt;
&amp;gt;
&amp;gt; --
&amp;gt; Gillian Harrow
&amp;gt; Organisational Development Manager
&amp;gt;
&amp;gt; *Child Rights International Network - CRIN*
&amp;gt; Unit W125-127, Westminster Business Square
&amp;gt; 1-45 Durham Street
&amp;gt; London SE11 5JH
&amp;gt; United Kingdom
&amp;gt;
&amp;gt; E: gillian@crin.org
&amp;gt; T: +44 (0)20 7401 2257
&amp;gt; Website: www.crin.org
&amp;gt; Twitter: @CRINwire
&amp;gt;
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 02 Jul 2015 08:27:00 GMT</pubDate>
      <title>status changed; resolution set</title>
      <link>https://trac.crin.org/trac/ticket/9#comment:41</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/9#comment:41</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;new&lt;/em&gt; to &lt;em&gt;closed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;resolution&lt;/strong&gt;
                set to &lt;em&gt;fixed&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>