我们有一个在虚拟机上运行 PHP 的 Apache 服务器。文档根目录位于用户的主文件夹 ( /home/users/{first letter}/{username}/
) 内,并/home/users/
通过 NFS 挂载。
似乎有些奇怪的事情正在发生。当某些用户请求文件时(在本例中我使用了Hondenbol.png
),它需要很长时间(起初用户认为它根本没有加载),而对于其他用户(在本例中对我来说),它几乎立即加载。
这是该 vHost 的 Apache 日志文件的一部分。我注意到的唯一奇怪的事情是 HTTP 状态代码后面的数字,据我所知是这样的(来自 Apache 文档);
2326 (%b)
The last part indicates the size of the object returned to the client, not including the response headers. If no content was returned to the client, this value will be "-". To log "0" for no content, use %B instead.
同一个文件,差别这么大?还是和浏览器缓存有关?
root@web:/var/log/apache2/vhost# cat VHOST_USERNAME_USERNAME.sinners.be.log | grep -i bol
IP_USER - - [09/Sep/2014:17:18:34 +0200] "GET /SUBFOLDER/application/img/Hondenbol200.png HTTP/1.1" 404 544 "http://USERNAME.sinners.be/SUBFOLDER/index.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.44 Safari/537.36"
IP_USER - - [09/Sep/2014:17:20:29 +0200] "GET /SUBFOLDER/application/img/Hondenbol200.png HTTP/1.1" 404 544 "http://USERNAME.sinners.be/SUBFOLDER/index.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.44 Safari/537.36"
IP_USER - - [09/Sep/2014:17:43:45 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222132 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.44 Safari/537.36"
IP_USER - - [10/Sep/2014:17:13:05 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222131 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36"
IP_ME - - [20/Sep/2014:13:50:38 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222130 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:13:53:23 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:13:53:41 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222131 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_USER - - [20/Sep/2014:13:53:39 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222131 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.66 Safari/537.36"
IP_USER - - [20/Sep/2014:13:53:38 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222131 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.66 Safari/537.36"
RANDOM_IP - - [20/Sep/2014:13:55:17 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.0" 200 222094 "-" "-"
IP_ME - - [20/Sep/2014:13:56:14 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 183 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_ME - - [20/Sep/2014:13:56:15 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_ME - - [20/Sep/2014:13:56:15 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_ME - - [20/Sep/2014:13:56:15 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_USER - - [20/Sep/2014:13:53:39 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222131 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.66 Safari/537.36"
IP_ME - - [20/Sep/2014:13:59:58 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:14:01:04 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222131 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:14:01:38 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222131 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_USER - - [20/Sep/2014:14:02:39 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222130 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.66 Safari/537.36"
IP_USER - - [20/Sep/2014:14:03:17 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 183 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.66 Safari/537.36"
文件:
-rwxr-xr-x 1 USERNAME user 221841 Sep 10 01:22 Hondenbol.png
root@web:~# uname -a
Linux web 3.14-2-amd64 #1 SMP Debian 3.14.15-2 (2014-08-09) x86_64 GNU/Linux
root@web:~# apache2 -v
Server version: Apache/2.4.10 (Debian)
Server built: Jul 23 2014 13:15:48
root@web:~# php -v
PHP 5.6.0-1 (cli) (built: Aug 28 2014 13:03:02)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
我们用mpm-itk
。
更新 1
谢谢,@kasperd。我添加了%D
日志文件,发现一位同事也遇到了同样的问题。我请他(完全)加载了几次有问题的网站。
澄清一下:页面本身加载正常。只是页面上的图片对某些人来说有点麻烦,但它们总是相同的图片。
同事来访记录:
IP_OTHER_GUY - - [20/Sep/2014:21:18:38 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 206 339 2602 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:18:38 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 206 341 11028 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:18:38 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 984 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:18:38 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 206 252546 33461847 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:18:38 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 206 184858 61415214 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:33:29 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1078 30539 "http://l.facebook.com/lsr.php?u=http%3A%2F%2FUSERNAME.sinners.be%2FSUBFOLDER%2F&ext=1411241671&hash=" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:33:29 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 864 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:33:39 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1078 30241 "http://l.facebook.com/lsr.php?u=http%3A%2F%2FUSERNAME.sinners.be%2FSUBFOLDER%2F&ext=1411241671&hash=" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:33:39 +0200] "GET /SUBFOLDER/application/css/style.css HTTP/1.1" 200 1304 2659 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:33:39 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 506 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:34:04 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1078 50469 "http://l.facebook.com/lsr.php?u=http%3A%2F%2FUSERNAME.sinners.be%2FSUBFOLDER%2F&ext=1411241671&hash=" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:34:04 +0200] "GET /SUBFOLDER/application/css/style.css HTTP/1.1" 200 1304 1663 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:34:04 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 562 8751 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:34:04 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 200 310256 48043620 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:34:04 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 200 222130 61975581 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:35:07 +0200] "GET /favicon.ico HTTP/1.1" 404 506 2452 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:36:08 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1078 33676 "http://l.facebook.com/lsr.php?u=http%3A%2F%2FUSERNAME.sinners.be%2FSUBFOLDER%2F&ext=1411241671&hash=" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:36:08 +0200] "GET /SUBFOLDER/application/css/style.css HTTP/1.1" 200 1304 3005 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:36:08 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 562 8426 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
IP_OTHER_GUY - - [20/Sep/2014:21:36:08 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 200 310256 60066766 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
记录我的访问:
IP_ME - - [20/Sep/2014:21:32:59 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1078 55236 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:32:59 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 1154 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:32:59 +0200] "GET /favicon.ico HTTP/1.1" 404 506 216 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:32:59 +0200] "GET /favicon.ico HTTP/1.1" 404 506 183 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:16 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1078 51083 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:16 +0200] "GET /SUBFOLDER/application/css/style.css HTTP/1.1" 200 1304 2006 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:16 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 774 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:16 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 717 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:16 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 304 183 9232 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:16 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1077 9386 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:17 +0200] "GET /SUBFOLDER/application/css/style.css HTTP/1.1" 200 1304 657 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:17 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 304 182 488 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:17 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 183 8270 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:17 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 392 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:17 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1077 9150 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:17 +0200] "GET /SUBFOLDER/application/css/style.css HTTP/1.1" 200 1304 1028 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:17 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 777 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:17 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 304 182 487 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:17 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 340 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1077 8646 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/application/css/style.css HTTP/1.1" 200 1304 746 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 287 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 304 182 699 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 311 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1077 7981 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 349 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 304 182 238 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/application/css/style.css HTTP/1.1" 200 1304 2150 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:18 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 291 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:19 +0200] "GET /SUBFOLDER/ HTTP/1.1" 200 1077 22099 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:19 +0200] "GET /SUBFOLDER/application/css/style.css HTTP/1.1" 200 1304 822 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:19 +0200] "GET /SUBFOLDER/application/img/Hondenbol.png HTTP/1.1" 304 182 345 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:19 +0200] "GET /SUBFOLDER/application/img/banner.jpg HTTP/1.1" 304 182 217 "http://USERNAME.sinners.be/SUBFOLDER/" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
IP_ME - - [20/Sep/2014:21:37:19 +0200] "GET /SUBFOLDER/application/css/afbeeldingen/template/pattern.png HTTP/1.1" 404 561 265 "http://USERNAME.sinners.be/SUBFOLDER/application/css/style.css" "Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"
如您所见,我访问的加载/处理时间是很多更低。
所有遇到此问题的人似乎都使用 Telenet 作为其互联网服务提供商。使用 Belgacom(这里唯一的其他选择)的人似乎没有遇到此问题。不过,这可能是巧合。这只是我注意到的一件事;我不确定这是否相关。
更新 2
作为参考,测试页面;http://robinj1995.sinners.be/test/index_en.php
第一个字段集(块)是这里最相关的。
更新 3
我们尝试使用非 Apache Web 服务器(GitLab 的 Unicorn),也遇到了同样的问题。问题似乎与网络/防火墙有关,而不是我们的 Apache 配置问题。
我们的防火墙和/或垫脚石是运行 Debian 稳定版的服务器iptables
。
答案1
状态代码304
表示缓存副本仍为最新,并且未向客户端发送任何数据。您会发现,对于所有带有状态代码的请求,字节数都很小,304
而对于所有带有状态代码的请求,文件大小大致相同200
。
但是,如果连接速度不错,传输 200KB 的静态数据应该只需要几分之一秒。所以这可能不是你要找的瓶颈。
为了调试 Apache 性能问题,我发现将其包含%D
在内很有用LogFormat
。它将告诉您处理请求花费了多少微秒。
答案2
这里有几个变量(不同的浏览器、源 IP 地址),但这些都与您的 Web 服务器无关。如果您看到了基于用户 ISP 的模式,请尝试提出一些量化指标。例如,您可以跟踪从浏览器加载图像的网络时间。
例如,在 Chrome 中(开发者工具,点击“网络”选项卡),您可以通过 URL 加载图像并跟踪请求大小、HTTP 方法、HTTP 状态和总网络延迟。请注意,您可以切换“禁用缓存”复选框以查看缓存影响 - 您的大多数 IP_ME 请求为 304(已缓存),而 IP_OTHER 为 200(未缓存)。
尝试使用您自己的 Hondenbol.jpg URL(缓存/未缓存)进行测试。然后尝试从不相关的服务器加载中性图像(我使用任意服务器进行测试,http://telefonica.cl/images/new-home/banners/banner-tripack-moviecity.jpg,位于智利某处)。
通过此测试,您应该能够确认 a) 它是否只是缓存,或者 b) 延迟是否在您的 Web 服务器外部并与用户的 ISP 有关。
答案3
如果您查看出现问题的客户端的日志文件,您会看到重复的 HTTP 206 响应代码。
当客户端请求部分下载资源时,您将看到 206 响应,这可能由于多种原因而发生,例如它之前已经下载过部分资源,它识别出它是一个大型二进制文件,或者它正在尝试某种带宽控制。
如果您看到 HTTP 304 响应,则表示客户端仅在该资源的缓存未过期的情况下才请求该资源。如果缓存未过期,则服务器不会发送任何数据;它只是告诉客户端可以从客户端缓存中加载文件,因为服务器上的文件没有更改。
因此,由于资源正在本地加载,这些响应将始终快速呈现内容。
如果共享日志中的模式很典型,那么问题是由浏览器重复请求部分内容,并且仅在重复尝试后才获得完整内容引起的。
这可能与代理、浏览器配置或网络延迟有关。如果您可以提供其中一个图像文件的实时链接,则可以进行更多调试。
答案4
虽然对于一些特定的互联网服务提供商 (ISP) 来说,通过浏览器进行的 HTTP 下载和通过 FTP 客户端进行的 FTP 下载非常糟糕,但通过 curl/wget 进行的 HTTP 下载和 FTP 上传却非常顺利。
最后我们更换了防火墙,问题终于解决了。我们猜测可能是网卡有问题,因为我们拿到服务器的时候,第二个网卡已经坏了(二手服务器)。
我们稍后可能会调查问题到底是什么,在这种情况下,我会更新这个答案以提供更多详细信息。