5

Tried searching for this but my google-fu is lacking today.

So I have 2 versions of site, in

/var/www/vhosts/testa.mydomain.com/httpdocs and 
/var/www/vhosts/testb.mydomain.com/httpdocs

where each documentroot is pretty much a complete site overhaul, and I want to do A/B (multivariate) testing to see which site performs better.

Googling last week I saw suggestions on doing this time based (even & odd seconds), but because the site is a basket site (or perhaps even a basket-case!), I don't want to flit between 2 different processing scenarios mid-transaction.

So I thought it would be good to serve from testa if client ip address last octet was even, and from testb if last octet was odd. We could then at least gain some metrics on how many people abandoned the basket as too unwieldy in different versions of the site.

I'm pretty sure that a bunch of RewriteCond lines based on %{REMOTE_ADDR} will do it, but I'm pretty hopless at mod_rewrite.

users would visit test.mydomain.com, and be should served from one or the other DocumentRoot's evenly, not seeing testa or testb in their url, but we could log each variant's performance.

Any kindly guru's able to advise ?

TIA David

Update: I can set up testa.mydomain and testb.mydomain as subdomains via virtual hosts if that would help any.

David Shields
  • 596
  • 1
  • 12
  • 34

3 Answers3

4

Option 1 (Redirects) add one of these to both domains

Place on even number site (testb.mydomain.com)

RewriteEngine On
RewriteCond %{REMOTE_ADDR} [13579]$
RewriteRule .* http://testa.mydomain.com/$1 [R=301,L]

Place on odd number site (testa.mydomain.com)

RewriteEngine On
RewriteCond %{REMOTE_ADDR} [02468]$
RewriteRule .* http://testb.mydomain.com/$1 [R=301,L]

Option 2 (subfolders NOT subdomains)

RewriteEngine On
#direct to EVEN SITE
RewriteCond %{REMOTE_ADDR} [02468]$
RewriteRule (.*) /testa.mydomain.com/$1 [L]

#direct to ODD SITE
RewriteCond %{REMOTE_ADDR} [13579]$
RewriteRule (.*) /testb.mydomain.com/$1 [L]
Andrew Winter
  • 1,116
  • 1
  • 8
  • 27
  • just going to test this. If it works, you'll have the bounty and my unending gratitude ! – David Shields Jul 29 '11 at 13:49
  • On a side note, Option 2 would allow you to use the same domain for both sites, as it just internally directs the users to the correct site version. – Andrew Winter Jul 30 '11 at 04:15
  • Got legged up with evil http config files. Multiple VirtualHosts on machine, scattered config Includes, can't even see RewriteLog entries at the moment ! Bounty awarded anyway, as most likely to solve my problem after I solve my own config issues! – David Shields Aug 02 '11 at 15:38
1

Google now offers A/B/N testing through its Google Analytics Experiments Interface / API.

The article about this is written at: https://blog.crazyegg.com/2015/06/02/ab-testing-google-analytics/

You can read more about it from Google at: https://developers.google.com/analytics/solutions/experiments

So, one possibility would be to put Google's tracking in both versions of your site and let Google handle redirects of your site (you can make redirects be equal at all times or take Multi-Armed bandits approach).

Jenna Kwon
  • 1,212
  • 1
  • 12
  • 22
0

Have you tried the load balancer?

You can set up load balancing rules with the file rules.xml or using code (Rule and RuleChain). There should be an example system in /balancer, which shows you how to write rules.

See also

http://tomcat.apache.org/tomcat-5.5-doc/balancer-howto.html#Sample_Configuration

http://onjava.com/pub/a/onjava/2004/03/31/clustering.html

tb189
  • 1,942
  • 3
  • 22
  • 37