Ok, since there wasnt any replies to this post, I will try to answer your question as completly as possible, giving a few options and ideas for you to toy around with.
To make a long story short, DBI::Proxyserver is a
module that allows you to become a proxy server for
databases. IE your database requests are sent not to
your real database,
but to an intermediary machine with this module
(along with socket code etc..).
As with a any other proxy server, all it does is take
requests, interpret them, and redirect as rules specify. The
keyword here is rules. With DBI::Proxyserver there is a
"configuration" section, which entails the 'accept' paremeter.
if accept param here was set to a maximum of 10 connections that can be queued, anything
above that will be thrown out.
Still, in order to utilize the DBI::Proxyserver, you will have to
use the DBI::Proxy module, which understands how the DBI::Proxyserver
interprets requests.
Another, and in my eyes, a more suitable and cheaper solution
to your problem is to use fork() to "hold back" connections that
your program might make..For example:
#!/usr/local/bin/perl
# How many conncurrent connections do we want to make?
$MAXCHILD = 10;
@pids;
$npids = 0;
for ($i = 0; $i<$MAXCHILD;$i++) {
my $pid;
$pid=fork();
if($pid>0){
$npids++;
if($npids>=$MAXCHILD){
for(1..($MAXCHILD)){
$wait_ret=wait();
if($wait_ret>0){
$npids--;
}
}
}
next;
}
elsif(undef $pid) {
exit(0);
}
else {
CALL_YOUR_DBI_ROUTINE_HERE();
exit(0);
}
exit(0);
}
for(1..$npids){
$wt=wait();
if($wt==-1){
redo;
}
}
Erm...I think thats right. (I have a directory with snippets of useful code Ive used in other programs, and I tailored this one a little just for this example without testing heheh =P)
A third and final thing you could do that I can think of is fine tune your acctuall database options. I know there are maxconnection options in mysql,msql,oracle, but I dont know the exact syntax off hand, but I do know they are pretty well bluntly stated in the documentation.
I hope I helped in some little way.
-cleen
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.