开发者

What's a good number of emails per hour sent from an ASP.NET C# script on a Windows server?

We are regularly sending out bulk emails (no spam, of course, just newsletters) for our 开发者_如何学运维customers, using Windows 2003, 2008 and 2008 R2 servers in Germany and the USA, and the number of mails we manage to send in one hour varies between 5.000 and 12.000, depending on whether we use a pickup folder, the local SMTP or a commercial SMTP server. We are using simple straightforward scripts with standard .NET libs or MailBee components.

Is that good? Average? Bad? Is there any obvious bottleneck (i.e. would it make sense to write a multi-threaded scripts or is it the connection to the mail server that limits the speed?)?


There are a few things that will limit the performance of this process outside of any code you've written.

  1. The Internet bandwidth on the server that is sending the emails.
  2. To where these emails are sent. That is your smtp server eventually has to connect and communicate with email recipient's email provider's server in order to send an email. Some servers are slow, some are busy and just take a long time to connect.

As regards using multiple threads to speed it up, Well, where is the slow down?

Email sending (and receiving) is mostly an I/O bound task. throwing threads at this problem may or many not improve performance. It all depends on if there is a bottleneck (in code) somewhere are are you just limited by the processing power or bandwidth of the server.

Check out this SO post I answered where I provided a multi-threaded solution that might help. Essentially it uses a parallel programming technique called "Data Parallel" where the workload is essentially broken up into multiple chunks and each chunk is then processed by a thread keeping the number of chunks the same as (or close to) the number of cores on the machine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜