It's probably a safe bet to say that the slowness is the sending of the mail, not the database access. Whack a

use Time::HiRes;

...at the top of the program and then instrument the time it takes to send the message:

my $begin = time; send_customer_mail($coutnet); my $delta = time - $begin; warn "Well that took $delta seconds\n";

I wager you're seeing significant times being eaten right there.

Be that as it may, two messages per second is stunningly slow. Are you trying to connect to the remote MX directly from your script? I would inject the messages to a local MTA and let it deal with the delivery.

I use Postfix at $work, and my untuned configuration will let me queue several hundred messages per second, if not more. And there are other MTAs like qpsmtpd (written in Perl, natch), which are faster still.

Another consideration to keep in mind is that just because you sent a message, doesn't mean the recipient received it... you need to check your outbound SMTP queue and check that it's been delivered (and not rejected) to the remote destination (but even then it may get dropped on the floor, filed as spam, or bounced back to you for any number of legitimate reasons).

• another intruder with the mooring in the heart of the Perl


In reply to Re: how to speed the mail process? by grinder
in thread 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.