Actually he did indicate running Linux on a dual processor system, so the OS should support running separate threads on separate processors. The question then would be: does Perl multithreading, along with the DBI library, let you make use of this?
Of course you might be right, the program could be I/O bound due to all the database work. This would have to be instrumented. -Will -----Original Message----- From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED] Sent: 2 December 2008 12:16 To: Davide Sacchetti Cc: [email protected] Subject: Re: DBI + ithreads performances On Tue, 2008-12-02 at 18:01 +0100, Davide Sacchetti wrote: > I need to fetch data from two different database (A and B). > > I wrote a sequential code fetching from A and, after the fetch is > finished, from B. > Then I tried to use threads: I splitted the fetches into 2 threads: > each > one makes its own connection to A or B and fetches his data. > Apparently the threaded code works but the fetches are slower (about > half) compared to the sequential code. > > Is it a known issue or am I doing something wrong? > Thanks for any hint ... > You are doing nothing wrong. Unless your OS supports running threads on different processors, threading will be slower than sequential processing. If your databases are on the same disk, trying to access them simultaneously will slow the access and cause greater slow downs than threading. -- Just my 0.00000002 million dollars worth, Shawn The key to success is being too stupid to realize you can fail. - - - - - Cisco - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
