[Mono-list] Fwd: Concurrency issue with AWS Simple Email Service REST API

Jørn Schou-Rode jsr at malamute.dk
Wed Jan 23 08:57:53 UTC 2013


Dear Mono experts,

I am in the process of moving an email newsletter service from a Windows
server running Microsoft.NET 4.5 to a Linux server running Mono 3.0.3. The
service uses Amazon's "Simple Email Service" (SES) to deliver the emails,
via the official .NET SDK (wrapping a REST interface) [1].

While sending emails via SES sequentially from Mono turns out to be
slightly faster than Microsoft.NET using similar hardware, I am running
into serious performance trouble when attempting to deliver multiple mails
in parallel. I have experimented a bit and drawn a chart [2] showing the
time required to send 128 emails on both platforms using a varying number
of threads. As you can see, performance on Mono degrades rapidly after 8
threads, and with 128 threads I get only HTTP timeouts – not a single email
is delivered.

Profiling via console output, it turns out that the first "batch" of mails
is the source of the slowdown. With two threads, sending one email in each,
both threads finish in around 2200 ms. With four threads, sending one email
in each, they all finish in around 4400 ms. Eight threads, around 8800 ms,
etc. It seems as if the web service, while spawned simultaneously, are run
sequentially and are required to wait for one another before returning.

Any ideas what might be triggering this behavior? The source code for the
Amazon SDK is available on GitHub [3], but I have not been able to pinpoint
anything suspiciously. Maybe the use of the async methods on HttpWebRequest?

Thanks in advance.

Jørn

[1]: http://aws.amazon.com/sdkfornet/
[2]: http://i.stack.imgur.com/tiuDg.png
[3]: https://github.com/aws/aws-sdk-net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20130123/39e7eb1e/attachment.html>


More information about the Mono-list mailing list