There are three typical approaches to load testing an API. These, as well as various hybrids, each have drawbacks and advantages.
#1 Faking it – API Mocking
The least useful for load testing is API Mocking These are basically temporary placeholders used during development of an API. Developers use these for early unit testing. But they also provide these “dummy” versions to other teams that need to call the unfinished API from within their own code.
Mocks return hard-coded responses, the formats of which often change during development. Also, the effort to create the mocks is wasted after their initial use.
Remember that, mocks aren’t yet hooked up to actual data sources, their performance isn’t at all representative of the real world. In summary, mocks may be useful for unit testing, but they aren’t representative of the real world.
#2 Cloning it – A Full Test Environment
This approach stands up a full-blown test environment using a snapshot of production data. Often you’ll have a copy of all the applications running, too, because your code relies on other APIs, not just database queries.
The good in this approach is that it’s very representative of the live system’s performance. If your load test brings the system to its knees, no problem! It hurts no one.
However, they raise privacy concerns, require constant data reloading, and can be very expensive if calling third party APIs.
#3 Hitting production – Load Testing Live APIs
Sadly, the method so many companies use is to test on production itself. Why? Well, it’s live, so it’s the most representative of all methods. It’s also “easy” – no separate test environment to stand up and maintain.
Disadvantage is that all data created are actual and stateful. And you still have to worry about the cost of pay-per-use APIs.
It’s important to schedule your load test “off hours.” And, any break would cause your production to become down.
#4 API Virtualization – The Risk-free Approach
You want to perform an exhaustive load test of your API – and keep your existing customers and your job. That rules out hitting the production system. And, you also need more than a test version of your API in a cloned environment. You need to test the real API in an environment where you can control the load condition for aspect of the test.
That’s where API Virtualization comes in. A virtual API provides a sandbox environment where you can simulate environmental loads on network bandwidth, server and database connections, simultaneous users and more.
With API virtualization, minimal resources are required for standing up and testing the API. You test the API itself, not the end-to-end application with all its required backend systems. This eliminates the need for a clone of the production environment.
You can test your API in isolation, gauging the reaction against real data, under a variety of load conditions.
API Virtualization allows you to load test your API in isolation from the rest of the system. With complete control of the test conditions, you can simulate network load, maximum connection limits, latencies and other conditions that happen in the real world.
I strongly believe that there will be great opportunities for those who looked into this area, thanks much for creating and sharing here...
ReplyDeleteBest Online Software Training Institute | Angular 5 Training
Thank You So mush for giving a nice explanation About "API Virtualization" For This i searched number of sites now i got.:Python training in Chennai
ReplyDeleteExcellent and useful blog admin, I would like to read more about this topic.
ReplyDeletePython Classes in Chennai
Best Python Training in Chennai
ccna Training in Chennai
ccna institute in Chennai
R Programming Training in Chennai
Python Training in Anna Nagar
Python Training in Porur
Nice post....Thanks for sharing useful information...
ReplyDeletePython training in Chennai/Python training in OMR/Python training in Velachery/Python certification training in Chennai/Python training fees in Chennai/Python training with placement in Chennai/Python training in Chennai with Placement/Python course in Chennai/Python Certification course in Chennai/Python online training in Chennai/Python training in Chennai Quora/Best Python Training in Chennai/Best Python training in OMR/Best Python training in Velachery/Best Python course in Chennai/<a