Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How do I look for the reasons for a very slow webserver
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Letharion
Veteran
Veteran


Joined: 13 Jun 2005
Posts: 1344
Location: Sweden

PostPosted: Thu Aug 13, 2009 7:59 am    Post subject: How do I look for the reasons for a very slow webserver Reply with quote

I have a VM with Apache server placed outside of the network. Sometimes, it just grinds to a halt, and loading a webpage takes anywhere in the range 5-60 seconds.

I don't know where to start looking.
It could be apache, ssl, the network, a firewall, hardware, and most likely a long line of other things.

After googling, I found the suggestion to put httpd.conf on a modules diet, which I did, but the problem remains. This was done in a dumb brute force fashion y by removing most modules, and then starting to add modules back until the server worked as expected. At the time, this felt like the solution, as the loadtime felt significantly shorter, but this morning, the problem is back.

Any suggestions on where I start?

Here is a list of the un-commented modules.
Code:
LoadModule python_module modules/mod_python.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule mime_module modules/mod_mime.so
<IfDefine CACHE>
LoadModule cache_module modules/mod_cache.so
</IfDefine>
<IfDefine DAV>
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
LoadModule dav_svn_module modules/mod_dav_svn.so
</IfDefine>
<IfDefine CACHE>
LoadModule disk_cache_module modules/mod_disk_cache.so
</IfDefine>
<IfDefine CACHE>
LoadModule file_cache_module modules/mod_file_cache.so
</IfDefine>
<IfDefine INFO>
LoadModule info_module modules/mod_info.so
</IfDefine>
<IfDefine CACHE>
LoadModule mem_cache_module modules/mod_mem_cache.so
</IfDefine>
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
</IfDefine>
<IfDefine STATUS>
LoadModule status_module modules/mod_status.so
</IfDefine>
<IfDefine USERDIR>
LoadModule userdir_module modules/mod_userdir.so
</IfDefine>
Back to top
View user's profile Send private message
vincent-
Retired Dev
Retired Dev


Joined: 13 Jan 2007
Posts: 415
Location: Valencia (Spain)

PostPosted: Thu Aug 13, 2009 8:17 am    Post subject: Reply with quote

Any possibility to try into the same local network as the server?
Back to top
View user's profile Send private message
Letharion
Veteran
Veteran


Joined: 13 Jun 2005
Posts: 1344
Location: Sweden

PostPosted: Thu Aug 13, 2009 9:58 am    Post subject: Reply with quote

You mean transfer the VM?

Or do you mean just trying to install apache locally and see what happens?

If the former, then I guess I could try, but I'm not sure about the details of running the VM. I think it's using vSphere, which would require a computer to install that first, and that might take a lot of time. But could also be very fast, I don't know
Back to top
View user's profile Send private message
vincent-
Retired Dev
Retired Dev


Joined: 13 Jan 2007
Posts: 415
Location: Valencia (Spain)

PostPosted: Thu Aug 13, 2009 10:20 am    Post subject: Reply with quote

I mean connect to the server using a PC on the same local network (connected to the same router), to discard that Internet conection is slow between the clients and your server.
Back to top
View user's profile Send private message
Letharion
Veteran
Veteran


Joined: 13 Jun 2005
Posts: 1344
Location: Sweden

PostPosted: Thu Aug 13, 2009 10:34 am    Post subject: Reply with quote

peratu wrote:
I mean connect to the server using a PC on the same local network (connected to the same router), to discard that Internet conection is slow between the clients and your server.


I realised that just recently too, that there's a much easier way of getting to the local network. Why bring the mountain to me when I can go there? ;)
I will head over to the local net and see what happens.
Back to top
View user's profile Send private message
clouds222
Apprentice
Apprentice


Joined: 13 Jul 2009
Posts: 187
Location: Shanghai

PostPosted: Fri Aug 14, 2009 2:20 am    Post subject: Reply with quote

Letharion

Have you enabled MPM? this enable your server to creat multi-threads to process the http requests.
you can add mpm support to your apache server by:
Code:

USE="threads apache2_mpms_worker" emerge --newuses apache php


also you can use " apache2_mpms_prefork" or "apache2_mpms_event"

and then, configure your mpm configuration files located at: /etc/apache2/modules.d/00_mpm.conf

Code:


<IfModule mpm_worker_module>
        StartServers            2
        MinSpareThreads         25
        MaxSpareThreads         75
        ThreadsPerChild         25
        MaxClients                      150
        MaxRequestsPerChild     10000
</IfModule>





though this will do better to your server.
other ways to make your server faster is to enable compress output. You can look at the other posts of the forum.
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Fri Aug 14, 2009 2:52 am    Post subject: Reply with quote

two cents - I recommend prefork
I'm posting from the crapper, so not convenient to go into detail as to why
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
clouds222
Apprentice
Apprentice


Joined: 13 Jul 2009
Posts: 187
Location: Shanghai

PostPosted: Fri Aug 14, 2009 7:35 am    Post subject: Reply with quote

Well, you can choose which module to use by actual application. And you may need to read the difference between each other from the documents:

http://www.apache2.es/2.2.2.en/mpm.html


Quote:
The server can be better customized for the needs of the particular site. For example, sites that need a great deal of scalability can choose to use a threaded MPM like worker or event, while sites requiring stability or compatibility with older software can use a prefork.
Back to top
View user's profile Send private message
Letharion
Veteran
Veteran


Joined: 13 Jun 2005
Posts: 1344
Location: Sweden

PostPosted: Fri Aug 14, 2009 8:20 am    Post subject: Reply with quote

Thanks, I've read on the different mpms, and it looks like I can basically choose from worker or prefork.
I'm currently using prefork, so maybe I'll try the worker. I talked to the admin of the network on the other end, and he said he'd seem the problem before, so maybe it's there. Will investigare further :)
Back to top
View user's profile Send private message
lesourbe
l33t
l33t


Joined: 24 Nov 2005
Posts: 710
Location: Champagne !

PostPosted: Fri Aug 14, 2009 8:36 am    Post subject: Reply with quote

I'll try to investigate with these tools first :
fireplug
wireshark

and try to trigger the issue.
_________________
Is that a banhammer ?
LeSourbe, Member of EPowerforce.
Back to top
View user's profile Send private message
Letharion
Veteran
Veteran


Joined: 13 Jun 2005
Posts: 1344
Location: Sweden

PostPosted: Wed Aug 26, 2009 12:49 pm    Post subject: Reply with quote

I'm currently on the local network, logged in with putty, and browsing a trac-site. It's a bit faster, but still really, really slow.
fire"plug"?
If you mean firebug, that sounds like a good idea. Never heard of a plug, nor does google reveal anything intersting.
Wireshark also sounds interesting, but I fear that I might get more information than I'm able to interpret.
Back to top
View user's profile Send private message
lesourbe
l33t
l33t


Joined: 24 Nov 2005
Posts: 710
Location: Champagne !

PostPosted: Wed Aug 26, 2009 3:07 pm    Post subject: Reply with quote

Letharion wrote:
I'm currently on the local network, logged in with putty, and browsing a trac-site. It's a bit faster, but still really, really slow.
fire"plug"?
If you mean firebug, that sounds like a good idea. Never heard of a plug, nor does google reveal anything intersting.
Wireshark also sounds interesting, but I fear that I might get more information than I'm able to interpret.


indeed I mistyped firebug.
Wireshark allow live capture and filtering, it helps analysis.
_________________
Is that a banhammer ?
LeSourbe, Member of EPowerforce.
Back to top
View user's profile Send private message
Letharion
Veteran
Veteran


Joined: 13 Jun 2005
Posts: 1344
Location: Sweden

PostPosted: Thu Aug 27, 2009 8:13 am    Post subject: Reply with quote

Host thinks there's an issue with the VM-server, it will be reinstalled. Will await results of this.
Back to top
View user's profile Send private message
Letharion
Veteran
Veteran


Joined: 13 Jun 2005
Posts: 1344
Location: Sweden

PostPosted: Wed Nov 18, 2009 12:51 pm    Post subject: Reply with quote

Ok, long long overdue.
A faulty switch had been replaced on the host side, however, my problem remained.

After playing around a bit with the kernel looking for configuration mistakes, Trac got an "Internal Error". I don't know what I did to cause this, but quickly found a fix on google that I applied to httpd.conf.
After that Trac isn't that slow anymore. Otherwise, the server doesn't feel much faster, but Trac loads in less than a tenth of what it used to.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum