Membrane can serve as a software load balancer for APIs. It can distribute requests across multiple backend nodes and handle failures.
This sample shows a simple static configuration. For health checks, sticky sessions, or dynamic discovery, see the other examples.
- One Membrane router as the load balancer
- Three mock services that simulate backend nodes
- Round-robin request distribution
- Go to the
examples/loadbalancing/1-staticdirectory.cd examples/loadbalancing/1-static - Start Membrane:
- macOS/Linux: ./membrane.sh
- Windows: membrane.cmd
- Open in a browser:
http://localhost:8080 - Refresh the browser a few times.
By refreshing the browser or resending the request you should see responses alternating between node 1, node 2, and node 3.
See:
- proxies.xml
- balancer reference