Solved

Mod_Proxy balancer causes NullPointerExceptions and Javascript errors

Posted on 2012-04-12
4
456 Views
Last Modified: 2012-05-08
Hello All,

I have done configuration to Balance Load of IIS Server from By Apache mod_proxy and it's working  but When accessing either of the IIS servers directly (bypassing the load balancer) there is no problem, but when accessed over the load balancer, errors occur. The symptoms vary from NullPointerExceptions to javascript errors. So far I have not been able to tell what causes the difference in the resulting errors.
below is my config

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so


<VirtualHost *:80>
    ServerName foobar
    DocumentRoot "/var/empty"

    <Proxy balancer://idp-cluster>
        BalancerMember http://192.168.1.3:81
      BalancerMember http://192.168.1.4:80
      BalancerMember http://192.168.1.5:81
    </Proxy>

    ProxyPass /balancer !
    ProxyPass / balancer://idp-cluster/
    ProxyPassReverse / http://192.168.1.2
    ProxyPassReverse / http://192.168.1.2
   
    <Location /balancer>
        SetHandler balancer-manager
        Order Deny,Allow
        Deny from all
        Allow from 10.
    </Location>
</VirtualHost>
0
Comment
Question by:Nilesh Havire
  • 2
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
arober11 earned 500 total points
ID: 37849014
Hi

Per Q_27670251:

Guessing your errors are down to a lack of stickiness, in your latest config. Basically your IIS servers may only be getting a third of the data they are expecting from a client, so you need a few tweaks to ensure all requests from one client (Browser) hit a single back end server. So  you'll want to add a:  ProxySet stickysession=JSESSIONID  directive before your </proxy> line.

Another obvious issue are the ProxyPassReverse entries, replace your existing entries with a single:

 ProxyPassReverse / balancer://idp-cluster/

On the testing front you'll need multiple clients (browsers) as the stickiness will ensure you keep on hitting the same instance from your any Browser.
0
 

Author Comment

by:Nilesh Havire
ID: 37850055
Hello arober11,

Thanks for your reply, I have change as per your guidance, and it's working but I am not sure if My config is correct or not, Can you please check whether my config is correct or not ?
is there any way to configure Priority for prefferred Server

<VirtualHost *:80>
    ServerName foobar
    DocumentRoot "/var/empty"

    <Proxy balancer://idp-cluster>
        BalancerMember http://192.168.1.3:81
      BalancerMember http://192.168.1.4:80
      BalancerMember http://192.168.1.5:81
      ProxySet stickysession=JSESSIONID
    </Proxy>

    ProxyPass /balancer !
    ProxyPass / balancer://idp-cluster/
           
    <Location /balancer>
        SetHandler balancer-manager
        Order Deny,Allow
        Deny from all
        Allow from 10.
    </Location>
</VirtualHost>
0
 
LVL 26

Assisted Solution

by:arober11
arober11 earned 500 total points
ID: 37850548
Hi

Can't see anything obviously wrong with the config, and if it appears works the it will probably do, but probably worth scheduling a Daily bounce (graceful restart of Apache) as threads do occasionally go  missing over time.

As to altering the load distribution, the answer is yes simply add a " loadfactor=##" to each "BalancerMember" definition, where ## is the percentage of requests to go to that member.

If you want any more info there are plenty of tutorials around e.g. http://blog.search-computing.net/2010/04/load-balancing-with-apache-a-tutorial-on-mod_proxy_balancer-installation-and-configuration/
0
 

Author Comment

by:Nilesh Havire
ID: 37850709
Same Issue as before

When accessing either of the IIS servers directly (bypassing the load balancer) there is no problem, but when accessed over the load balancer, errors occur.  Some time user unable to login, as per my ASP.net developer he said me event cant be fired when accessed over the load balancer, How I will check Log or
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now