Every month or two a swarm of robot visits my site on a managed server and opens up connections so fast that my current max_user_connection value of 25 (will increase it to 75) is reached. Currently I restart the server and it works fine again until the next swarm comes. It is a webshop programmed in perl which tries to get the data using DBI connect, like this :
$db=DBI->connect('dbi:mysql:******');
$query = $db->prepare("SELECT * FROM `Tablename` WHERE 1 AND `artnr`
+ = '$link' ORDER BY id DESC LIMIT 0 , 25;");
$query->execute();
while (my @row = $query->fetchrow_array()){
(datas like name etc,*,*) = @row;
print "Shoppage"
}
$query->finish;
$db->disconnect();
There are some more connections in the same script looking for a cart and an whitelist name.
So I have some questions : Will the problem solve itself after some time or will the open process run until reset and try to get infos from the locked DB ? Is it possible to do a small query to check for max user connections on the DB to exit if it is to high ? Any other idea to get protection from DOS attacks or bot swarms (thought about rectriciting Asian IPs in htaccess or using HTTP::BrowserDetect) ?
Thanks for you time any maybe Help !
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.