Wordpressが重いということで、色々とチューニングしてみました。(ちょっと期間が空いたけど)
まず、目をつけたのが玄箱のメモリ。
topコマンドからShift-Mで動作中プロセスをメモリ使用量順に表示。
top - 01:34:42 up 5 days, 3:43, 1 user, load average: 0.00, 0.04, 0.07 Tasks: 88 total, 1 running, 87 sleeping, 0 stopped, 0 zombie Cpu(s): 1.6%us, 0.7%sy, 0.0%ni, 97.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 126988k total, 124756k used, 2232k free, 1836k buffers Swap: 248996k total, 139120k used, 109876k free, 18572k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 9467 www-data 18 -2 53088 21m 2576 S 0.0 17.6 2:14.61 apache2 2918 www-data 18 -2 57124 18m 2540 S 0.0 15.2 4:02.94 apache2 2953 www-data 18 -2 43300 13m 2712 S 0.0 10.9 3:21.64 apache2 2978 www-data 18 -2 46400 11m 2732 S 0.0 9.3 3:37.18 apache2 9310 www-data 18 -2 52124 10m 3260 S 0.0 8.4 2:17.84 apache2 9575 www-data 18 -2 48244 8332 2700 S 0.0 6.6 1:11.07 apache2 9446 www-data 18 -2 51640 5672 3100 S 0.0 4.5 1:37.59 apache2 1390 Guest 20 0 14412 3864 3012 S 0.0 3.0 1:54.36 smbd 9733 www-data 18 -2 44044 3840 2872 S 0.0 3.0 0:08.50 apache2 9424 www-data 18 -2 44852 3200 2360 S 0.0 2.5 2:25.17 apache2 1355 mysql 20 0 131m 2884 1304 S 0.0 2.3 0:15.79 mysqld 16181 openldap 18 -2 60136 2616 1612 S 0.0 2.1 0:44.96 slapd 9482 www-data 18 -2 53080 2552 2088 S 0.0 2.0 1:14.60 apache2 2845 root 18 -2 10680 2164 2016 S 0.0 1.7 0:00.60 sshd
こんな感じでApacheが上位を占めています・・・
この状態でWordpressのトップページを表示する時間を測定。
Apacheのベンチマークツールabを使用します。
$ sudo ab http://gwazine/~lalah/wp/ Password:Server Software: Apache/2.2.9 Server Hostname: gwazine Server Port: 80 Document Path: /~dren/ Document Length: 4152 bytes Concurrency Level: 1 Time taken for tests: 0.361 seconds Complete requests: 1 Failed requests: 0 Write errors: 0 Total transferred: 4528 bytes HTML transferred: 4152 bytes Requests per second: 2.77 [#/sec] (mean) Time per request: 361.387 [ms] (mean) Time per request: 361.387 [ms] (mean, across all concurrent requests) Transfer rate: 12.24 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 1 1 0.0 1 1 Processing: 360 360 0.0 360 360 Waiting: 359 359 0.0 359 359 Total: 361 361 0.0 361 361This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking gwazine (be patient).....done Server Software: Apache/2.2.9 Server Hostname: gwazine Server Port: 80 Document Path: /~lalah/wp/ Document Length: 5670 bytes Concurrency Level: 1 Time taken for tests: 25.712 seconds Complete requests: 1 Failed requests: 0 Write errors: 0 Total transferred: 6039 bytes HTML transferred: 5670 bytes Requests per second: 0.04 [#/sec] (mean) Time per request: 25711.646 [ms] (mean) Time per request: 25711.646 [ms] (mean, across all concurrent requests) Transfer rate: 0.23 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 1 1 0.0 1 1 Processing: 25711 25711 0.0 25711 25711 Waiting: 25670 25670 0.0 25670 25670 Total: 25711 25711 0.0 25711 25711スクリプト(php)を処理するからとは言え、6K程度のページを表示するのに25秒って・・・ないわ~~
ちなみに、ごく一般的なHTMLを表示するのはこれくらい。
玄箱だから遅い。ということはなさそうです。

コメントする