NYCPHP Meetup

NYPHP.org

[nycphp-talk] Urgent: Help in Defending Attack

Dan Cech dcech at phpwerx.net
Thu Feb 28 11:00:35 EST 2008


Randal Rust wrote:
> it is targeted entirely to the one page on the site. if i take it
> down, everything works fine.
> 
> problem is, that's *the* most important page on the site.

To me this doesn't really sound like an attack.  Unless you're getting 
thousands of hits from the same IP it's more likely that your site has 
just reached the point where its resource requirements exceed the 
capacity allocated to it.

It sounds to me like you have an efficiency issue, most likely your 
database connections are not being properly torn down after each page 
view leading to multiple connections hanging around and gumming up your 
mysql connection pool.

Are you using persistent connections? Are you on a shared (vhost) box?

If you answered yes to both questions, you have found your problem. 
You'll end up with a persistent connection for every webserver thread, 
most of which will actually be servicing requests for other sites *but 
still using up one of your connections*.

If you are using non-persistent connections you might want to try 
registering a shutdown function to explicitly tear down the db 
connection, or switching to persistent connections (if you are on a 
dedicated host).

Dan



More information about the talk mailing list