Mandrill speed with PHPMailer was fast, now slow, why? - performance

I'm using PHPMailer to send customized emails. The PHP script sends the email and then records the time each email is sent in a text file. On 12/18/14 the speed for sending was an average of 441 emails per minute, which is about the speed since I started using Mandrill a few days before that. But on 12/19/14 it was significantly slower at 25 emails per minute and has been that slow every day since then as well. What could be causing this?

Are you sending your emails via SMTP? I also use Mandrill with PHPMailer and saw how the sending speed using SMPT was significantly slower.
You can read all about it here Mandrill Blog: Making SMTP fast

Related

Performance improvement idea about saving large number of Objects into the dabatase

My web application has one feature where it allows the user to send messages to all friends. The number of friends can be 100K to 200K. The application is using Spring and Hibernate.
It entails fetching the friends' info, building the message object and saving it to the database. After all the messages are sent (actually saved to the db), a notification will popup showing how many messages are sent successfully such as 99/100 sent or 100/100 sent.
However, when I was load testing this feature. It took an extremely long time to finish. I am trying to improve the performance. One approach I tried was to divide the friends into small batches and fetch/save each batch concurrently and wait on all of them to finish. But that still didn't get too much improvement.
I was wondering if there are any other ways I can try. Another approach I can think of is to use WebSockets to send each batch and update the notification after each batch and start the next batch until all the batches are sent. But how can the user still get the notification after he navigates away from the message page? The Websocket logic on the client side has to be somewhere global, correct?
Thank you in advance.

Email batches via AWS SES, ideas?

I have an SaaS application where each paying customer may have thousands of members they may want to send emails to every now and then.
For now, simple BCC sending via AWS SES have done the trick, but now I am looking at sending personalized emails so I must be able to send the emails one by one.
SES does not have any queue system as per my knowledge, you must make an API call per email. In short, it takes forever to send a batch (my limit is 14 per second), and the user cannot close the page while it is executing (even AJAX calls stop executing if you leave the page, am I right?).
I was thinking of building a system where I store the emails in a database table and then either:
1) Use a CRON that executes every 5 seconds or so, grab a few emails and send them.
2) Execute an AJAX script each 5 seconds that grabs the emails for said logged in customer in a batch ONLY and send them out, but again, if the customer logs out while it executes chances are that specific a batch is interrupted (the remaining ones would still keep sending the next time the customer logs in).
Does any have any better ideas? Or, which of the two above would be preferred?
You should use templates and the SendBulkTemplatedEmail endpoint that AWS introduced a few months ago: https://aws.amazon.com/blogs/ses/introducing-email-templates-and-bulk-sending/.
That way you can send up to 50 personalized emails with a single SES API call. So 700 with 14 calls.
You shouldn't consider queuing them up in a user's browser and sending them by making a series of AJAX requests though. You should only send one Ajax request to start a job. In most server-side languages (any I can think of) you can respond to an HTTP request and still continue doing processing after responding. You can also implement a progress checker in a multitude of ways.
Use a cronjob that sends to the SES SMTP server. This way you can personalize the emails and also control how many emails to send. Your cronjob can sleep in between each batch of emails.
You can use celery to run background job. A user submits a request on a webpage which starts a background job through celery. The background job take care of sending emails. Once sending emails is completed, inform the user by email.
http://www.celeryproject.org/

Amazon SNS performance

We are working on a system were we will need to send push notifications to thousands of phones. We have set this up using Amazon SNS. We will be sending individual messages to each phone so we are sending direct to SNS Endpoint ARNs rather that Topic ARNs.
We are currently wondering about the performance of this system. I've not been able to find anything on the net talking about how many messages can be sent to SNS. For example, if I need to send 25,000 messages to 25,000 SNS end points, how fast can I send them? Seconds, minutes, hours?
I know there is a lot of things that can impact this, but I'm trying to find some indicative numbers so we can work out how simple or complex we might need to make the software doing the sending and hopefully avoid over-engineering our solutions.
Thanks for any info.
Okies. Don't worry. I've run a test where I wrapped a loop around the send function and sent myself 25,000 push notifications. Had to shut my phone down, but the end result was around 13 sends per second or approximately 30 minutes to send 25,000. Not bad given the variables of network latency etc and enough to indicate to use the sorts of architectures we will need to add to the software.

Google C2DM server side performance

My application sends notifications to the customers in bulks. For example at 8am every day a back-end systems generates notifications for 50K customers, and those notifications should be delivered in a reasonable time.
During performance testing I've discovered that sending a single push request to C2DM server takes about 400 millis which is far too long. I was told that a production quota may provide better performance, but will it reduce to 10 millis?
Besides, I need C2DM performance marks before going to production because it may affect the implementation - sending the requests from multiple threads, using asynchronous http client etc.
Does anyone knows about the C2DM server benchmarks or any performance-related server implementation guidelines?
Thanks,
Artem
I use appengine, which makes the delivery of a newsletter to 1 million users a very painful task. Mostly because the c2dm API doesn't support multiple users delivery, which makes it necessary to create one http request per user.
The time to the c2dm server to respond will depend on your latency from the google servers. In my case (appengine) it's very small.
My advice to you is to create as many threads as possible, since the threads will be waiting for the IO over the network. If you every pass the quota, you can always ask permission for more traffic.

How to send emails without speed limit?

I got some errors about sending mails too quick in 15 minutes when sending mails.
It seems there is a speed limit of sending mails.
But how many mails can be sent in 15 minutes?
Is this a standard or private rule based on vendor?
It depends on both your mail service provider, and also the target system. For example gmail will let you send 500/1000 (or more) emails per day, per account depending on your agreement with them.

Resources