Forum Discussion
Kevin_106976
Nimbostratus
Jul 16, 2010Distribute load based on uri
Hi,
I want to distribute load across two uri's (/some/uri1 and /some/uri2) on a 70/30 percentage basis. Can I do this via an iRule ?
15 Replies
- Chris_Miller
Altostratus
Posted By Kevin on 07/16/2010 04:39 PM
Hi,
I want to distribute load across two uri's (/some/uri1 and /some/uri2) on a 70/30 percentage basis. Can I do this via an iRule ?
I'm not entirely sure what you mean by distributing load across two URIs. How can you affect what URI a user requests? Or, are you accepting requests, and then redirecting users to those URIs? - Kevin_106976
Nimbostratus
Thanks for replying Chris. Currently my iRule simply checks for either of these two uri's and sends it to pool "some_pool". Since its round robin, both the uri's get 50% of the traffic. I want to change that to 70/30. - The_Bhattman
Nimbostratus
Hi Kevin,
In that case you don't need a irule to accomplish this. You can simply use Ratio Load balancing. You could set the ratio on the members you want to receive 70% of traffic to 7 and the ratio of members you want to receive 30% to 3.
Here is a link to a v10.2 guide for more details
http://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm_configuration_guide_10_1.html
Ratio (member) and Ratio (node)
The BIG-IP system distributes connections among machines according to ratio weights that you define, where the number of connections that each machine receives over time is proportionate to a ratio weight you define for each machine. These are static load balancing methods, basing distribution on static user-assigned ratio weights that are proportional to the capacity of the servers. Regarding Ratio load balancing:
Load balancing calculations may be localized to each pool (member-based calculation) or they may apply to all pools of which a server is a member (node-based calculation). This distinction is especially important with the Ratio method; with the Ratio (member) method, the actual ratio weight is a member setting in the pool definition, whereas with the Ratio (node) method, the ratio weight is a setting of the node.
The default ratio setting for any node is 1. If you use the Ratio (as opposed to Ratio (member) load balancing method, you must set a ratio other than 1 for at least one node in the configuration. If you do not change at least one ratio setting, the load balancing method has the same effect as the Round Robin load balancing method.
Warning: If you set the load balancing method to Ratio (node), as opposed to Ratio (Member), you must define a ratio setting for each node.
I hope this helps
Bhattman - Chris_Miller
Altostratus
Posted By Bhattman on 07/17/2010 01:42 PM
Hi Kevin,
In that case you don't need a irule to accomplish this. You can simply use Ratio Load balancing. You could set the ratio on the members you want to receive 70% of traffic to 7 and the ratio of members you want to receive 30% to 3.
Here is a link to a v10.2 guide for more details
http://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm_configuration_guide_10_1.html
Ratio (member) and Ratio (node)
The BIG-IP system distributes connections among machines according to ratio weights that you define, where the number of connections that each machine receives over time is proportionate to a ratio weight you define for each machine. These are static load balancing methods, basing distribution on static user-assigned ratio weights that are proportional to the capacity of the servers. Regarding Ratio load balancing:
Load balancing calculations may be localized to each pool (member-based calculation) or they may apply to all pools of which a server is a member (node-based calculation). This distinction is especially important with the Ratio method; with the Ratio (member) method, the actual ratio weight is a member setting in the pool definition, whereas with the Ratio (node) method, the ratio weight is a setting of the node.
The default ratio setting for any node is 1. If you use the Ratio (as opposed to Ratio (member) load balancing method, you must set a ratio other than 1 for at least one node in the configuration. If you do not change at least one ratio setting, the load balancing method has the same effect as the Round Robin load balancing method.
Warning: If you set the load balancing method to Ratio (node), as opposed to Ratio (Member), you must define a ratio setting for each node.
I hope this helps
Bhattman
Bhattman's spot on here - set your ratio in "some_pool" to 7:3 - Kevin_106976
Nimbostratus
Thanks for the replies and I apologize for not replying earlier - its been a crazy week.
The problem I have with the suggestion is this - say I have two members in the pool, A and B ; both the members serve uri's /some/uri1 and /some/uri2. In other words, setting the ratio at the pool level will not help me as the load will be distributed at the pool member level - not at the uri level ; and since both the members serve both the uri's, the traffic will not be distributed at the uri level but at the pool member level.
This is why I stated load distribution based on uri - vs pool members. - Chris_Miller
Altostratus
You haven't clarified what you mean by 70/30 URI split...70% of URI 1 should go to server 1? 70% of URI 2 should go to server 2? - Kevin_106976
Nimbostratus
Say the "/some/index.html" has a link called "search", if 100 users click this link, 70 of the requests should go to URI1 and the remaining 30 should go to URI2. - Chris_Miller
Altostratus
Posted By Kevin on 07/25/2010 09:46 AM
Say the "/some/index.html" has a link called "search", if 100 users click this link, 70 of the requests should go to URI1 and the remaining 30 should go to URI2.
So, 70% of the time, you want to send a redirect so the user gets sent to URI1? - Kevin_106976
Nimbostratus
Thats correct Chris. - The_Bhattman
Nimbostratus
Hi Kevin,
I wrote up a conceptual iRule that lcould represent what you are looking for. It's not elegant in my opinion, but at the very least should provide you with some ideas of how to write one up.when RULE_INIT { set counter 0 } when CLIENT_ACCEPTED { if {$::counter <= 7} { The first 7 connections go to Server A for URI 1 pool member incr $::counter } elseif {$::counter <= 10 } { The next 3 connections go to server B for URI 2 pool member incr $::counter } else { Reset the counter when 11th connection is reached and go to SERVER A for URI 1 set $::counter 0 pool member } }
I hope this helps
Bhattman
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
