Forum Discussion
mpfeifer_63884
Nimbostratus
Nov 12, 2009redirect part of the traffic
Hi. This is my first post in this forum, I'm not sure if it is the right topic, but as it might involve complex iRuling, I give it a try to post it under "iRules".
We have a difficult issue to set up, and it looks like this:
We have about 70 Webservers, they're all in one pool and get the traffic assigned by RoundRobin.
Now we need to redirect about 3% of the traffic to a subdomain.
We had a few ideas, like:
-redirect the traffic to 3% of of the webservers using "ratio" instead of roundrobin, but then still, how can we squeeze in an iRule at this level? Reading the docs I understand, that this is probably not possible.
-Another idea was to create an iRule which counts every userrequest and every 60th requests goes to that subdomain. But I believe that will cost a lot in performance.
Nevertheless I dislike both these solutions.
Does someone in this forum have an idea how to handle this? That would be really great.
Thanks in advance.
Markus
- James_Quinby_46Historic F5 AccountSo, to make sure I understand:
- James_Quinby_46Historic F5 AccountHmm. This is sort of working, but maybe one of the gurus can explain an odd bit of behavior I'm seeing.
when HTTP_REQUEST { log local0. "rule starting, count is: [STATS::get counter "counter"] " if {[STATS::get counter "counter"] == 40} { reset the clock STATS::set counter "counter" 0 log local0. "Clock was reset to 0." } if {[STATS::get counter "counter"] == 33} { HTTP::redirect http://www.google.com log local0. "redirect issued!" } STATS::incr counter "counter" log local0. "Incremented the current count to: [STATS::get counter "counter"]" }
Nov 12 14:55:35 v10bigip tmm tmm[5000]: Rule redirect_some_percent : Incremented the current count to: 1 Nov 12 14:55:39 v10bigip tmm1 tmm1[5001]: Rule redirect_some_percent : rule starting, count is: 40 Nov 12 14:55:39 v10bigip tmm1 tmm1[5001]: Rule redirect_some_percent : Clock was reset to 0. Nov 12 14:55:39 v10bigip tmm1 tmm1[5001]: Rule redirect_some_percent : Incremented the current count to: 1 Nov 12 14:55:47 v10bigip tmm tmm[5000]: Rule redirect_some_percent : rule starting, count is: 1 Nov 12 14:55:47 v10bigip tmm tmm[5000]: Rule redirect_some_percent : Incremented the current count to: 2 Nov 12 14:55:50 v10bigip tmm1 tmm1[5001]: Rule redirect_some_percent : rule starting, count is: 1 Nov 12 14:55:50 v10bigip tmm1 tmm1[5001]: Rule redirect_some_percent : Incremented the current count to: 2
- hoolio
Cirrostratus
Hi JQ, - spark_86682Historic F5 AccountI think a better solution could be to add some dummy pool members (such that 3% of pool members are dummies) and check to see if they were hit in LB_FAILED and do the redirect there.
- hoolio
Cirrostratus
Hi Spark, - hoolio
Cirrostratus
Aye... this isn't looking good. It seems like each TMM references its own copy of a stats profile. This isn't mentioned in SOL7751 or the CMP page. I opened a case on this (C595714).when HTTP_REQUEST { STATS::incr test_stats_profile field1 log local0. "field1: [STATS::get test_stats_profile field1]" }
Nov 13 12:26:57 local/tmm info tmm[7675]: Rule test_stats_simple_rule : field1: 2 Nov 13 12:26:57 local/tmm info tmm[7675]: Rule test_stats_simple_rule : field1: 3 Nov 13 12:26:58 local/tmm1 info tmm1[7681]: Rule test_stats_simple_rule : field1: 5 Nov 13 12:26:58 local/tmm info tmm[7675]: Rule test_stats_simple_rule : field1: 4 Nov 13 12:26:58 local/tmm1 info tmm1[7681]: Rule test_stats_simple_rule : field1: 6 Nov 13 12:26:58 local/tmm info tmm[7675]: Rule test_stats_simple_rule : field1: 5 Nov 13 12:26:58 local/tmm1 info tmm1[7681]: Rule test_stats_simple_rule : field1: 7 Nov 13 12:26:58 local/tmm info tmm[7675]: Rule test_stats_simple_rule : field1: 6 Nov 13 12:26:58 local/tmm1 info tmm1[7681]: Rule test_stats_simple_rule : field1: 8 Nov 13 12:26:58 local/tmm info tmm[7675]: Rule test_stats_simple_rule : field1: 7 Nov 13 12:26:58 local/tmm1 info tmm1[7681]: Rule test_stats_simple_rule : field1: 9 Nov 13 12:26:58 local/tmm info tmm[7675]: Rule test_stats_simple_rule : field1: 8 Nov 13 12:26:58 local/tmm1 info tmm1[7681]: Rule test_stats_simple_rule : field1: 10 Nov 13 12:26:58 local/tmm info tmm[7675]: Rule test_stats_simple_rule : field1: 9 Nov 13 12:26:59 local/tmm1 info tmm1[7681]: Rule test_stats_simple_rule : field1: 11 Nov 13 12:26:59 local/tmm info tmm[7675]: Rule test_stats_simple_rule : field1: 10
- mpfeifer_63884
Nimbostratus
Hi hoolio, hi sparks. Thanks for the ideas. Indeed to manage it through a STATS-profile seems like a good idea (hoping that it doesn't have an impact on the performance, but I'll see that in the tests). - James_Quinby_46Historic F5 AccountAssuming the CMP bit can be addressed (simple and fast workaround - depending on traffic profile, it's possible demote the Virtual Server so that CMP is not an issue), the rule would just include a check for the cookie (HTTP::cookie exists), and another line for the HTTP::cookie insert. See:
- spark_86682Historic F5 AccountI don't know of any efforts to make them work across CMP in tmm-land, but that's hardly definitive. The general way that stats are handled right now is that each tmm keeps track of its own statistics, and then these are published to user-space where they are rolled-up (external to tmm). So it is quite possible that SNMP reporting works as expected, even if each tmm acts independently. This is not a part of the product that I'm intimately familiar with, so please don't take this as gospel.
- spark_86682Historic F5 AccountThe session command is used to access a global table, and could be used instead of a stats profile to keep track of data. While there are currently some limitations to doing things that way, they should not affect this use of them over-much, and you could solve the problem that way.
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