Solved

Mod_Proxy balancer causes NullPointerExceptions and Javascript errors

Posted on 2012-04-12
4
453 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

12 Experts available now in Live!

Get 1:1 Help Now