Jump to content

Recommended Posts

Posted

*wonders if now would be a good time to nudge Geoff re: cacheing.. * ;)

 

 

Re: Apachetop, for some reason I had a brain fart and forgot that apachetop is a diagnostic tool. n00boy error... *blush*

Posted

@Geoff: Having a look at the apache2.conf file I have the following:

 

MaxKeepAliveRequests 100

# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.

KeepAliveTimeout 5

##
## Server-Pool Size Regulation (MPM specific)
## 

# prefork MPM
# StartServers ......... number of server processes to start
# MinSpareServers ...... minimum number of server processes which are kept spare
# MaxSpareServers ...... maximum number of server processes which are kept spare
# MaxClients ........... maximum number of server processes allowed to start
# MaxRequestsPerChild .. maximum number of requests a server process serves

StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients          150
MaxRequestsPerChild  0


# pthread MPM
# StartServers ......... initial  number of server processes to start
# MaxClients ........... maximum  number of server processes allowed to start
# MinSpareThreads ...... minimum  number of worker threads which are kept spare
# MaxSpareThreads ...... maximum  number of worker threads which are kept spare
# ThreadsPerChild ...... constant number of worker threads in each server process
# MaxRequestsPerChild .. maximum  number of requests a server process serves

StartServers         2
MaxClients         150 
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0


# perchild MPM
# NumServers ........... constant number of server processes
# StartThreads ......... initial  number of worker threads in each server process
# MinSpareThreads ...... minimum  number of worker threads which are kept spare
# MaxSpareThreads ...... maximum  number of worker threads which are kept spare
# MaxThreadsPerChild ... maximum  number of worker threads in each server process
# MaxRequestsPerChild .. maximum  number of connections per server process (then it dies)

NumServers           5
StartThreads         5
MinSpareThreads      5
MaxSpareThreads     10
MaxThreadsPerChild  20
MaxRequestsPerChild  0
AcceptMutex fcntl

 

Do I change each instance of the above or just one??

Posted

output from dkpg -l '*apache2*':

 

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  apache2        2.0.55-4ubuntu next generation, scalable, extendable web se
ii  apache2-common 2.0.55-4ubuntu next generation, scalable, extendable web se
un  apache2-doc             (no description available)
un  apache2-module          (no description available)
un  apache2-mpm-pe          (no description available)
ii  apache2-mpm-pr 2.0.55-4ubuntu traditional model for Apache2
un  apache2-mpm-th          (no description available)
un  apache2-mpm-wo          (no description available)
ii  apache2-utils  2.0.55-4ubuntu utility programs for webservers
un  libapache2-mod          (no description available)
un  libapache2-mod          (no description available)
ii  libapache2-mod 5.1.2-1ubuntu3 server-side, HTML-embedded scripting languag

 

Looks to me like it's running in PR.

 

Have edited the required sections of the.conf file for apache2 and restarted apache2.

 

Will run a test this morning under load (about 30 kids) and let you know how it goes.

Posted

Results from top:

 

top - 09:53:19 up 18:49,  2 users,  load average: 8.17, 4.52, 1.89
Tasks:  99 total,  22 running,  72 sleeping,   3 stopped,   2 zombie
Cpu(s): 97.8% us,  2.2% sy,  0.0% ni,  0.0% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:   2073948k total,   724460k used,  1349488k free,    93360k buffers
Swap:  1469908k total,        0k used,  1469908k free,   166060k cached

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
18398 www-data  15   0 32596  18m 3640 S   19  0.9   0:07.17 apache2
18833 www-data  16   0 30024  15m 3524 R   18  0.8   0:03.65 apache2
18802 www-data  16   0 31768  17m 3756 R   17  0.9   0:06.64 apache2
18356 www-data  16   0 30280  16m 4604 R   17  0.8   0:07.86 apache2
18668 www-data  16   0 32760  18m 3572 R   15  0.9   0:06.84 apache2
18800 www-data  15   0 37776  23m 3600 S   14  1.1   0:06.08 apache2
18271 www-data  15   0 37892  23m 3608 S   14  1.2   0:08.25 apache2
18389 www-data  16   0 32416  17m 3548 R   12  0.9   0:08.68 apache2
17898 www-data  16   0 38092  24m 4724 S   10  1.2   0:16.47 apache2
18366 www-data  16   0 32560  18m 3592 S   10  0.9   0:06.82 apache2
18828 www-data  16   0 30132  15m 3556 S    9  0.8   0:02.81 apache2
19132 www-data  16   0 30052  15m 3496 S    9  0.8   0:01.46 apache2
18575 www-data  16   0 30052  15m 3572 R    8  0.8   0:06.95 apache2
18793 www-data  17   0 38620  24m 3616 R    7  1.2   0:04.03 apache2
19134 www-data  17   0 29204  14m 3296 R    4  0.7   0:00.50 apache2
18396 www-data  15   0 38576  24m 3652 R    4  1.2   0:08.93 apache2
18830 www-data  16   0 29468  14m 3404 R    3  0.7   0:02.41 apache2
18400 www-data  17   0 33216  19m 4628 R    2  1.0   0:09.82 apache2
3950 mysql     15   0  133m  25m 4768 S    2  1.2   0:47.68 mysqld
18371 www-data  15   0 31360  16m 3548 S    2  0.8   0:08.16 apache2
19122 www-data  15   0 29448  14m 3400 S    2  0.7   0:01.44 apache2
18353 www-data  16   0 37904  23m 3608 R    1  1.2   0:09.33 apache2
18402 www-data  16   0 30148  15m 3576 R    1  0.8   0:07.16 apache2
18776 www-data  17   0 29476  14m 3404 R    1  0.7   0:03.34 apache2
17111 root      16   0  2196 1132  856 R    0  0.1   0:00.78 top
   1 root      16   0  1568  532  460 S    0  0.0   0:01.44 init
   2 root      RT   0     0    0    0 S    0  0.0   0:00.14 migration/0
   3 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/0
   4 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/0
   5 root      RT   0     0    0    0 S    0  0.0   0:00.11 migration/1
   6 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/1
   7 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/1
   8 root      10  -5     0    0    0 S    0  0.0   0:00.07 events/0
   9 root      10  -5     0    0    0 S    0  0.0   0:00.04 events/1
  10 root      11  -5     0    0    0 S    0  0.0   0:00.01 khelper
  11 root      10  -5     0    0    0 S    0  0.0   0:00.00 kthread
  14 root      10  -5     0    0    0 S    0  0.0   0:00.01 kblockd/0
  15 root      10  -5     0    0    0 S    0  0.0   0:00.00 kblockd/1
  16 root      20  -5     0    0    0 S    0  0.0   0:00.00 kacpid
 152 root      20   0     0    0    0 S    0  0.0   0:00.00 pdflush

 

Results from apachetop:

 

last hit: 08:53:54         atop runtime:  0 days, 00:01:43             08:53:55
All:          730 reqs (   7.2/sec)       5909.4K (   57.9K/sec)    8289.4B/req
2xx:     567 (77.7%) 3xx:     160 (21.9%) 4xx:     2 ( 0.3%) 5xx:     1 ( 0.1%)
R ( 30s):     245 reqs (   8.2/sec)       2229.5K (   74.3K/sec)    9318.5B/req
2xx:     176 (71.8%) 3xx:      69 (28.2%) 4xx:     0 ( 0.0%) 5xx:     0 ( 0.0%)

REQS REQ/S    KB KB/S URL
  45  1.50 183.8  6.1*/vle/mod/chat/gui_header_js/jsupdate.php
  24  0.80  15.5  0.5 /vle/theme/standardwhite/styles.php
  22  0.73  1562 52.1 /vle/theme/standard/styles.php
  12  0.40   3.5  0.1 /vle/mod/chat/gui_header_js/insert.php
  11  0.37   2.1  0.1 /vle/mod/chat/empty.php
   8  0.28 128.8  4.4 /vle/course/view.php
   6  0.32   0.7  0.0 /vle/theme/standardwhite/gradient.jpg
   6  0.32   0.1  0.0 /vle/pix/spacer.gif
   6  0.20  63.8  2.1 /vle/mod/chat/gui_header_js/users.php
   6  0.22  31.2  1.2 /vle/login/index.php
   6  0.32   0.2  0.0 /vle/pix/t/switch_minus.gif
   4  0.17  48.3  2.1 /vle/mod/quiz/attempt.php
   3  0.11   3.9  0.1 /vle/message/refresh.php
   3  0.12   0.7  0.0 /vle/pix/help.gif
   3  0.25   0.0  0.0 /vle/pix/i/grades.gif
   3  0.25   0.0  0.0 /vle/mod/assignment/icon.gif
   3  0.25   0.0  0.0 /vle/mod/chat/icon.gif
   3  0.25   0.0  0.0 /vle/mod/choice/icon.gif
   3  0.25   0.0  0.0 /vle/pix/i/users.gif
   3  0.10   2.7  0.1 /vle/pix/i/key.gif
   3  0.25   0.0  0.0 /vle/mod/glossary/icon.gif
   3  0.25   0.0  0.0 /vle/mod/quiz/icon.gif
   3  0.25   0.0  0.0 /vle/mod/resource/icon.gif
   3  0.25   0.0  0.0 /vle/mod/survey/icon.gif
   3  0.14  25.3  1.1 /vle/lib/javascript-static.js
   3  0.25   0.0  0.0 /vle/pix/i/course.gif
   3  0.25   0.0  0.0 /vle/pix/i/one.gif
   3  0.25   0.0  0.0 /vle/pix/f/web.gif
   3  0.25   0.0  0.0 /vle/pix/f/pdf.gif
   3  0.25   0.0  0.0 /vle/pix/f/word.gif
   3  0.25   0.0  0.0 /vle/mod/forum/icon.gif
   3  0.16   5.1  0.3 /vle/pix/moodlelogo.gif
   3  0.16  62.8  3.3 /vle/lib/overlib.js
   3  0.14  36.0  1.6 /vle/
   3  0.14   1.3  0.1 /vle/theme/standard/styles_ie7.css
   3  0.16   0.7  0.0 /vle/calendar/overlib.cfg.php
   3  0.16   4.7  0.2 /vle/lib/cookies.js
   3  0.16  22.0  1.2 /vle/lib/ufo.js
   2  0.11   0.1  0.0 /vle/lib/javascript-mod.php
   2  0.17  13.3  1.1 /vle/course/category.php
   1  0.04   1.4  0.1 /vle/message/send.php
   1  0.05   0.3  0.0 /vle/pix/i/cross_red_big.gif
   1  0.50   0.3  0.2 /vle/pix/i/tick_green_big.gif
   1  0.06   0.3  0.0 /vle/theme/standard/pix/tab/left_hover.gif
   1  0.06   2.7  0.2 /vle/theme/standard/pix/tab/right_hover.gif
   1  0.06   0.1  0.0 /vle/pix/i/tick_green_small.gif
   1  0.10   5.9  0.6 /vle/course/enrol.php

 

This was under load with 28 kids.

Posted

Right, next step is to use a PHP Accelerator. Have a look at this blog post on how to do that. The only other suggestion I would make after implementing the accelerator, is to put it's cache on tmpfs.

 

First:

sudo mkdir /var/tmp/phpcache
sudo chown www-data.www-data /var/tmp/phpcache
sudo mount -t tmpfs tmpfs /var/tmp/phpcache

 

Then in /etc/fstab:

tmpfs /var/tmp/phpcache tmpfs defaults 0 0

 

Then in php.ini

phpa.cache_dir = /var/tmp/phpcache

 

And restart Apache:

sudo /etc/init.d/apache2 restart

Posted

Geoff, Thanks again for all your help on this, tutor is reporting a great increase in performance and loads are stables in the low 0.40

 

Thanks agin

Posted

No problem. It's a shame the default config for apache is so useless in most distros. Really gives a poor impression to new users :(

 

Ah well, enjoy your new server and I hope you learned something :)

 

I might retool this thread as a howto/wiki article.

Posted

As a linux n00b yes Ihave learned alot from this so many thanks.

 

Us windoze people are very much shielded from this kinda stuff and it is certainly refreshing to "get stuck in" to something new.

Posted

Just a quick update: did a load test with 120 students hitting the chat room on moodle and got the following load result:

 

load average: 0.14, 0.04, 0.01

 

Man thanks to geoff, problem sorted ;-)

Posted

This is the complete top output for the above load:

 

top - 14:14:01 up 23:10,  1 user,  load average: 0.14, 0.04, 0.01
Tasks:  76 total,   1 running,  72 sleeping,   3 stopped,   0 zombie
Cpu(s):  6.5% us,  1.3% sy,  0.0% ni, 92.0% id,  0.2% wa,  0.0% hi,  0.0% si
Mem:   2073948k total,   529480k used,  1544468k free,   106192k buffers
Swap:  1469908k total,        0k used,  1469908k free,   264272k cached

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
4524 www-data  16   0 52444  14m  10m S    3  0.7   0:00.21 apache2
4318 www-data  16   0 52376  14m  10m S    2  0.7   0:00.55 apache2
3950 mysql     15   0  133m  25m 4768 S    2  1.3   1:01.83 mysqld
3373 www-data  15   0 54048  23m  18m S    2  1.2   0:01.67 apache2
4400 www-data  15   0 52364  13m  10m S    1  0.7   0:00.38 apache2
4094 www-data  16   0 53280  17m  13m S    1  0.9   0:01.09 apache2
4217 www-data  15   0 53508  17m  13m S    1  0.9   0:00.53 apache2
4223 www-data  16   0 54060  21m  16m S    1  1.1   0:01.20 apache2
4320 www-data  17   0 53340  16m  12m S    1  0.8   0:00.42 apache2
4383 www-data  16   0 52240  12m 9468 S    1  0.6   0:00.22 apache2
3982 root      16   0  7688 2480 2056 S    0  0.1   0:00.11 sshd
4012 root      16   0  2200 1108  856 R    0  0.1   0:00.23 top
   1 root      17   0  1568  532  460 S    0  0.0   0:01.55 init
   2 root      RT   0     0    0    0 S    0  0.0   0:00.17 migration/0
   3 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/0
   4 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/0
   5 root      RT   0     0    0    0 S    0  0.0   0:00.12 migration/1
   6 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/1
   7 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/1
   8 root      10  -5     0    0    0 S    0  0.0   0:00.07 events/0
   9 root      10  -5     0    0    0 S    0  0.0   0:00.04 events/1
  10 root      11  -5     0    0    0 S    0  0.0   0:00.01 khelper
  11 root      10  -5     0    0    0 S    0  0.0   0:00.00 kthread
  14 root      10  -5     0    0    0 S    0  0.0   0:00.01 kblockd/0
  15 root      10  -5     0    0    0 S    0  0.0   0:00.00 kblockd/1
  16 root      20  -5     0    0    0 S    0  0.0   0:00.00 kacpid
 152 root      20   0     0    0    0 S    0  0.0   0:00.00 pdflush
 153 root      15   0     0    0    0 S    0  0.0   0:00.04 pdflush
 154 root      25   0     0    0    0 S    0  0.0   0:00.00 kswapd0
 155 root      15  -5     0    0    0 S    0  0.0   0:00.00 aio/0
 156 root      15  -5     0    0    0 S    0  0.0   0:00.00 aio/1
 744 root      10  -5     0    0    0 S    0  0.0   0:00.00 kseriod
 830 root      15   0     0    0    0 S    0  0.0   0:00.00 kirqd
1756 root      11  -5     0    0    0 S    0  0.0   0:00.00 scsi_eh_0
1875 root      10  -5     0    0    0 S    0  0.0   0:00.00 khubd
1982 root      15   0     0    0    0 S    0  0.0   0:00.58 kjournald
2184 root      12  -4  2108  552  368 S    0  0.0   0:00.40 udevd
2998 root      20   0     0    0    0 S    0  0.0   0:00.00 shpchpd_event
3507 daemon    16   0  1668  364  272 S    0  0.0   0:00.00 portmap
3809 root      16   0  1684  500  412 S    0  0.0   0:00.05 dd
3811 klog      19   0  2408 1332  388 S    0  0.1   0:00.06 klogd
3851 root      18   0 12552 2420 1364 S    0  0.1   0:00.00 slapd
3882 root      24   0  2640 1312 1064 S    0  0.1   0:00.01 mysqld_safe
3951 root      24   0  1548  500  432 S    0  0.0   0:00.00 logger
3958 dhcp      14  -2  2340  600  296 S    0  0.0   0:00.03 dhclient3
4103 root      16   0  4660 1600 1296 S    0  0.1   0:00.09 master
4121 root      17   0  4760 1056  756 S    0  0.1   0:00.08 sshd
4150 root      16   0  2908  996  840 S    0  0.0   0:00.46 famd
4173 root      16   0  1624  296  232 S    0  0.0   0:00.00 mdadm

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...