• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

DBIAgent/H06-Dec-2005-508179

t/H06-Dec-2005-2114

ChangesH A D01-Dec-20051.7 KiB4328

DBIAgent.pmH A D01-Dec-200517.8 KiB649192

MANIFESTH A D30-Oct-2003170 109

META.ymlH A D06-Dec-2005498 1614

Makefile.PLH A D08-Nov-2001290 1311

READMEH A D17-Sep-20042 KiB4233

README

1POE::Component::DBIAgent 0.10 README
211-07-01
3
4The DBIAgent is your answer to non-blocking DBI in POE.
5
6This module was written because I was developing a system that was
7bogging down at ONLY 1 million hits/day on dual 1GHz processors.
8That's only 11.5 requests/second!  Needless to say, it was obvious
9that something wasn't working right.
10
11After much sweat, research, and profiling, I noticed an odd thing:
12Sometimes, my per-request times were in the milliseconds.  Other
13times, it was taking over 25 seconds to answer a single request.  The
14difference?  DBI.  During the times that my response times sucked, POE
15was blocking on a DBI request.  I was actually serving my requests,
16all code considered, in milliseconds.  But in the steps between
17assembling the response and delivering it, my program was stuck in a
18state that was making a DBI call, and waiting for the response.
19
20The answer?  FORK!  Or, more specifically, use POE's facility for
21forking off child processes to handle long-running tasks while the
22main program continues to cycle between states: Wheel::Run.
23
24DBIAgent forks off a configurable number of helper processes for
25running DBI queries.  The states that depend on the output of the
26queries only get called when there is data for them to process.  No
27more agonizing about query optimization in terms of milliseconds
28because the rest of your program will suffer.  Leave that to the
29operating system!  POE is designed for doing a lot of things
30concurrently.  Waiting isn't doing, it's waiting... :-)
31
32This module will ONLY work in the places where POE::Wheel::Run will
33work.  This generally means, *nix.  Meaning, not on Windows (yet).
34
35I can't take most of the credit for this module.  Fletch
36(fletch@fletch@phydeaux.org) had already done alot of this, and
37contributed the skeleton code for the Helper module.  The Queue module
38is 99.6% his.  I just packaged it up and wrote docs... (*his* was tied
39into his program... *I* made distributable. :-)
40
41Rob Bloodgood <rob@exitexchange.com>
42