Load Testing Single-Page Application (SPAs)

A Single-Page Application (SPA), also sometimes referred to as a Single-Page Interface (SPI), is a web application or website that “fits” on an individual page and updates the page dynamically, rather than loading a new page.  The main benefit of SPAs is that they provide a more reactive and smoother user experience.  The SPA concept has been around for over 15 years, but only in the last few years has gained traction. Advancements in technology and frameworks have made SPAs a real possibility for developers and organizations.

Web browser JavaScript frameworks, such as AngularJS, Ember, Ext JS, Knockout, React, and Vue all support SPA principles. Some of the largest companies in the world use SPAs, including Google (Gmail), Netflix, Facebook, Trello, and Twitter.

JMeter Load Testing with LoadView

Overcome Your JMeter Load Testing Limitations with LoadView

Multi-Page Applications: A Quick Summary

Most websites and applications operate in the following manner:  A user accesses the Internet via their browser, and they type in a web address. When that happens, the browser sends a request to the server asking it to send the homepage.  Once the page loads, the user navigates through the page, creating additional requests for the server. Any actions, such as clicks or searches, result in another page request. This method, known as Multi-Page Application (MPA), has been how many websites and applications are built today.

Single-Page Applications: The Next Big Thing

Testing Page Applications
Single-page applications on the other hand, use a completely different approach. To a normal user, they may not even realize the difference. If they are paying attention, they will notice that their refresh button in the browser does not reload once the initial page loads.  With a SPA, the browser downloads, saves, and runs a JavaScript program behind the scenes, in an instant.  It is a complete application, as if the user downloaded and installed an application on their computer, but only this time, it is in their browser.

Once this application is running, the page does not need to reload again. The program controls everything the user sees and communicates with the server, if necessary.  Again, the page is not actually reloading, just some parts of the DOM change.  This saves a lot of bandwidth, time, and most importantly, gives the user a more fluid experience. Additionally, after the SPA has loaded, it can generally run in the browser when no Internet connection is present.

MPAs vs. SPAs:  Advantages and Disadvantages

This sounds great, right? So how can there be any disadvantages to SPAs? Well, as with anything in life, there are some, and we’ll cover a few of them here.

  • SPAs encounter issues with SEO.
    • SPAs load content on the page asynchronously, meaning that the data updates in the application without refreshing the page. SEO crawlers do not like this because they depend on JavaScript. With a SPA, once the page loads, the crawler’s work is complete.  The crawler agent doesn’t know that the data changes as a user navigates through the page, and eventually, that data renders on the page.
  • SPAs cannot run without JavaScript.
    • Most pages have JavaScript on, so it is not an issue, but if JavaScript is off, your page won’t function.
  • SPAs tend to favor modern browsers.
    • This can be a limitation if you’re trying to utilize as many browser versions as possible for your application. You may find yourself in a position where it is not supported.  MPAs would be the better option here, and consequently, would have more existing frameworks and best practices to pull from.  As a new developer, this makes it much easier to work with MPAs (it’s still important to monitor your APIs though when developing MPA or SPA.

Conclusion: What is the Best Option for Load Testing SPAs?

As you can see, you need to consider the goal of the application before deciding to go with an MPA or SPA. If your site can be developed as a single-page experience, a SPA is probably the way to go. If you have an online shop with multiple categories and lots of content, for example, MPA might be the better option.  Whatever you decide, before any of your applications get put into production, various testing methods, especially load and stress testing, must be executed to ensure the user experience is as seamless as possible.

The goal of SPAs is that they can provide a responsive, feature-driven user experience.  To make sure the development work that goes into creating a SPA doesn’t go to waste, it is critical that your SPA be load tested to ensure a first-rate user experience under production-like load. You want the best possible experience for your visitors, so make sure your application stands up to the demands that are going to be placed on it.

The LoadView platform can test SPAs the same way you would for any other web application and supports JavaScript frameworks, as well as other protocols and technologies, like AJAX, Flash, HTML5, WebSockets, and more. Quickly and easily script the multi-step actions and behavior, spin up virtual users, and perform those tasks under load using real browsers. This ensures you get back the best reporting data possible, and your applications can stand up to the demands of your customers and visitors.

Performance Testing for Modern Applications

Other load testing tools on the market that utilize JMeter for example, may be enough for executing protocol-based requests, but aren’t great at load testing SPAs because JMeter is NOT a browser and works at the protocol-level and unable to execute JavaScript. Yes, there are workarounds, but that requires more time and resources, even with a skilled engineer or developer. It is not as straightforward or easy as using a solution like LoadView. No more having to configure hardware resources and creating load injectors from your local devices. Using traditional web performance tools for modern-day frameworks and technologies cannot simulate the experience from the perspective of your visitors. LoadView makes the entire process easy, from creating scripts for critical user scenarios, to configuring and executing load tests, from more than 20 worldwide locations.

Get started today with the free trial and we will give you up to 5 free tests for your initial load testing. Or maybe a demonstration of the LoadView solution is more of what you are looking for? Our team of performance engineers are available to run through the entire LoadView solution. Simply select a day and time that works best for you and your team. Our team will be happy to answer all your questions. Schedule your demo now!