Testing & Monitoring the Performance of Microservices

More and more frequently, we’re encountering projects that use a microservice architectural style, a development approach that results in an application made up of a suite of small services, each running its own process and often communicating through an API over HTTP.

When built correctly, an application with a microservice architecture can be highly scalable, while also providing a high degree of functionality and performance to your end users.

Microservices introduce a level of complexity in the way that they combine to create a deliverable application, therefore, performance must remain top of mind. To save yourself a significant amount of time, money and headaches in production, performance testing your microservices is critical. Realistically load and performance testing microservices will allow you to catch any issues early on and make the necessary changes before pushing your application to production.

In this post, we’ll take a closer look at some of the common challenges of performance testing microservices, explore best practices for testing your microservices, and explain how you can monitor the performance of your microservices in production.

Common Challenges

When performance testing a single microservice, testers are limited to an interface that doesn’t change very often. This type of performance testing presents no major challenges. If no dependencies exist between services, each microservice can simply be tested, one by one, to assess performance.

However, performance testing microservices becomes a challenge from the moment testers have to measure user experience through the UI. In each new release, different pieces of functionality are deployed. This can result in an influx of testing scenarios that will no longer work due to the minor changes made to other microservices during the release. Teams with a microservice architecture are able to deploy more often in small patches, and if your testing approach is limited to the UI, chances are you’ll need to spend more time updating and maintaining your testing scenarios.

An application’s architecture may also present challenges when load and performance testing microservices. If the architecture is well organized, developers would have picked one protocol to exchange between the services. If not, teams can utilize the REST API, which would then make it easier to handle one standard protocol for the project. If a project uses multiple protocols, however, then testers will need to approach it with entirely different set of testing techniques. While this may not seem like a challenge, it does introduce a layer of complexity for testers.

One of the biggest challenges teams will face when load and performance testing microservices is the dependency between the services. It’s likely that testing one microservice will require testing a different service that is handled by a separate team. Creating an environment of connected services is a challenge in itself.

Best Practices

First things first, you’ll want to start testing the performance of microservices early on in your software development life cycle. Identifying and resolving performance issues before your application, with its distributed architecture, is pushed to production is key.

It’s important to create and run component tests on each core microservice and include these in the building process. Using a dashboard that tracks microservice performance between each build is also recommended as it will allow you to easily detect regression in terms of performance. Of course, it’s also required to test microservice performance from the UI to guarantee a high quality user experience.

Rather than testing the application as a whole, it makes more sense to run microservice performance tests at a unit level. You’ll need to ensure these tests are as realistic as possible—use as real a dataset as possible, use load tests that represent anticipated demand, and push it through as close to a realistic production setup as possible. With your load testing tool, you should also test from the cloud. This provides yet another layer of realism in terms of geographic location.

With service virtualization, you can address the challenge of dependencies between microservices, as it will allow you to test individual services without waiting for the deployment of other dependent services. If you choose this route, make sure to include the latency between services in your tests for the most realistic results.

Make sure you’re also capturing API transactions and use a load testing tool like NeoLoad to drive the load to scale and monitor the infrastructure. Each of these activities can be performed on individual microservices.

Monitoring Microservices

It’s absolutely essential to monitor your microservices in production. You’ll need visibility into how your microservices and their dependencies are behaving, while ensuring that the services are running and performing within your defined set of standards.

Microservice architecture is designed to be easily deployable and scalable. However, you’ll need
to know when to scale or deploy more nodes. Monitoring allows you to keep a close eye on the performance of your microservices so that you can make the right decisions on your production environment.

Synthetic monitoring is another monitoring technique that becomes incredibly useful when dealing with microservices. Let’s say your team is limited to UI testing and a product search response time comes back as unacceptable. Sure, you’ll have insight into the performance of a specific business transaction, but behind this transaction if you have more than 50 microservices involved, it’s difficult to pinpoint which specific service is responsible.

By utilizing a synthetic monitoring tool like NeoSense, you’ll be able to traverse your main business transactions, receive daily KPIs on your microservices and detect any problems with the main features of your application before users encounter the issue. Deep dive diagnostic tools are also recommended to help you identify specific services causing bottlenecks within your application.

Moving Forward, Testers Must Adapt

The software development industry is continuously shifting attention to projects built using a microservice architecture. For testers involved with these applications, it may require a slight change in processes. Get developers involved to implement tests directly at the service level. This will free up testers’ time so they can focus on end-to-end testing when the application is assembled.

Leave a Reply

Your email address will not be published. Required fields are marked *