Microservices are now mainstream and performance is a key requirement for any system that includes microservices. Therefore, conducting microservices performance testing is crucial. In microservices architecture, all the components (microservice, API, database etc.) need to be individually performance tested. However, overall application performance testing is more important from the end-user perspective. A business regularly thinks about the overall system performance not necessarily the specific microservice or the performance of its individual components.
In Agile/DevOps methodologies (or continuous integration/ continuous development (CI/CD) pipeline), performance testing needs to be completed as quickly as possible. It is more towards shift-left strategies to achieve the performance at an early stage and save total cost. In Agile/DevOps, the overall timeline is very short. That means the performance testing window will be even shorter. However, we are expected to test all the microservices and their components in that time to avoid any potential performance issues. Conducting performance testing for all of these in such a small window of time is impossible. But, delaying the process is also impossible.
In this article, I will discuss a bottom-up approach and continuous performance monitoring assists in microservices performance testing.
Microservice Performance Testing
Microservice performance is crucial and conducted at early stages of SDLC- software development life cycle. It should be realistic performance testing, otherwise it will not add any value. We need to work with business analysts and stakeholders, analyse production logs to get the average and peak load as well as future business growth load. It is conducted looking at a high number of requests made to individual microservices or a large amount of data is transferred between microservices and we then observe how it is performing.
Microservice Performance Testing: Shift-left and Bottom-up Approach
Individual microservices performance testing is conducted early to understand how they are responding. This is in line with shift-left performance testing and it helps with cost savings. As it is done at the early stages, if there are performance issues, those can be solved immediately rather than finding performance problems and resolving later on in the SDLC.
Shift-left performance testing enables a bottom-up approach where individual microservices and their components will be initially performance tested as the ‘bottom’ and then the overall UI/API will be performance tested as the ‘up’ approach.
Microservice Performance Testing: Short Window
Early microservice performance feedback assists developers, stakeholders and application owners. In Agile/DevOps, applications need to be released rapidly, so performance testing needs to be conducted quickly. Conducting performance testing for each microservice and/or its components in that timeframe is very tough.
In Performance Testing, we only include business critical scenarios. For microservices performance testing, we also first start identifying the business-critical microservices and then test them individually in that short span of time to provide early feedback. This should be done as soon as the microservice is functionally tested. The remaining noncritical microservices will be performance tested as a continuous process until the API/UI application is ready. Sometimes, it may not be possible to test each of the microservices which is acceptable as these usually present less of a business risk. Another way to verify is via continuous performance monitoring. This will assist in highlighting whether important microservices have been missed or less risky microservices have performance problems. It will monitor each microservice and assist in identifying which low critical microservices should be tested first.
Microservice Performance Testing: Continuous Monitoring
To understand the performance of a microservice in real time, we need to have proper continuous performance monitoring in place. Continuously monitoring the system, verifying each of the microservices all the time. This includes high business critical microservices as well as low risk microservices. We can afford to test low critical microservices at later stages of SDLC due to continuous monitoring only. This assists in DevOps methodologies.
Continuous performance monitoring not only assists individual microservice monitoring but also API/UI level monitoring as and when components are integrated. Continuous monitoring captures everything in real time, then detects & diagnoses any potential performance issues. It uses bottom level approaches for individual microservices and up level approaches for API/UI application.
User Experience: Most Important Factor
We must understand that end-users don’t understand how the application is built, whether microservices or the traditional way. They just recognise that the application is resolving their problems and performing as per their expectation. Application owners know that end-user performance is more important than any specific microservice or its component performance. Because of this, conducting API/UI performance testing is more significant than individual microservice performance testing. This is to ensure positive end-user experiences in terms of speed, scalability, stability, spike, size (volume) etc. We conduct end to end UI level performance testing once microservices and its components are integrated.
The bottom-up approach will be appropriate here with individual microservices performance tested first to provide early feedback. Later in the process, performance testing will be done at API/UI level for end-user experiences.
Microservice Performance Testing: Bottom-Up Approach & Continuous Monitoring
Even though, we understand end-user experience is absolutely important, we can’t wait until the application is fully built to conduct performance testing like traditional way of performance testing. It deviates shift-left concepts and we know it will be more costly. Also, if any major performance issues found at later stages, it will also have a massive impact on the business.
On the other hand, if we do early individual microservices performance testing, we can certainly identify performance issue at early stages, and resolve them immediately. Once integrated, UI/ API performance testing has less chance of performance issues, as most of them are already performance tested except integrating factor. If we find an end-user performance issue, an iterative bottom-up approach (bottom-up-bottom-up) will assist.
The good thing about microservices architecture is that when there is a microservices failure, or it is unavailable or unresponsive, it doesn’t take the overall application down. Application performance monitoring tools not only provide all this detailed level information but also send notifications over thresholds as a proactive performance measurement. Continuous performance monitoring assists us in the bottom approach i.e. in individual microservice level and up approach i.e. in API/UI level to share real time details. It also advises of any potential performance issues well in advance.
Overall, the bottom-up approach & continuous performance monitoring helps microservices performance testing to look at important aspects like end-user experiences, shift-left performance testing, short window to identify and resolve potential performance issues as early as possible.
Check out Performance Testing eBooks and Webinars on Huddle.