Home     RSSRSS

Archives: IP Spoofing

Performance Testing and Load Balancing

November 19, 2011 by kiranbadi1991 | 8 Comments | Filed in Environment, IP Spoofing, Load Balancer, Others, Performance Engineering, Testing

In my last post, I mentioned that performance Engineer needs to have basic understanding as how load balancers work, its required skill for any performance engineer who is working in big enterprise environment, as without understanding this,your performance tests results are useless as response time also depends on how traffic is routed to the backend servers.So in this post, I am going to try and explain as how I make sure that my tests also stress the load balancer in the meaning full way as close to the production behavior.

Load balancers in majority of  the cases identify clients with either a source IP or by setting the persistent cookie header to the client request.Source IP is the IP of the client who is using the applications.In the corporate environment, most load balancers uses the source IP to identify the client and route the requests because most of the environment infrastructure is known to all the concerned teams and revealing IP Address is not considered as the risk.Load Balancers reads the clients IP and based on the load balancing algorithm forwards the requests to the appropriate backend servers.We can also have source IP Stickiness to the instance of the servers  also referred as server affinity.

Load balancers depending on the algorithm and requirements of the applications, can also implement the cookie based solutions. Load balancers in this case  adds the cookies to the client requests before routing it to the appropriate backend servers.So each request going back and forth will be carrying this cookie with it.So as long as cookies are present in the requests, connections of the clients are maintained to the respective instances of the backend servers.Cookie based implementation also helps in maintaining the connection balance across the servers in the backend in case for  some reasons source IP based persistence fails.

I feel these are two most commonly used ways for implementing load balancing solutions and almost all load balancing vendors support these solutions.

Now the question here is  how should we test Load Balancers during Performance testing ? How do we ensure that Load balancer is working the way it should work ?

In case if you do not know anything about Load Balancers, then this might be tricky stuff for you ,but if you know algorithm and how Load Balancer is implementing its algorithm, then this might be a cake walk for you.

Below are some of the steps  I recommend one should perform during performance testing whenever you have Load Balancers in your environments,

1. Identify how your Load Balancer is implementing the Load Balancing.How does it spread the requests across backend farm of servers.Understand the algorithm and its implementing.

2.IP Spoofing is required.Sometimes back, I had written about IP Spoofing here. Feel free to spend some time reading it.We need as many IP as the number of users we are testing for depending on the algorithm of the Load balancer.If Algorithm is using Source IP, then it will route the requests based on Source IP.

3. Once IP Spoofing is enabled.Scripts should and must output the IP Address of the Vuser.I am aware most load testing tools provide you a interface where in you can out put the IP address of the user.Below is the piece of code which can be used in LoadRunner,

char *ip;
ip = lr_get_vuser_ip();
if (ip)
lr_output_message(“The IP address is %s”, ip);
else
lr_output_message(“IP spoofing disabled”);

4. If the load balancing is done via cookies, make sure you identify  and not comment out the cookies set by the Load Balancers,some tools store persistent cookies in memory, this don’t show up in your scripts,they are handled automatically by the tool.LoadRunner falls in this category of tools which handles persistent cookies automatically.You need to use advanced logging to see those cookies going back and forth.If possible log the cookies to the log along with timestamp, this will help you to troubleshoot issues in complex and shared environments.

5. I often make sure that I capture run time stats  as where the client request is routed to in the back end farm.I do this by using this technique. Feel free to spend sometime reading that as well. All you got to do is correlate the headers values which displays the server information and write it to the log with timestamp.This will really help you in runtime debugging .

6. If your sole objective is to test Load Balancer , make sure you run only single script and not multiple scripts, as this will rule out the connection imbalance issues normally called as network bottlenecks.Not all connection exit gracefully across all layers at TCP Stack.

Sometimes  I have seen lot of folks using webserver logs and retrieving number of hits from there for the duration of the test run as measurable way of testing load balancers, I agree that in some cases its correct and sometimes it could be wrong in case your application uses some kind of caching mechanism,we need to remember always that our runtime settings for the scenario has a strong  influence on the hits per second.In most of the applications, static and non resource contents like images/js/css files are cached.If you are using webservers logs to analyze load balancers work, then make sure you do comparison only for POST requests and not for GET requests.Here is reasons as why POST requests makes sense.

Once you have all these stats, it will make your job extremely easy to identify and say whether load balancer is doing its job correctly or not.

Hope this helps.

Technorati Tags: ,

Tags:

Basics of LoadBalancing for Performance Engineer

October 22, 2011 by kiranbadi1991 | 1 Comment | Filed in Development, IP Spoofing, Load Balancer, Performance Engineering

One of the skillsets required to be successful performance engineer is knowing and understanding as how Load balancing works and what are the most frequent algorithms applications use and how these algorithms can impact or mitigate the performance issues and bring about the good user experiences.

We do Load balancing to spread the incoming requests across various backend servers which is also called as server farm so as to optimize and provide good user experience.Often,single machine is not sufficient to service the growing business requirement.We need lot of servers in the backend to service the growing requests coming from the clients.

There are different ways by which load balancing can be done, we can have hardware based load balancing,Network based Load Balancing and also software  based load balancing.Hardware based load balancing is mostly used by cloud service providers as requests to routed to the servers based on various network factors.For this discussion, I would like to talk more on the software based algorithms here used by the load balancers.Some of the commonly used load balancing ways are

  • Round Robin : In Round Robin style of Load Balancing,requests are routed to the backend servers based on round robin fashion,first request goes to server 1, then request goes to server 2…This pattern is followed till the request reaches the last server on the farm.Round Robin normally gives a good connection balance across the servers and this is one of most commonly used algorithm used.
  • Least Connection: In Least connection style, requests are routed to the servers which has got least number of connections to present at that point of time.If the server is overloaded , then connections or requests are not send to that server.Least connection is useful whenever we have resource contentions and whenever we need extract a full value of the box.Normally the application needs to tuned appropriately so that servers can be utilized to the max extent.
  • Weighted Connection: This is hybrid process which  can use the techniques of round robin and Least connections.Here the certain amount of points or percentages are allocated to individual server boxes in the backend and load balancer directs the traffic according to the weighted rule to the backend systems.Weighted connections are normally beneficial in the shared environments where applications share the resources.

In addition to above three methods, there might also be vendor or situation specific algorithms which can used.Most Load Balancer vendors provide a support where in load balancing can be done via custom implementation by writing some rules.So it makes sense for the performance Engineer to clarify algorithm rather than assuming it.Server Affinity/Persistence/Stickiness normally goes hand in hand with Load Balancer but however they are two different topics to discuss.

In order to select or suggest the correct algorithms, one also needs to have complete understanding of the platforms which is going to be hosted on the servers.Applications storing sessions in server process or storing in cookies might require persistence  to the instance of the server which is serving the requests,so in this either of these 3 methods might not be sufficient, we might needs a extra stuff to maintain a persistence.Applications storing the sessions in the databases can use any of the these of methods but might have some performance impact, as it might need to do some round trips to retrieve and validate sessions.

Hope this helps.

Tags: , , ,

IP Spoofing – Some Suggestions and Some Thoughts

April 21, 2011 by kiranbadi1991 | 3 Comments | Filed in IP Spoofing, LoadRunner, Performance Center, SilkPerformer

Some days back I had a short discussion with one of my colleagues with regard to IP Spoofing feature in Performance center. Situation was that I had a ran the load test without checking the IP Spoofing checkbox in Performance center. He was thinking that since I haven’t used the IP Spoofing, request hits will not be spread across the all the servers and I am hitting just one boxes and that’s the reason my test would be considered as invalid.Hmm I said my bad I often forget things. Happens when you work in the big server farm environments.

Then after couple of days, I started studying the environment under which we are testing. To my surprise I came to understand that requests are distributed across servers using least connection algorithm.Least connection algorithm means that your load balancer will send the request to the server which has got least number of clients connection during that point of time. So I thought that let me waste some of my time writing something about IP Spoofing.

IP Spoofing from performance engineering point of view means that each user will be using the unique IP for its communication with the backend components. Backend Components could be anything like load balancer, database servers or web servers etc.So whenever I am running a load test with 10 users with IP Spoofing on, it means that each user will have one unique IP associated with it.

Normally most load testing tools give you a setup guide as how to set up the IP Spoofing feature. However in addition to those guidelines, I often suggest to keep below point in mind,

  • All the IP Addresses used for spoofing should be valid and belong to same subnet mask or same LAN or same domain. So IP addresses should be valid and approved by your network administrators.
  • It’s always better to have Static IP’s rather than getting the IP’s from the DNS Servers. If you have dynamic IP’s than your IP’s might change frequently depending on how your network has been configured.
  • After adding the IP’s ensure that you reboot all your LG’s boxes and confirm that valid IP’s are in fact showing up in the routing table.I think once you do ipconfig/all, it will list you all your added IP’s.
  • Ensure that your NIC card is sufficiently big in size to support data flowing for that many IP’s in case if you are running short of LG’s and are having lot many IP’s in the single box.

Also there is certain things which we need to keep in mind, IP Spoofing will not assure you that your requests are spread across the servers or help you in load balancing the requests. There exists application which recognizes the IP of the client and then serves him the content belonging to his region only. Good example of this is Google ads. If you’re based in London and browsing Google ads, then you see ads only from London or your nearby areas where you are residing or browsing from. Of Course the content of the ad will be one which you are searching for.

There also exists certain Load balancing algorithms wherein the requests generated from the same client gets cached and requests goes to the same server box in the backend. Again concept here is something different, they are sometimes called as sticky sessions and this has nothing to do with IP’s. They are scaling algorithms for scaling the web platform.