问题
My Vagrant box running a classic LAMP stack (ubuntu 14, php 5.5.9) serves pages slowly (~ 5.3/5.5 secs) if more than 60 seconds passed since last page load. The "normal" page load (before passing the 60 secs limit) is ~0.2 sec. The application files are shared from the host system via NFS.
What I've debugged so far:
- it only happens to requests hitting the application (which is a laravel 5 application)
- happens even if no queries are made to the db
- if I die() at the very top of the application it is fast
- static files are always served fast
- serving the files from the native filesystem is fast
- this sort of 60 seconds timer is reset even if requests are made to a different application (on the same server)
Any hints on what could be causing this ? I think it is clearly related to the large number of files that need to be accessed on NFS, but the 60 seconds thing seems weird to me...
回答1:
The problem was related to NFS attribute caching (that lasts 60 seconds by default) and solved it by setting the following mount options:
'nolock,vers=3,udp,noatime,actimeo=1'
See: Speed up sync latency between host and guest on Vagrant (NFS sync folders)
来源:https://stackoverflow.com/questions/29571079/vagrant-slow-page-load-after-60-seconds-from-last-request