Using WebSurge to load test our endpoint

We must load test our API endpoints to verify that they perform appropriately under load. It is far better to find a performance issue in the development process before our users do. WebSurge is a simple load testing tool that we are going to use to test our questions endpoint with the N+1 problem. We are going to perform the load test in our development environment, which is fine for us to see the impact the N+1 problem has. Obviously, the load testing results we are going to see would be a lot faster in a production environment:

  1. Run the REST API by pressing F5 if it's not already running.
  1. Open WebSurge and click the New option on the Session tab. Fill in the request details on the Request tab in the right-hand pane for a GET request to api/questions/includeanswers=true:

  1. To check that the request is correct, press the Test button at the bottom of the right-hand pane. We'll see the response we expect:

  1. We are nearly ready to do the load test now. Let's specify that the test will run for 30 seconds with 5 threads by filling in the relevant boxes under the toolbar:

  1. Let's run the load test by clicking the Start button. We'll immediately see requests being made in the Output tab in the right-hand pane:

  1. When the test has finished, we'll see the test results in the Output tab in the right-hand pane:

So, we managed to get 9.47 requests per second with this implementation of getting questions with answers. Obviously, the result you get will be different. 

  1. Stop the ASP.NET Core app from running by pressing Shift F5 so that you're ready to make the implementation more efficient.

Keep a note of the results—we'll use these in a comparison with an implementation that resolves the N+1 problem next.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.198.132