slow webserver when many users are online

Hi i have an image displaying page.
I got two dedicated servers with default plesk installation on both.

in one i installed a virtual host thru plesk (server 1) with the php files in it.
in the other one i installed another virtual host (with a fake domain name)and added a database(also thru plesk), so server 1 can use that database.

Im a neewbie in linux/apache, and that was the only way i could set up my site for it to work.

Now, The problem is that when there are more than about 60 users online the page takes minimal 60 seconds to load.. thats pretty much.

When using opera webbrowser you can see how the client comunicates with the server, there i can see that sending the request to the webserver takes about 40 seconds..

also i have added another virtual host in server 1 that got nothing to do with the one im having problems with, but i yust added this here to let you know that when entering that domain even though the other page is slow this one downloas in seconds. (exact same php script)  

Is there anything i can do in the apache configuratuion to solve this problem?

server1 (dual 2.8ghz 500mb ram) plesk 6
server2 (2.8 ghz 1000mb ram) plesk 7

Who is Participating?
samriConnect With a Mentor Commented:
the slowness sounds normal.

What is your bandwith to the internet?

60 users concurrent, and each browse window may be using multiple connection to the server.  Imagine if you are visitng a website with 10 picture, and several of them would be loaded at the same time.  So it may contribute to the slowness.  Wost case, if everybody if trying to load different picture.  Disk IO would be expensive.  Not to mention web-crawler, leechers, image thief? etc. etc.

Monitor your bandwith? and perhaps the server CPU and Disk utilization to get a better picture.  

Pleask to my understanding is a virtual-server concept.  Do you know who are you sharing the physical machine with?  And what they are doing - in term of server/wan utilization?

wicemanAuthor Commented:
hi again.

acording to my server provider the dedicated servers are on a 100Mb switch.
Is there a way to test it?

I did a "top" from shell on both servers here are a sample:

server 1

151 processes: 149 sleeping, 1 running, 1 zombie, 0 stopped
CPU0 states:   2.0% user   8.1% system    0.0% nice   0.0% iowait  88.1% idle
CPU1 states:   4.0% user   4.1% system    0.0% nice   0.0% iowait  90.1% idle
Mem:   512680k av,  474652k used,   38028k free,       0k shrd,  122636k buff
                    318892k actv,   60584k in_d,    8036k in_c
Swap: 1052216k av,   25756k used, 1026460k free                  172004k cached

23298 root      15    0    3064  360   240       S         2.9     0.0        0:49  1     httpd
27880 apache  15    0    0       0       0          Z         0.9     0.0        0:00  1     httpd <defunct>
13100 root      15    0    948    916   496       R         0.4     0.1        0:55  1     top
28126 root      20    0    444    444   384       S         0.4     0.0        0:00  0     tcp-env

Server 2

 02:36:27  up 6 days, 18:26,  1 user,  load average: 18.70, 16.04, 15.40
72 processes: 65 sleeping, 2 running, 5 zombie, 0 stopped
CPU0 states:  90.1% user   9.3% system    0.0% nice   0.0% iowait   0.0% idle
CPU1 states:  88.3% user  11.1% system    0.0% nice   0.0% iowait   0.0% idle
Mem:  1021448k av, 1005496k used,   15952k free,       0k shrd,  140208k buff
                    516480k actv,       0k in_d,   20764k in_c
Swap: 2096472k av,    3052k used, 2093420k free                  737988k cached

  27557 mysql    17   0   25800  25M   2420    R       99.9   2.5         550:21   1     mysqld
  27577 root      16   0    1180   1180  868      R       0.3     0.1        1:16       1     top
  1        root      15   0    108     100    56       S       0.0     0.0         0:21      1     init
  2        root      RT   0    0        0        0        SW    0.0     0.0         0:00       0    migration/0
  3        root      RT   0    0        0        0        SW    0.0     0.0         0:00      1     migration/1

The CPU usage for mysqld process on server 2 is allways on 99.9%
I guess thats whats causing the delay?

Any suggestions/thougths.


Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

100Mb swith is your connection to the LAN, but how about the WAN bandwith.  It is very common to be on 100Mb LAN or even some would be on Gigabit connection.

I would agree with you on the mysqld process.  Perhaps you may want to pay closer attention to it.

Server1, appears to be swapping quite a bit compared to Server2.

Swap: 1052216k av,   25756k used, 1026460k free                  172004k cached

You may want to stop mysql and test the performance (just to ensure that mqsql is hogging the machine) -- if you could afford to.

wicemanAuthor Commented:
I have no idea what the WAN bandwith is.

Server 2 is only working on the database, maybe thats why it only uses little swap space..

Which files do i need to modify to optimise mysql?
wicemanAuthor Commented:
The problem was som poor code..  the code i had was written for about three years ago..
I changed my mysql queries completly with the new features of mysql, i managed to remove about 6 queries.
now it works ten times as fast.

Thanks anyway
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.