My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Showing posts with label load. Show all posts
Showing posts with label load. Show all posts

Thursday, May 24, 2018

How to Load Test APIs: Methods and most effective way to test web or downstream services

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. disadvantages-of-cloned-environmentsOften 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. 
load-testing-with-api-virtualization
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.

Tuesday, March 27, 2012

How to solve "Failed to load shared object Sgment Prot after reloc:Permission Denied" Problem in Linux

All of a sudden, I started getting an error on my Linux box. I was mesmerized as to what could be the possible cause. The error message was pretty confusing. It said:
Failed to load shared object. cannot restore sgment prot after reloc permission denied
Initially I thought that this problem over my binaries are coming due to Permission errors. I checked the permissions on directories, binaries, executables. But all were fine. Then I though of running using 'su' or 'sudo' command, but to no avail.


I searched through Internet and found that someone has got a similar error in CentOS too. It so happens that CentOS 5 has the SE Linux feature set to enforcing. So, sometimes when you install CUBRID on CentOS and try to start the cubrid services cubrid service start, you may encounter the following error:
[cubrid@localhost ~]$ cubrid service start
cubrid: error while loading shared libraries: /opt/cubrid/lib/libcubridsa.so.8: cannot restore segment prot after reloc: Permission denied

This error is not limited to installation. It can come while running an application too. It should be remembered that This problem is seen in Linux gcc 4.1.2 i686 i386 GNU/Linux flavors too. Resolution is same. While installation of any package or Starting any service on a RHEL or CentOS based Server you may receive following Error
cannot restore segment prot after reloc: Permission denied

This Error comes when SELinux setting is enabled on the server. Someone even reported this coming from java librarie. The error was while trying to run several programs. For example:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/libjpcap.so: /usr/lib/libjpcap.so: cannot restore segment prot after reloc: Permission denied

How to solve Failed to load shared object Sgment Prot after reloc:Permission Denied Problem in Linux
No problems!!
As already told you this comes due to Security-Enhanced Linux (SELinux). It is a Linux feature that provides a mechanism for supporting access control security policies through the use of Linux Security Modules (LSM) in the Linux kernel.
By Default SELinux is set to “enforcing” in CentOS on boot, this can be disabled permanently. To disable it edit file “/etc/selinux/config” and change SELINUX

To temporarily disable enforcement on a running system, type
/usr/sbin/setenforce 0

To permanently disable enforcement during a system startup
change "enforcing" to "disabled" in ''/etc/selinux/config''

It was a great relief to me when I got my control back on my binaries. Cheers!!

Friday, July 22, 2011

Stress Testing [What How When]

This post aims to throw light on questions such as, "what is stress testing", "how to do stress testing", "when to do stress testing". So basically, it gives you my visualization of stress testing. Specifically, how i see it and feel of it. In Stress testing you try to break the system under test. Rather you can also call it study of Emotional quotient of your system. How well it behaves when it is subjected to stress. Definitely this means of finding innovative ideas to give the system/process a really really tough time. This can be achieved by expanding its resources or by taking resources away from it. Often in the latter case (but sometimes in both) it is called negative testing. The main purpose behind this testing is to make sure that the system fails and recovers gracefully. So, the keyword here is RECOVERABILTY.

It is to be understood that the performance testing demands a very controlled environment. Since you are going to set baselines and compare against old baselines, you have to be very cautious about the environment, architecture, OS etc. But Stress testing enjoys the beauty of randomness. You may very well doubt on what beauty I am talking about. But seriously, only a Good tester can tell you how much he enjoys in inducing chaos, catches and unpredictability. I felt this pride and fulfillment many times in Adobe and Symantec.



It should be instilled deep that stress testing is not breaking the system purely for the pleasure of breaking it. Rather it allows observation of how the system reacts to failure. It tests recoverability, error messages, breach of security due to unpredictable behavior, hangs etc. For example the simplest you can do is to parallelly run processes that consume resources. This may be CPU, memory, disk, network, database consuming processes. Think about tools and utilities available. For instance read my post related to 'ulimit' tool on linux. [PS: There are thousands of tools. i am just giving an example, because that is also very helpful. And yes, for me you clicking on Advertisements is very helpful.] If no tool is working out you can think of writing you own test application. Simplest is an application with overriden new operator. Look my post on that. Find from references below. Think about doubling the baseline number for concurrent users. What happens if different protocols used to access same system at same time. What happens if the Files being processed are of very large size, or of very small size.

Remember my pictorial representation above. Stress testing means 'giving your application really really tough time. Think about innovative ways to test the Emotional quotient of your system.'

But do remember to come to this test only after your functional and integration testing has been done. If you are only responsible for some module, then you may stress test your module/API/DLL/lib/so (Hmm..anything) once your Acceptance and Unit Testing are finished. Obviously in Agile environment, due to time crunch, Functional testing and stress test can be started in parallel on different systems. Although the former is more important, but unfortunately time is the only thing you go out of often. So stress can be triggered on some machine. And you can analyze results of functional test. And if FT is pass, you can also analyze stress test result. For Antivirus products, you can have a stress file set that contains Zip compression bombs, large files, files having viruses. For Desktop publishing applications, your test set files may contain large application files, fuzzed files, or files not saved properly, or any set of files that are known to give tough times to your system.

References On my Blog:
Ulimit as a tool on Linux for Stress Test
Different types of Software Testing
Overriding new and delete operator for stress testing