MaxClients per vhost, no using shared memory and global lock. mod_vhost_maxclients use only scoreboad for stability, high compatibility and simple implementation.
C Ruby Shell Roff Makefile
Clone or download
matsumotory Merge pull request #16 from takumakume/fix_ci
Update httpd for travis-ci
Latest commit 882497d Jul 31, 2017
Permalink
Failed to load latest commit information.
test Add test case Apr 17, 2017
.clang-format first commit Aug 28, 2015
.gitignore Refactor test Apr 6, 2017
.travis.yml
LEGAL Add license information Aug 28, 2015
MITL Add license information Aug 28, 2015
Makefile
README.md
mod_vhost_maxclients.c add r->filename null check because segv Jul 31, 2017

README.md

mod_vhost_maxclients Build Status

mod_vhost_maxclinets provides the feature of MaxClients per vhost, no using shared memory and global lock. This module use only scoreboad for stability(no dead-lock), high compatibility and simple implementation.

It supports Apache httpd 2.2.x and 2.4.x, and worker, prefork and event mpm.

If you have a performance issue using mod_vhost_maxclients like over-head of serving static contents, You should use IgnoreVhostMaxClientsExt for ignoring the static contents.

Notice: vhost length in scoreboard is 32 bytes. it's versy short. If you control more length of vhost name by mod_vhost_maxclients, you should apply a patch like example for httpd 2.4.x.

Quick Install

  • build
make
make install
  • conf.d/mod_vhost_maxclients.conf
LoadModule vhost_maxclients_module modules/mod_vhost_maxclients.so
# mod_vhost_maxclinets use scoreboard
ExtendedStatus On
include /path/to/vhost.conf
  • /path/to/vhost.conf
# separate vhost maxclients
# VhostMaxClientsLogPath /usr/local/apache/logs/vhost_maxclients.log

<VirtualHost *>
    DocumentRoot /path/to/web
    ServerName test001.example.jp

    # MaxClients per vhost using mod_vhost_maxclients
    VhostMaxClients 30
    # Ignore extensions from VhostMaxClients for a performance issue
    # IgnoreVhostMaxClientsExt .html .js .css

    # MaxClinets per client ip-address to the same vhost
    # VhostMaxClientsPerIP 5

    # dry-run option which don't return 503, logging only
    # VhostMaxClientsDryRun On

    # logging only option which don't return 503, logging only
    # VhostMaxClientsLogOnly 10
    
    # Time to enable the VhostMaxClients from 17:00 to 23:00 
    # VhostMaxClientsTimeSlot 1700 2300

    # Ignore Requests if it match regular expression.
    # IgnoreVhostMaxClientsRequestRegexp '[jpg|gif|png] HTTP/1.[01]$'


</VirtualHost>
  • logggin
[Thu Aug 27 21:16:54.540685 2015] [vhost_maxclients:debug] [pid 23981] mod_vhost_maxclients.c(93): DEBUG: (increment test001.example.jp:80): 1/3
[Thu Aug 27 21:16:54.540708 2015] [vhost_maxclients:debug] [pid 23981] mod_vhost_maxclients.c(93): DEBUG: (increment test001.example.jp:80): 2/3
[Thu Aug 27 21:16:54.540713 2015] [vhost_maxclients:debug] [pid 23981] mod_vhost_maxclients.c(93): DEBUG: (increment test001.example.jp:80): 3/3
[Thu Aug 27 21:16:54.540716 2015] [vhost_maxclients:debug] [pid 23981] mod_vhost_maxclients.c(93): DEBUG: (increment test001.example.jp:80): 4/3
[Thu Aug 27 21:16:54.540726 2015] [vhost_maxclients:notice] [pid 23981] NOTICE: (return 503 from test001.example.jp:80): 4/3

License

under the MIT License: