pysome has asked for the wisdom of the Perl Monks concerning the following question:
My fellow prepared some data at front-end.He insert our customers' info into DB (say :msg_DB)
.
The frequency is about 30 items per minute.
Then i need to take the data that he insertd into msg_DB, compose of them with customized HTML template.
Subsequently,I send the data to our customers by SMTP server (At the same time,i mark the corresponding costomers'
info in msg_DB to "already sent").
Now the problem is my program is slower than my fellow insert into the msg_DB . As a result,our customers will
wait for a long time to recive their mail!
My program is a deamon.The Pseudocode is :
What's about this method? Whether or not i need use multi-thread process to speed my program ? Pls make suggestions to me:)while (1) { $sth = $dbh->prepare(qq{select * from customers where mark=0}) +; $sth->execute() or die "$DBI::errstr\n"; while ($sth->fetch) { my $content = construct_the_customers_template(); send_customer_mail($coutnet); mark_the_flag_in_msgdb(); # set the mark field to 1 ,repr +esent has sent! } }
Regards,
pysome
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to speed the mail process?
by grinder (Bishop) on Aug 27, 2007 at 12:36 UTC | |
|
Re: how to speed the mail process?
by moritz (Cardinal) on Aug 27, 2007 at 12:18 UTC | |
|
Re: how to speed the mail process?
by derby (Abbot) on Aug 27, 2007 at 12:47 UTC | |
|
Re: how to speed the mail process?
by fmerges (Chaplain) on Aug 27, 2007 at 13:13 UTC | |
|
Re: how to speed the mail process?
by ides (Deacon) on Aug 27, 2007 at 14:07 UTC | |
|
Re: how to speed the mail process?
by rir (Vicar) on Aug 27, 2007 at 16:19 UTC |