-
Notifications
You must be signed in to change notification settings - Fork 39
Temp removal of page in docs #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
173 changes: 173 additions & 0 deletions
173
docs/hypernode-platform/nginx/hypernode-manage-vhosts-ab-testing.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| --- | ||
|
|
||
| myst: | ||
| html_meta: | ||
| description: Learn how to use A/B testing on Hypernode using the NGINX split_clients module and Hypernode Managed Vhosts (HMV). | ||
| title: How to configure A/B testing with Hypernode Managed Vhosts? | ||
| redirect_from: | ||
|
|
||
| * /en/hypernode/nginx/ab-testing-hmv/ | ||
|
|
||
| --- | ||
|
|
||
| <!-- source: internal knowledge + nginx.org documentation --> | ||
|
|
||
| # A/B Testing with Hypernode Managed Vhosts | ||
|
|
||
| Hypernode Managed Vhosts (HMV) supports A/B testing by using the native NGINX `split_clients` module. This allows you to route users to different versions of your application based on a defined percentage split. | ||
|
|
||
| This setup is useful when you want to test different codebases, features, or layouts without deploying changes to all users at once. | ||
|
|
||
| ## How A/B Testing Works | ||
|
|
||
| The `split_clients` module assigns users to a variant based on a hashed value. This ensures: | ||
|
|
||
| * Consistent routing for the same user | ||
| * Even distribution based on percentages | ||
| * No need for external tools | ||
|
|
||
| Each user is mapped to a variant using values like: | ||
|
|
||
| * IP address | ||
| * User agent | ||
| * Time-based values | ||
|
|
||
| ## Enabling A/B Testing with HMV | ||
|
|
||
| To create an A/B testing setup, run: | ||
|
|
||
| ```bash | ||
| hypernode-manage-vhosts example.com --type ab-test | ||
| ``` | ||
|
|
||
| This generates the required configuration files inside: | ||
|
|
||
| ``` | ||
| /data/web/nginx/example.com/ | ||
| ``` | ||
|
|
||
| You will see: | ||
|
|
||
| * http.vhost_split_clients.conf | ||
| * server.ab-proxy.conf | ||
|
|
||
| ## Example Configuration | ||
|
|
||
| ### Split configuration | ||
|
|
||
| ```nginx | ||
| split_clients "cache${remote_addr}${http_user_agent}${date_gmt}" $vhost_variant { | ||
| 50% a.example.com; | ||
| 50% b.example.com; | ||
| } | ||
| ``` | ||
|
|
||
| This defines a 50/50 split between two variants. | ||
|
|
||
| ### Proxy configuration | ||
|
|
||
| ```nginx | ||
| location / { | ||
| resolver 8.8.8.8; | ||
| proxy_pass http://${vhost_variant}; | ||
| } | ||
| ``` | ||
|
|
||
| Requests are routed dynamically based on the assigned variant. | ||
|
|
||
| ## Setting Up Variants | ||
|
|
||
| You must create separate vhosts for each variant: | ||
|
|
||
| * a.example.com → version A | ||
| * b.example.com → version B | ||
|
|
||
| These should be standard vhosts using HMV: | ||
|
|
||
| ```bash | ||
| hypernode-manage-vhosts a.example.com | ||
| hypernode-manage-vhosts b.example.com | ||
| ``` | ||
|
|
||
| Each vhost can point to a different codebase or deployment. | ||
|
|
||
| ## Custom Traffic Splits | ||
|
|
||
| You can adjust the percentages to control traffic distribution. | ||
|
|
||
| Example: 70/30 split | ||
|
|
||
| ```nginx | ||
| split_clients "cache${remote_addr}${http_user_agent}${date_gmt}" $vhost_variant { | ||
| 30% a.example.com; | ||
| 70% b.example.com; | ||
| } | ||
| ``` | ||
|
|
||
| Example: multiple variants | ||
|
|
||
| ```nginx | ||
| split_clients "cache${remote_addr}${http_user_agent}${date_gmt}" $vhost_variant { | ||
| 20% a.example.com; | ||
| 20% b.example.com; | ||
| 20% c.example.com; | ||
| 20% d.example.com; | ||
| 20% e.example.com; | ||
| } | ||
| ``` | ||
|
|
||
| ## Important Notes | ||
|
|
||
| * The split is deterministic. The same user will consistently hit the same variant. | ||
| * Changes to the split logic may reassign users. | ||
| * You must ensure all variant domains are reachable and correctly configured. | ||
| * DNS resolution is required for proxying, hence the resolver directive. | ||
|
|
||
| ## How the Split is Determined | ||
|
|
||
| The input string: | ||
|
|
||
| ``` | ||
| "cache${remote_addr}${http_user_agent}${date_gmt}" | ||
| ``` | ||
|
|
||
| is hashed using MurmurHash2. | ||
|
|
||
| This hash determines which percentage bucket a user falls into. | ||
|
|
||
| Example mapping: | ||
|
|
||
| * First 0.5% → variant A | ||
| * Next 2% → variant B | ||
| * Remaining → default | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| If routing behaves unexpectedly: | ||
|
|
||
| * Run: | ||
|
|
||
| ```bash | ||
| hypernode-manage-vhosts --all | ||
| ``` | ||
|
|
||
| * Verify all variant vhosts exist | ||
| * Check DNS resolution | ||
| * Validate nginx configuration: | ||
|
|
||
| ```bash | ||
| nginx -t | ||
| ``` | ||
|
|
||
| ## When to Use This Setup | ||
|
|
||
| Use this approach when: | ||
|
|
||
| * You need infrastructure-level A/B testing | ||
| * You run separate codebases per variant | ||
| * You want full control without external tools | ||
|
|
||
| Avoid this setup if: | ||
|
|
||
| * You only need frontend experiments | ||
| * You rely on analytics tools like Google Optimize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.