Menu

Load Balancer Configuration

Help
2014-02-19
2014-02-20
  • Rajeshkumar

    Rajeshkumar - 2014-02-19

    Hi,
    I am trying to implement HA-JDBC in our webservice application. here is our HA-JDBC configuration XML.
    Now i am trying to test the balancer between the two DB configured below. In DB1, the table doesn't have any data and DB2 will have the real data.
    So my assumption is whenever the connection goes to db1, it will return empty data and if it goes to db2, it will return output.
    Since im giving the balancer as "round-robin", the request should goes to successive nodes. But when i tried my webservice, the connection always goes to db1 and returns no output always.

    The same scenario when i tried by dropping the table from db1, first the request goes to db1 and returns empty output as there is no table at all. Next time the request goes to Db2 and returns output. After this the request always goes to db2.
    
    Why is the request not balanced between the two DB? Is there any issue in my configuration?
    

    Please help me in implementing.
    For your information, below are my expectations,
    1. The request should be balanced between two data server.
    2. If any one data server fails, then the connection should goes to another data server.

    <ha-jdbc xmlns="urn:ha-jdbc:cluster:3.0">

     <distributable/>
     <sync id="passive">
     </sync>
    
     <state id="simple"/>
    
     <cluster default-sync="passive" balancer="round-robin" meta-data-cache="lazy">
         <database id="dB1" location="jdbc:sqlserver://dataserver12:1111;databaseName=DB2;user=testuser;password=1234Strong">
         </database>
         <database id="dB2" location="jdbc:sqlserver://dataserver13:2222;databaseName=DB1;user=testuser;password=1234Strong">
         </database>
    
     </cluster>
    

    </ha-jdbc>

    Thanks,
    Rajesh

     
  • Paul Ferraro

    Paul Ferraro - 2014-02-20

    First, your databases should contain identical schema and data.

    Second, The balancer may be invoked for JDBC methods other than the actual statement execution (depending on your JDBC code). The only way to truly test this is to make multiple concurrent requests. You should then see that they are balanced properly. After all, there is no point in "balancing" serial load - only parallel load.

     

Log in to post a comment.