Mod_PageSpeed Reports Slow Write Operation on File


I have noticed quite often the following in the apache2 log and expressed my concern to Quickhostuk.

[Wed May 11 20:09:03.549759 2016] [pagespeed:error] [pid 25872:tid 139812954580736] [mod_pagespeed 1.9.32.14-0 @25872] Slow write operation on file /var/cache/mod_pagespeed/v2/... ...: 67.025ms; configure SlowFileLatencyUs to change threshold

Reply: Yes your VPS really is on SSD. It would be MUCH slower if not.

Please also remember that Apache is not the only thing that is trying to use your disk IO. Apache will need to wait for disk IO time while other things are using it such as the OS and all the other software installed on the OS. They all need to wait their turn until the disk is free until they can use it.

You can check your servers disk IO with top, iotop, atop, etc.. commands. You can also ionice your processes so they can use more/less disk IO.

For this reason it is not recommended to use disk for caching, but rather you should use an in memory cache so it uses RAM and not disk. The very link you have provided recommends using memcache or memcached. You can also use Redis or Varnish which are newer. They will use RAM which is much faster than disk.

It just means that a file-cache operation took longer than 50ms. If that happens infrequently — say a few times a day — it’s probably not something I’d worry about. If it happens very frequently — say several times a minute, it means that your disk speed might be slowing down visitors to your site.

One common problem we’ve seen is when file-caches are put on network file systems. If you want to cache on the network it’s much faster to use memcached rather than a file-system. I can’t tell from the message whether “/var/cache” is a local hard disk or is a network mount.

It could be contention with other programs, or a burst of requests to your Apache server. 67ms sounds really slow for an SSD though, so I’m guessing there was CPU contention as well.

The real question is: how often do you see this message? How many times per day?

I hope this helps to clarify that Apache is only 1 of thousands of processes that need to access your disk, but they cannot all access at once so the need to wait their turn. The more things waiting to use your disk the higher %wa in the top command. You can also install systat or sar to keep track of this and show you historical performance.

Also just one more thing to note, If your server needs the best performance and your sites have become more popular/using more resources then it may be time to upgrade the VPS or also start look at Dedicated Servers. I remember you were asking about Dedicated Servers some time ago.

We do currently have stock: https://www.quickhostuk.com/unmanaged-dedicated-servers/

CPU – 2x INTEL® XEON® E3 (8 CPU Cores)
RAM – 8GB DDR3 ECC
HDD1 – 1x 64GB SSD
HDD2 – 1x 500GB SATA
Bandwidth – 500GB INCLUDED
Remote Reboot – Yes
Price – £49 /m

As per normal we can do 12 months for price of 11 on yearly payment.

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
676 words
Last Post: CloudFlare Full Strict HTTPS and Flexible - Is it a Must to use Full SSL when a Valid certificate is present?
Next Post: Some Thoughts on VPS v.s. Dedicated Server

The Permanent URL is: Mod_PageSpeed Reports Slow Write Operation on File

Leave a Reply