4

My apache is limiting connections Per vhost. Not sure if this has anything to do with it but I am using NameVirtualHost.

Here is part of my config I don't see what's wrong with it:

<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
</IfModule>

<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75 
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

It queues the connections so each request is queued after eachother, making everything take longer to load!

Edit: Here are all the modules being loaded

LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so

I'm thinking it might have to do with one of these modules, but I have no idea! Thanks for any help or tips guys.

Jake
  • 41
  • 1
  • 1
  • 4
  • Which MPM are you using, prefork or worker? What Linux distribution are you using? Are you using the default package and the default configuration apart from the virtual hosts config? If you're unsure about the worker and on Debian or Ubuntu post the output of `dpkg-query -l | grep apache2`. – Eduardo Ivanec Jun 02 '11 at 22:39
  • @Eduardo Ivanec thanks for the reply. That command didn't work on RHEL. How do I tell which MPM I am using on RHEL? I'll try to look it up and if I find it I'll post here. Thanks so much. – Jake Jun 06 '11 at 18:19
  • @Eduardo Ivanec Okay I typed `httpd -l` and it shows `prefork.c` is the one being used. I am 100% sure apache is only allowing one simultaneous connection per-client (i'm assuming IP?) per-vhost. When I run a test opening 6 iframes of a php file, each one only starts loading after the last one finishes. – Jake Jun 06 '11 at 19:29

3 Answers3

1

Apache does not limit connections per Virtual Host, not unless you are using an extra 3rd party module.

What is happening is your MPM settings (as above) have a limit on the maximum number or requests/connections that will be allowed in terms of how may processes (or threads) are used.

What you do next depends on which MPM you are using... One that is thread based, one that is process based, how PHP is set up (as a separate process / cgi, or as an Apache module), etc.

http://httpd.apache.org/docs/2.2/mod/worker.html

http://httpd.apache.org/docs/2.2/mod/prefork.html

Also try playing with the KeepAlive settings.

KeepAlive On
KeepAliveTimeout 1
rightstuff
  • 630
  • 1
  • 5
  • 6
  • Hi thanks for the reply. I have KeepAlive on KeepAliveTimeout 15 Does it matter that the "on" on KeepAlive was lower case? – Jake Jun 06 '11 at 18:17
  • By the way the server is using prefork too. It's just not allowing more than 1 connection at a time per virtualhost. If put php scripts that "sleep" in iframes, each one does not start executing until the one before it finishes. Could this be a php issue? – Jake Jun 06 '11 at 21:05
1

mod_cband can do this, http://codee.pl/cband.html

You would see it in the form of lines like this in your virtualhost:

    # limit speed of this vhost to 10Mbit/s, 10 request/s, 30 open connections
    CBandSpeed 10Mbps 10 30

Since you are trying to ensure it doesn't happen, this may not be it, but this is something to look for.

Neil Neely
  • 466
  • 3
  • 5
0

I figured it out, it was PHP not apache!

Jake
  • 41
  • 1
  • 1
  • 4