For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > July 2006 > How to use threads to parallelise 4 different DB connections?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to use threads to parallelise 4 different DB connections?
anju

2006-07-27, 3:59 am

Hi ,

My script is making connection to the four databases one by one and
writing the output to a single excelsheet. But there being huge
records, its taking too much time ( 4 hours), which is not acceptable.

So I need to synchronise the process so that the connection is made to
all the 4 DBs at one time and they run parallely.

I tried using Perl threads/ ithreads for the same but its giving
problem, like handles can't be shared , use clone() method etc. etc.

Can you please advice how can I do the same?

Please reply ASAP.

Many Thanks in advance.

Regards,
Anju

Nick of course

2006-07-27, 7:59 am


anju wrote:
> Hi ,
>
> My script is making connection to the four databases one by one and
> writing the output to a single excelsheet. But there being huge
> records, its taking too much time ( 4 hours), which is not acceptable.
>
> So I need to synchronise the process so that the connection is made to
> all the 4 DBs at one time and they run parallely.
>
> I tried using Perl threads/ ithreads for the same but its giving
> problem, like handles can't be shared , use clone() method etc. etc.
>
> Can you please advice how can I do the same?
>
> Please reply ASAP.
>
> Many Thanks in advance.
>
> Regards,
> Anju


I'm assuming that the excessive time taken is due to database access
and/or intermediate processing - there is no way it can take 4 hours to
write to a spreadsheet; they just don't get that big. Use four
separate processes (not threads) running in parallel that write to
intermediate files (maybe use Storable for efficiency) then a final
process to write the spreadsheet. As a solution, it is a lot simpler
and more robust than using threads.

Dr.Ruud

2006-07-27, 6:59 pm

anju schreef:

> Please reply ASAP.


Right after your donation:
http://donate.perl-foundation.org/i...tails&selfund=2
http://donate.perl-foundation.org/i...tribution%20FAQ

--
Affijn, Ruud

"Gewoon is een tijger."



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com