Weighted API Routes for Canary Releases

In Membrane, you can direct incoming requests to your API using the expression test property. Using the weight function, we can offload a percentage of traffic to another endpoint. This can be used to slowly roll out a new API as a canary release. In this instance we set the weight to 55%.

Ingredients

Configuration

<api port="2000" test="weight(55)">
    <template>
        New API
    </template>
    <return />
</api>

<api port="2000">
    <template>
        Old API
    </template>
    <return />
</api>