The Vertica Forum is getting a makeover! The site will be undergoing maintenance from Tuesday 8/13 to Friday 8/16. We appreciate your patience and cooperation during this time.

Testing the Native Load Balancer

Jim_KnicelyJim_Knicely Administrator
edited August 7 in Tips from the Team

Native Connection Load Balancing is a feature built into the Vertica Analytic Database server and client libraries as well as vsql.

The RUN_LOAD_BALANCE_POLICY function returns a string formatted as address:port that results from running the current Native Load Balancer policy.

It’s a great tool for testing after enabling a new Load Balance Policy!

Example:

dbadmin=> SELECT set_load_balance_policy('ROUNDROBIN');
                            set_load_balance_policy
--------------------------------------------------------------------------------
Successfully changed the client initiator load balancing policy to: roundrobin
(1 row)

dbadmin=> SELECT node_name, node_address FROM nodes;
     node_name      | node_address
--------------------+---------------
v_test_db_node0001 | 172.16.61.176
v_test_db_node0002 | 172.16.61.177
v_test_db_node0003 | 172.16.61.178
(3 rows)

dbadmin=> SELECT local_node_name();
  local_node_name
--------------------
v_test_db_node0001
(1 row)

dbadmin=> SELECT run_load_balance_policy();
run_load_balance_policy
-------------------------
172.16.61.176:5433
(1 row)

dbadmin=> SELECT run_load_balance_policy();
run_load_balance_policy
-------------------------
172.16.61.177:5433
(1 row)

dbadmin=> SELECT run_load_balance_policy();
run_load_balance_policy
-------------------------
172.16.61.178:5433
(1 row)

dbadmin=> SELECT local_node_name();
  local_node_name
--------------------
v_test_db_node0001
(1 row)

Because the local node did not change in the above example, note that running the RUN_LOAD_BALANCE_POLICY functions does not actually redirect the session to the node returned by the function.

Helpful Links:
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/AdministratorsGuide/ManagingClientConnections/LoadBalancing/ConnectionLoadBalancing.htm
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/SQLReferenceManual/Functions/VerticaFunctions/ConnectionManagement/SET_LOAD_BALANCE_POLICY.htm

Have fun!

Sign In or Register to comment.

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.