This is a question about a problematic interaction between Apache and Samba.
Our Linux server (on a private intranet) mounts a Windows share, which is physically thousands of miles away, and serves it via Apache. This lets our users view files on the share via HTTP rather than by file:// URLs. Sometimes, however, a single HTTP hit produces multiple Apache threads all accessing the same SMB file simultaneously for 10 minutes or more in the "Sending Reply" ("W") state. Apache's server-status page shows many identical threads like the following, which is 1434 seconds old, all with slightly different lifetimes (in the "SS" column):
Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request 33-1 28411 0/146/27463 W 9.20 1434 0 0.0 0.56 689.97 192.168.0.25 someserver GET /share/foo/myfile.xlsx HTTP/1.1
Does anybody know why this happens and how we can prevent it? Is there a better way to accomplish our goal of HTTP connections to a Windows share?
Our /etc/fstab entry is:
//server//sharename /mnt/foo cifs ro,auto,credentials=/my/file,nosuid,nodev 0 0
The httpd.conf entry is:
Alias /share/foo "/mnt/foo" <Directory "/mnt/foo"> EnableSendfile Off Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory>
We are also seeing load spikes on this server, where load average jumps from normal (1.00) to 20.00 or higher, which might be attributable to this problem.
Thank you very much.