experiment-service

command module
v0.0.0-...-a7ecbba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

README

A/B Experimentation Route Service

About

A simple system for distributing traffic between two Cloud Foundry applications in a set ratio.

If you would like more information about Route Services in Cloud Foundry, please refer to CF dev docs.

Prerequisites

  • A Cloud Foundry and Diego deployment
  • CF CLI v6.16+
  • Two versions of an application deployed for experimentation:
  • One version called myapp-a
  • Another version called myapp-b
$ git clone https://github.com/hatofmonkeys/experiment-service.git

Install

Set up Redis

Create a Redis service to store A/B ratios and configure the connection in main.go


Addr:     "xxxxxxxxxxxxx",
Password: "xxxxxxxxxxxxx", // no password set
DB:       0,               // use default DB

Set a value in Redis with the key 'ratio' between 0 and 100 to dictate the percentage of traffic to be directed to app A. All other traffic will go to app B.

myredis.com:17966> set ratio 100
OK
myredis.com:17966> get ratio
"100"
Deploy Experiment App
$ cd experiment-service
$ cf push experiment-service
Create Route Service

The following will create a route service instance using a user-provided service and specifies the route service url (see step above).

$ cf create-user-provided-service experiment-service -r https://experiment-service.cfapps.io
Creating user provided service experiment-service in org my-org / space as admin...
OK
Map both versions to true hostname
$ cf map-route myapp-a cfapps.io --hostname myapp
$ cf map-route myapp-b cfapps.io --hostname myapp
Bind Route to Service Instance

The following will create bind the application's route to the route service instance.

$ cf bind-route-service cfapps.io experiment-service --hostname myapp
Binding route myapp.cfapps.io to service instance experiment-service in org my-org / my-space as admin...
OK

Try it out

Adjust the ratio in real time to direct varying levels of traffic to versions A and B.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/juju/ratelimit
The ratelimit package provides an efficient token bucket implementation that can be used to limit the rate of arbitrary things.
The ratelimit package provides an efficient token bucket implementation that can be used to limit the rate of arbitrary things.
_workspace/src/github.com/onsi/ginkgo
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
_workspace/src/github.com/onsi/ginkgo/config
Ginkgo accepts a number of configuration options.
Ginkgo accepts a number of configuration options.
_workspace/src/github.com/onsi/ginkgo/ginkgo
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
_workspace/src/github.com/onsi/ginkgo/internal/remote
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
_workspace/src/github.com/onsi/ginkgo/reporters
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
_workspace/src/github.com/onsi/gomega
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
_workspace/src/github.com/onsi/gomega/format
Gomega's format package pretty-prints objects.
Gomega's format package pretty-prints objects.
_workspace/src/github.com/onsi/gomega/gbytes
Package gbytes provides a buffer that supports incrementally detecting input.
Package gbytes provides a buffer that supports incrementally detecting input.
_workspace/src/github.com/onsi/gomega/gexec
Package gexec provides support for testing external processes.
Package gexec provides support for testing external processes.
_workspace/src/github.com/onsi/gomega/ghttp
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
_workspace/src/github.com/onsi/gomega/matchers
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
_workspace/src/gopkg.in/bsm/ratelimit.v1
Simple, thread-safe Go rate-limiter.
Simple, thread-safe Go rate-limiter.
_workspace/src/gopkg.in/redis.v3
Package redis implements a Redis client.
Package redis implements a Redis client.
_workspace/src/gopkg.in/redis.v3/internal/consistenthash
Package consistenthash provides an implementation of a ring hash.
Package consistenthash provides an implementation of a ring hash.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL