使用 apache 和 mod_rewrite 进行 A/B 测试

发布于 2024-11-25 12:46:43 字数 757 浏览 1 评论 0原文

尝试搜索此内容,但今天我的 google-fu 缺失了。

所以我有 2 个版本的站点,其中

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

每个文档根目录几乎都是一个完整的站点检修,我想进行 A/B(多变量)测试以查看哪个站点性能更好。

上周在谷歌上搜索时,我看到了关于执行此操作的建议(偶数秒和奇数秒),但由于该网站是一个篮子网站(或者甚至可能是一个篮子!),我不想在两种不同的处理场景之间切换交易中期。

因此,我认为如果客户端 IP 地址最后一个八位字节是偶数,则最好从 testa 提供服务,如果最后一个八位字节是奇数,则从 testb 提供服务会很好。然后,我们至少可以获得一些指标,了解有多少人在网站的不同版本中因为购物篮太笨重而放弃了。

我很确定一堆基于 %{REMOTE_ADDR} 的 RewriteCond 行可以做到这一点,但我对 mod_rewrite 非常绝望。

用户将访问 test.mydomain.com,并且应该均匀地从一个或另一个 DocumentRoot 提供服务,而不会在其 url 中看到 testa 或 testb,但我们可以记录每个变体的性能。

有哪位好心的大师可以指点一下吗?

TIA David

更新:如果有帮助的话,我可以通过虚拟主机将 testa.mydomain 和 testb.mydomain 设置为子域。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

陌伤ぢ 2024-12-02 12:46:43

选项 1(重定向)将其中之一添加到两个域

放置在偶数网站 (testb.mydomain.com)

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

放置在奇数网站 (testa.mydomain.com)

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

选项 2(子文件夹不是子域)

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]

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]
梦明 2024-12-02 12:46:43

Google 现在通过其 Google Analytics 实验接口/API 提供 A/B/N 测试。

有关此内容的文章写于:https://blog .crazyegg.com/2015/06/02/ab-testing-google-analytics/

您可以通过 Google 阅读更多相关信息:
https://developers.google.com/analytics/solutions/experiments

所以,一一种可能性是在您网站的两个版本中都放置 Google 跟踪,并让 Google 处理您网站的重定向(您可以使重定向始终相等或采用 Multi-Armed bandits 方法)。

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).

她如夕阳 2024-12-02 12:46:43

您尝试过负载均衡器吗?

您可以使用文件rules.xml或使用代码(Rule和RuleChain)设置负载平衡规则。 /balancer 中应该有一个示例系统,它向您展示如何编写规则。

另请参阅

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文