[cgiapp] Threading Question
Kurt Lidl
kurt.lidl at cello.com
Tue Nov 17 10:31:02 EST 2009
On Tue, Nov 17, 2009 at 11:22:59AM +0000, Mike Tonks wrote:
> I'm just considering a problem that I think requires a bit of multi-threading.
>
> It's a new one for me so wondered if anyone has advice or experience
> of using threading with CGI::Application.
I expect that you'll run afoul of DBI's limitation on working
with threaded perl. While it kinda works, the DBI documentation
says that using threads with DBI (even if you work around
the various issues with making it work) isn't recommended for
production environments.
> Scenario is: We have 5 database servers at different sites. We would
> like to create a search function that queries all of the databases.
> The web server is on an intranet and can open connections to all of
> the database servers.
Why not just open up 5 database handles and execute the queries.
The queries should run in parallel, and you can choose how to
interleave the processsing of the result sets however you want.
> Also I guess there could be server issues with the use of multiple threads?
There's also the DBIx::Threaded stuff, which spawns off additional
threads and gives you an API for accessing those threads (and the
database handles bound to them), but it all looks pretty scary to me.
-Kurt
More information about the cgiapp
mailing list