Request mirroring & shadow deployments
Request mirroring allows you to send copies of live requests to other deployments without impacting the responses to those live requests. These mirrored requests are useful for testing new versions of deployments against production traffic without affecting your users.
Request mirroring requires that an endpoint be configured for request aliasing or request splitting because mirrored deployments do not return a value to the caller.
To avoid errors, the deployments configured for mirroring should expect the same input format as the deployment configured for request aliasing or the deployments configured for request splitting.
Creating a request mirroring endpoint with the web app
After creating a request aliasing or request splitting endpoint, click the +
icon within the Request Mirroring
section of that endpoint, and choose a deployment and version.
Each mirrored deployment will receive an identical copy of new requests sent to the endpoint. The mirrored deployment will process the request, and log the results, as if it was a live request. However the results (or errors) of mirrored deployments are ignored by the endpoint, and will not affect the live requests sent to the other deployments.
Creating a request mirroring endpoint with git
First, create yaml
file for a request aliasing or request splitting endpoint. Then add mirroring by adding a mirrors
section below backends
.
The example below is an aliasing endpoint serving the latest
version of the pricing_model_v1
deployment, and mirrors requests to the latest
version of the pricing_model_v2
deployment. Requests to and responses from pricing_model_v1
are unaffected, and pricing_model_v2
gets the same traffic for testing and logging:
backends:
alias:
deployment:
branch: main
name: pricing_model_v1
version: latest
mirrors:
mirror_1:
deployment:
branch: main
name: pricing_model_v2
version: latest
schemaVersion: 1
Notice that mirrors are named. In this case the mirror's name is mirror_1
. This name is logged to the backend
field of Modelbit logs to assist with analysis.
Performance of request-mirroring
Traffic that gets mirrored to a shadow deployment does not impact the primary request.
Modelbit will not wait for the shadow deployment to respond before returning the results from the primary request. Likewise, errors raised by the shadow deployment are ignored and do not affect the primary request.