Our Event Webhook
is a great way to get a realtime view of what's going on with the emails you're sending from your application. However, a sudden spike in the amount of events coming back to your app could cause problems - especially if your webhook endpoint is on the same production server as the rest of your app.
It would probably be good to know just how many events your app can handle before you see some degradation in performance, or maybe you split off your event notifications collection script on a totally different server.
A quick and easy way to find out just how much of a hammering your app can take is to use Loader.io from SendGrid Labs. Here's what you should do:
- Get a free account from Loader.io
- Log in and click "Create New Test"
- Name your test
- Set up your test like so:
This will be like receiving 250 events over a 2 minute period. You can change these settings as much as you want to really hammer your app.
- Next set the URL you want to test and make the request type POST so that you are mimicking what the Event Webhook would be doing.
- Click the "Configure URL options" link to expand the options for what you'll be posting.
- In POST Options > Body paste the following event data:
- Click on "Start this test now" and watch those hamsters fly!
Loader's free plan lets you test up to 10,000 requests in one minute.
Typically, this kind of stress testing tells you how your app will perform under heavy load. It would be wise to run a test like this before any expected surges in email sending so you can ensure that you will be able to handle the amount of events coming back.
Remember that the event notifications can be batched so they send roughly every 1 second or when the queue size hits 1MB (whichever is sooner). You can grab a larger batch request to include in your POST body from the "Test your integration" section of the Events settings page, or from this Gist
The speed and ease of use of a tool like Loader.io
means you can experiment quickly and easily, play with the types of test and change settings fast to ensure you get the best results from your app. Don't be afraid to play with it and tweak the settings.