This repository is used to generate an artificial load to test the RudderStack architecture under intense traffic.
The service is designed to be run in a Kubernetes cluster.
It is possible to create multiple replicas of the service to increase the load.
Each replica owns a specific writeKey and will send events via multiple go routines. Each go routine will send events owning a set of keys. This way we can guarantee in-order delivery of events per writeKey-userId.
- Replicas: 3
- WriteKeys: 3
- it is a good idea to have enough writeKeys for the replicas since replica 0 will use writeKey 0, replica 1 will use writeKey 1, etc.
- Concurrency: 200 (number of go routines sending messages per replica, aka "producers")
- Message generators: 10 a. number of go routines that will generate events and send them to the producers (see point 3)
- Total users: 100000 a. number of unique users that will be used to generate the messages
- Hot user groups: 70,30 a. the sum of all the comma separated values must be equal to 100 (percentage) b. the percentage of user IDs concentration that will be used to generate the messages. In this case we have 100,000 total users (see point 5) and we are defining 2 hot user groups so we just divide 100,000 by 2 which gives us 2 groups of 50k users each. The probability of a message being generated for a user in the first group is 70% and 30% for the second group.
- Event types: page,batch(10,0),batch(30,100)
a. the types of events that will be generated. In this case, the program will generate 3 different types of events:
- page
- batch with 10 pages
- batch with 30 pages and 100 track events
- Hot event types: 60,25,15
a. the sum of all the comma separated values must be equal to 100 (percentage)
b. the percentage of event types concentration that will be used to generate the messages.
In this case we have 3 event types (see point 7) and we are defining 3 hot event types, one for each event type.
Given
page,batch(10,0),batch(30,100)
and hot event types60,25,15
we'll have 60% probability to get apage
, 25% probability to get abatch(10,0)
and 15% probability to get abatch(30,100)
. - Batches sizes and hot batch sizes (they would work the same as hot event types but for the batch sizes)
To add more event types simply do:
- add template inside
templates
folder likepage.json.tmpl
- the name of the file without extension can now be used as an event type
- now you have to define a function to populate your template inside
cmd/producer/event_types.go
and then update thevar eventGenerators = map[string]eventGenerator{}
map with your function (use name of the template as key)
In order to deploy you'll have to use the Makefile
recipes.
The Makefile
has 2 important variables:
K8S_NAMESPACE
: the Kubernetes namespace where it should deploy therudder-load
service
Those are the only variables that you can tune via the Makefile
.
Before deploying you will have to create a copy of your value file (e.g. http_values.yaml
) and add _copy.yaml
at the
end of the file name (e.g. http_values_copy.yaml
). The Makefile
will use the copied file.
Also, that file is ignored by git so you can add whatever you want to it.
The docker image is built in the CI pipeline.
If you want you can still build your own image by doing make DOCKER_USER=<your-docker-username> build
.
Remember to update your values file (e.g. http_values_copy.yaml
) with the new image tag (see
deployment.image
).
# To deploy
make K8S_NAMESPACE=my-ns deploy-http
# To remove the last deployment
K8S_NAMESPACE=my-ns make delete-http
# To follow the rudder-load logs
K8S_NAMESPACE=my-ns make logs