This repository provides a basic example of traffic splitting using the NGINX ngx_http_split_clients_module.
It includes a sample scenario that you can explore and modify. See the "Getting Started" section below.
This example requires that you have docker and docker-compose installed. See the docker installation page for more details.
This example uses the official NGINX docker image and Livebook to provide an interactive example of traffic splitting.
- Clone this repository:
git clone https://github.com/bitesized-nginx/traffic-splitting.git
- From the root directory of the project, run
docker-compose up
- In browser, navigate to:
http://0.0.0.0:8080/
- Click on
traffic_splitting.livemd
, then the blue "open" button upper right.
Instructions are provided in the notebook and you can follow the instructions. Each "cell" will have an "evaluate" button on the upper left corner when you hover your cursor over it. Clicking that will perform the action in the shell.
Nope! Livebook is a powerful tool for writing composable interactive examples with tutorial content inline which is why it was chosen. However, we've set it up in such a way that you don't need to know any Elixir to use it.
You may have to enter numerical values into Elixir code from time to time, but it should be self explanatory. For example take the following code block:
NginxLivebookUtils.TrafficGenerator.run("frontend", "/", call_count: 100, call_delay_ms: 500)
In order to send more or less traffic, you'll just need to modify the number to the right of call_count
. To insert a small delay between each call, change the number to the right of call_delay_ms
to the number of milliseconds the generator should sleep between requests.
However, if you are interested in learning Elixir, See the official Getting Started Guide or Elixir School. This tool is called Livebook. If you do, you'll be able to easily modify the generated diagrams, and create more robust examples if you'd like to do other measurements.
Please see the contributing guide for guidelines on how to best contribute to this project.
© F5, Inc. 2023