Are You Event Ready? Ensure You Know with Loader.io


January 10, 2014
Written by
SendGrid Team
Contributor
Opinions expressed by Twilio contributors are their own

Are You Event Ready? Ensure You Know with Loader.io

Blown up motherboard. This could be the downside of not stress testing parts of your app.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:
    1. Get a free account from Loader.io
    2. Log in and click "Create New Test"
    3. Name your test
    4. Set up your test like so:test_setup
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.post_url
  • Click the "Configure URL options" link to expand the options for what you'll be posting.body_options
  • In POST Options > Body paste the following event data: [{"email":"john.doe@sendgrid.com","sg_event_id":"VzcPxPv7SdWvUugt-xKymw","sg_message_id":"142d9f3f351.7618.254f56.filter-147.22649.52A663508.0","timestamp":1386636112,"smtp-id":"<142d9f3f351.7618.254f56@sendgrid.com>","event":"processed","category":["category1","category2","category3"],"id":"001","purchase":"PO1452297845","uid":"123456"}]
  • 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.

What can you learn from this test

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.

Play!

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.

Recommended For You



Most Popular


Send With Confidence

Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.