You are here: Re: How do I limit my number of PHP hits per second? « PHP Programming Language « IT news, forums, messages
Re: How do I limit my number of PHP hits per second?

Posted by Toby A Inkster on 02/01/07 10:46

Nu wrote:

> I can't find how to do that. Can it be done in PHP, htaccess, etc.

Firstly, are you on a shared host? If so, then ensuring quality of
service is really your hosting provider's job. If one site on a server is
using up a massive portion of the server's capacity (with regards to
bandwidth, CPU, memory or disk space) then this impacts *all* the sites on
that particular server, so it's their responsiblity to either throttle that
site or request that its administrator purchases a more expensive hosting
package so that it can be moved onto a server with fewer other sites.

If you're on a dedicated host and don't have root access, then get root
access (change your hosting provider if need be).

If you're on a dedicated host with root access, then probably the best
option is to use Apache's mod_cband module <http://mod-cband.com/>. With
this you can add to your httpd.conf something like this:

<VirtualHost>
...
# limit speed of this vhost to 1Mbit/s, 10 request/s, 30 open connections
CBandSpeed 1Mbps 10 30
# in addition every remote host connecting to this vhost
# will be limited to 100kbit/s, 3 request/s, 3 open connections
CBandRemoteSpeed 100kbps 3 3
</VirtualHost>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/CSS/Javascript/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация