Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load test a Backbone App

I've got an NGinx/Node/Express3/Socket.io/Redis/Backbone/Backbone.Marionette app that proxies requests to a PHP/MySQL REST API. I need to load test the entire stack as a whole.

My app takes advantage of static asset caching with NGinx, clustering with node/express and socket is multi-core enabled using Redis. All that's to say, I've gone through a lot of trouble to try and make sure it can stand up to the load.

I hit it with 50,000 users in 10 seconds using blitz.io and it didn't even blink... Which concerned me because I wanted to see it crash, or at least breath a little heavy; but 50k was the max you could throw at it with that tool, indicating to me that they expect you to not reasonably be able to, or need to, handle more than that... Which is when I realized it wasn't actually incurring the load I was expecting because the load is initiated after the page loads and the Backbone app starts up and kicks off the socket connection and requests the data from the correct REST API endpoint (from different server).

So, here's my question:

How can I load test the entire app as a whole? I need the load test to tax the server in the same way that the clients actually will, which means:

  1. Request the single page Backbone app from my NGinx/Node/Express server
  2. Kick off requests for the static assets from NGinx (simulating what the browser would do)
  3. Kick off requests to the REST API (PHP/MySQL running on a different server)
  4. Create the connection to the Socket.io service (running on NGinx/Node/Express, utilizing Redis to handle multi-core junk)

If the testing tool uses a browser-like environment to load the page up, parsing the JS and running it, everything will be copasetic (NGinx/Node/Express server will get hit and so will the PHP/MySQL server). Otherwise, the testing tool will need to simulate this by firing off at least a dozen different kinds of requests nearly simultaneously. Otherwise it's like stress testing a door by looking at it 10,000 times (that is to say, it's pointless).

I need to ensure my app can handle 1,000 users hitting it in under a minute all loading the same page.

like image 665
cmcculloh Avatar asked Nov 13 '22 00:11

cmcculloh


1 Answers

You should learn to use Apache JMeter http://jmeter.apache.org/ You can perform stress tests with it, see this tutorial https://www.youtube.com/watch?v=8NLeq-QxkSw

As you said, "I need the load test to tax the server in the same way that the clients actually will"

That means that the tests is agnostic to the technology you are using.

I highly recommend Jmeter, is widely used and you can integrate it with Jenkins and do a lot of cool stuff with it.

like image 147
alfonsodev Avatar answered Nov 15 '22 05:11

alfonsodev