How to customize load balancing gracefully

Because they are HTTP caching servers and I want to get the more bang for my buck, I need LARD (locality-aware request distribution) to be heavily used when balancing requests.

But since the caching application also relies on the locality of other assets, LARD cannot be effective if reading the full URI (there is a signature in the middle of the URI).

So, I need to implement the balancing by myself.

I don't want to use Session Persistence because I am scared by sessions shared across the STM cluster. (Shall I? Maybe acceptable if I use connection.setPersistenceKey() and my hash function?)

So what I did is write a simple Consistent Hashing implementation in TrafficScript, and then use it to balance requests according to their computed hash.

This way I get the LARD effect and redistribution would only affect the keys previously hosted by a failed cache server.

This is working well until a cache server fails: I use pool.use()/pool.select() to send the request to a specific server. If that server is down, STM will reply with a "HTTP/1.1 500 Internal Server Error/Service Unavailable" message.

This is fixed only when the CHash ring is recomputed without the failed server.

Is there a better way to handle this scenario? Basically I would like STM to either use the failure pool from the specified pool, or just fallback to the active nodes in the pool.

Even better, if there is a way to do a similar setup without the hassle of doing my own load balancing...

Re: How to customize load balancing gracefully

Sameh Ghane are you able to post the TS you are using? It is always good to share this kid of thing so that others can borrow, learn and contribute to the community!

So pool.use() and pool.select() do not utilise the failure pool configuration in the config. If you are health checking your proxy servers, you can check for active healthy nodes before you select the pool to use.

Are they actually failing health checks when they fail? If they are being health checked properly, you should check to make sure there are at least >1 nodes available using pool.activenodes() against the pool before you use a pool.use() or pool.select() (remembering that pool.use() stops processing immediately and the TS exits - if you need more TS to follow on, use pool.select().

# Healthy Pool is "test_pool_103"

# Unhealthy Pool is "test_pool_106"

# This will result in an STM error being sent as "test_pool_106" is down:

pool.select("test_pool_106");

# So long as you are health checking your pool members,

# we can test to ensure the pool has available nodes before we use it:

if( pool.activeNodes( "test_pool_106" ) < 1 ) {

log.warn( "Pool 106 is down, using the failure pool" );

pool.select("test_failpool");

}

Additionally, with Stingray Traffic Manager 9.6, we introduced functions to let you list the nodes are are available, failed, draining or disabled:

pool.listallnodes()

pool.listdisablednodes()

pool.listdrainingnodes()

pool.listfailednodes()

With these functions, you can check if the particular node you want is up first, before you make a decision to use it with pool.use() or pool.select().

Join the Community

Please note: Certain product lines referenced on this website have been acquired by third party buyers and may no longer be supported, offered or sold by Brocade. These product lines include, but are not limited to, the Virtual Router (vRouter), Virtual Application Delivery Controller (vADC), the Virtual Evolved Packet Core (vEPC) and the Software Defined Networking (SDN) Controller. Any mention of these product lines, including associated services and support on this site, as it relates to Brocade should now be considered historical reference only. Ongoing use of such products may be subject to terms and conditions of the buyer.

Some, but not all the content on this site is provided, reviewed, approved or endorsed by Brocade but in any case, is provided solely as a convenience of our customers. All postings and use of the content on this site are subject to the BROCADE WEBSITE USE TERMS AND CONDITIONS. BROCADE ASSUMES NO LIABILITY WHATSOEVER, MAKES NO REPRESENTATION AND DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO THE CONTENT PROVIDED HEREIN, INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, CORRECTNESS, APPROPRIATENESS OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED. THIRD PARTIES USE THIS CONTENT AT THEIR OWN RISK. Content on this site may contain or be subject to specific guidelines or limitation on use. Third parties using this content agree to abide by any limitation or guidelines and to comply with the BROCADE WEBSITE USE TERMS AND CONDITIONS. Brocade may make changes to this content, to specifications, or product design or descriptions at any time, or may remove content at its sole discretion without notice.