Skip to content

Commit 292469f

Browse files
authored
docs(self-hosted): provide a detailed example on how to separate ingest taskbroker (#15601)
Whenever self-hosted users has delay on their notifications or alert, I would recommend them to do this first. Previously there's no clear documentation on how to implement this.
1 parent d5f105f commit 292469f

File tree

1 file changed

+53
-2
lines changed

1 file changed

+53
-2
lines changed

develop-docs/self-hosted/tasks.mdx

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,69 @@ tb-d --> w-d[default Worker]
128128
To achieve this work separation we need to make a few changes:
129129

130130
1. Provision any additional topics. Topic names need to come from one of the
131-
predefined topics in `src/sentry/conf/types/kafka_definition.py`
131+
predefined topics in [`src/sentry/conf/types/kafka_definition.py`](https://github.com/getsentry/sentry/blob/master/src/sentry/conf/types/kafka_definition.py).
132+
By default, any topics will automatically be created during `./install.sh`
133+
process.
132134
2. Deploy the additional broker replicas. You can use the
133135
`TASKBROKER_KAFKA_TOPIC` environment variable to define the topic a
134136
taskbroker consumes from.
135137
3. Deploy additional workers that use the new brokers in their `rpc-host-list`
136138
CLI flag.
137139
4. Find the list of namespaces you want to shift to the new topic. The list of
138-
task namespaces can be found in the `sentry.taskworker.namespaces` module.
140+
task namespaces can be found in the [`sentry.taskworker.namespaces`](https://github.com/getsentry/sentry/blob/master/src/sentry/taskworker/namespaces.py) module.
139141
5. Update task routing option, defining the namespace -> topic mappings. e.g.
140142
```yaml
141143
# in sentry/config.yml
142144
taskworker.route.overrides:
143145
"ingest.errors": "taskworker-ingest"
144146
"ingest.transactions": "taskworker-ingest"
145147
```
148+
149+
### Separate Ingest Workers
150+
151+
Having separate ingest `taskbroker` and `taskworker` is useful for high-throughput
152+
installations, therefore you can receive timely alerts and not have to wait for
153+
ingest-related tasks to finish. As an implementation of the above steps,
154+
you need to add a few new containers on your `docker-compose.override.yml` file:
155+
156+
```yaml
157+
# Copy `x-sentry_defaults` and `file_healthcheck_defaults` section from
158+
# `docker-compose.yml` to `docker-compose.override.yml` first. Put it on the
159+
# top of the file.
160+
services:
161+
taskbroker-ingest:
162+
restart: "unless-stopped"
163+
image: "$TASKBROKER_IMAGE"
164+
environment:
165+
TASKBROKER_KAFKA_TOPIC: "taskworker-ingest"
166+
TASKBROKER_KAFKA_CONSUMER_GROUP: "taskworker-ingest"
167+
TASKBROKER_KAFKA_CLUSTER: "kafka:9092"
168+
TASKBROKER_KAFKA_DEADLETTER_CLUSTER: "kafka:9092"
169+
TASKBROKER_DB_PATH: "/opt/sqlite/taskbroker-activations-ingest.sqlite"
170+
volumes:
171+
- sentry-taskbroker-ingest:/opt/sqlite
172+
depends_on:
173+
- kafka
174+
taskworker-ingest:
175+
<<: *sentry_defaults
176+
command: run taskworker --concurrency=4 --rpc-host-list=taskbroker-ingest:50051 --health-check-file-path=/tmp/health.txt
177+
healthcheck:
178+
<<: *file_healthcheck_defaults
179+
180+
volumes:
181+
sentry-taskbroker-ingest: {}
182+
```
183+
184+
On your `sentry/config.yml` file, you need to append the following to the
185+
bottom of the file:
186+
```yaml
187+
taskworker.route.overrides:
188+
"ingest.errors": "taskworker-ingest"
189+
"ingest.transactions": "taskworker-ingest"
190+
"ingest.profiling": "taskworker-ingest"
191+
"ingest.attachments": "taskworker-ingest"
192+
"ingest.errors.postprocess": "taskworker-ingest"
193+
```
194+
195+
Any other tasks that are not defined on the routes override above will be
196+
handled by the default `taskbroker` and `taskworker` service.

0 commit comments

Comments
 (0)