Hi Monks: I came across a boring problem. Pls help me to solve it,Any suggestion will be appreciated
The issues process is as following:

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 :

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! } }
What's about this method? Whether or not i need use multi-thread process to speed my program ? Pls make suggestions to me:)

Regards,
pysome


In reply to how to speed the mail process? by pysome

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.