Re: Sharing a DBI::Mysql database connection with your children
Re: Sharing a DBI::Mysql database connection with your children
am 31.03.2008 19:06:38 von xhoster
Andrew DeFaria wrote:
>
> I have a process I was thinking of making into a multithreaded daemon
> that deals with a MySQL database. The thought is that the daemon would
> open the database once, then listen for clients. As clients connected
> the daemon would fork off a copy of itself and handle the requests. This
> would make the process faster because I wouldn't need to open the
> database every time a new client wanted service.
On my system it takes less than one millisecond to open a connection
to a MySQL server (located on a different system.) Do you find that
connection time problematic? This is about the same amount of time
it takes to fork in the first place.
> However, I've found that once I fork the database handle (obtained
> through DBI) is no longer valid. Reading around a little bit I noticed
> people saying to reopen or reconnect to the database in the child.
Yes, true.
> Well
> that's the very time consuming thing
I find that hard to believe.
> I was trying to avoid!
>
> Does anybody know how to open a MySQL database such that that database
> connection can be used in forked children?
I don't. I rather doubt other people do, either. Maybe your server
should handle requests internally rather than forking.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
Re: Sharing a DBI::Mysql database connection with your children
am 31.03.2008 20:22:17 von szr
xhoster@gmail.com wrote:
> Andrew DeFaria wrote:
>>
>> I have a process I was thinking of making into a multithreaded daemon
>> that deals with a MySQL database. The thought is that the daemon
>> would open the database once, then listen for clients. As clients
>> connected the daemon would fork off a copy of itself and handle the
>> requests. This would make the process faster because I wouldn't need
>> to open the database every time a new client wanted service.
>
> On my system it takes less than one millisecond to open a connection
> to a MySQL server (located on a different system.) Do you find that
> connection time problematic? This is about the same amount of time
> it takes to fork in the first place.
Normally this would be true, if the MySQL server is on the same network,
but if it's not, connection time depends entirely on the latency between
the OP's running system and the MySQL server, such is the case if it is
across the internet; it will surely take longer than a millisecond. But
then again, that would hardly be an ideal setup, but it's not unheard
of.
--
szr
Re: Sharing a DBI::Mysql database connection with your children
am 01.04.2008 07:02:11 von Andrew DeFaria
This is a multi-part message in MIME format.
--------------060102070906040004010008
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
xhoster@gmail.com wrote:
> On my system it takes less than one millisecond to open a connection
> to a MySQL server (located on a different system.) Do you find that
> connection time problematic? This is about the same amount of time it
> takes to fork in the first place.
I'm sorry. I didn't officially measure it. I remember another DBMS being
extremely slow so I assume it. Will you ever forgive me?
--
Andrew DeFaria
Disk Full - Press F1 to belch.
--------------060102070906040004010008
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
wrote:
cite="mid:20080331130640.144$or@newsreader.com" type="cite">On my
system it takes less than one millisecond to open a connection to a
MySQL server (located on a different system.) Do you find that
connection time problematic? This is about the same amount of time it
takes to fork in the first place.
I'm sorry. I didn't officially measure it. I remember another DBMS
being extremely slow so I assume it. Will you ever forgive me?
--
Disk Full - Press F1 to belch.
--------------060102070906040004010008--
Re: Sharing a DBI::Mysql database connection with your children
am 01.04.2008 14:46:26 von 1usa
Andrew DeFaria wrote in
news:47f1c1d6$0$89385$815e3792@news.qwest.net:
> I'm sorry. I didn't officially measure it. I remember another DBMS
> being extremely slow so I assume it. Will you ever forgive me?
> --
> Andrew DeFaria
> Disk Full - Press F1 to belch.
>
> Attachment decoded: untitled-2.txt
> --------------060102070906040004010008
>
>
>
I may consider it if you stop posting HTML attachments.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
Re: Sharing a DBI::Mysql database connection with your children
am 02.04.2008 01:01:45 von Tad J McClellan
A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> Andrew DeFaria wrote in
> news:47f1c1d6$0$89385$815e3792@news.qwest.net:
>
>> I'm sorry. I didn't officially measure it. I remember another DBMS
>> being extremely slow so I assume it. Will you ever forgive me?
>> --
>> Andrew DeFaria
>> Disk Full - Press F1 to belch.
>>
>> Attachment decoded: untitled-2.txt
>> --------------060102070906040004010008
>>
>>
>>
>
> I may consider it if you stop posting HTML attachments.
Please don't tell him how to post.
http://groups.google.com/group/comp.lang.perl.misc/msg/1a331 dca40c4d90a
Nobody else here ignores that netiquette, simply spend your
time answering their questions instead.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"