Skip to content

Commit c2c276d

Browse files
authored
Add documentation on how to configure and debug connector resources. (#16204)
* Add documentation on how to configure and debug connector resources. * Wording. * Add to sidebar.
1 parent fbac1d3 commit c2c276d

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Configuring Connector Resources
2+
3+
As noted in [Workers & Jobs](../understanding-airbyte/jobs.md), there are four different types of jobs.
4+
5+
Although it is possible to configure resources for all four jobs, we focus on Sync jobs as it is the most frequently run job.
6+
7+
There are three different ways to configure connector resource requirements for a Sync:
8+
1. Instance-wide - applies to all containers in a Sync.
9+
2. Connector-specific - applies to all containers of that connector type in a Sync.
10+
3. Connection-specific - applies to all containers of that connection in a Sync.
11+
12+
In general, **the narrower scope the requirement, the higher the precedence**.
13+
14+
In decreasing order of precedence:
15+
1. Connection-specific - Highest precedence. Overrides all other configuration. We recommend using this on a case-by-case basis.
16+
2. Connector-specific - Second-highest precedence. Overrides instance-wide configuration. Mostly for internal Airbyte-use. We recommend staying away from this.
17+
3. Instance-wide - Lowest precedence. Overridden by all other configuration. Intended to be a default. We recommend setting this as a baseline.
18+
19+
## Configuring Instance-Wide Requirements
20+
21+
Instance-wide requirements are the simplest requirement to configure. All that is needed is to set the following env vars:
22+
1. `JOB_MAIN_CONTAINER_CPU_REQUEST` - Define the job container's minimum CPU usage. Units follow either Docker or Kubernetes, depending on the deployment. Defaults to none.
23+
2. `JOB_MAIN_CONTAINER_CPU_LIMIT` - Define the job container's maximum CPU usage. Units follow either Docker or Kubernetes, depending on the deployment. Defaults to none.
24+
3. `JOB_MAIN_CONTAINER_MEMORY_REQUEST` - Define the job container's minimum RAM usage. Units follow either Docker or Kubernetes, depending on the deployment. Defaults to none.
25+
4. `JOB_MAIN_CONTAINER_MEMORY_LIMIT` - Define the job container's maximum RAM usage. Units follow either Docker or Kubernetes, depending on the deployment. Defaults to none.
26+
27+
## Configuring Connector-Specific Requirements
28+
29+
1. Connect to the database and run the following query with the image name replaced to find the connector definition id.
30+
```sql
31+
select * from actor_definition where actor_definition.docker_repository like '%<image-name>';
32+
```
33+
2. Run the following commend with the resource requirements and the connection definition id filled in.
34+
```sql
35+
update actor_definition set resource_requirements = '{"jobSpecific": [{"jobType": "sync", "resourceRequirements": {"cpu_limit": "0.5", "cpu_request": "0.5", "memory_limit": "500Mi", "memory_request": "500Mi"}}]}' where id = '<id-from-step-1>';
36+
```
37+
38+
## Configuring Connection-Specific Requirements
39+
40+
1. Navigate to the connection in the Airbyte UI and extract the connection id from the url.
41+
1. The url format is `<base_url>/workspaces/<workspace-id>/connections/<connection-id>/status`.
42+
If the url is `localhost:8000/workspaces/92ad8c0e-d204-4bb4-9c9e-30fe25614eee/connections/5432b428-b04a-4562-a12b-21c7b9e8b63a/status`,
43+
the connection id is `5432b428-b04a-4562-a12b-21c7b9e8b63a`.
44+
2. Connect to the database and run the following command with the connection id and resource requirements filled in.
45+
```sql
46+
// SQL command with example
47+
update connection set resource_requirements = '{"cpu_limit": "0.5", "cpu_request": "0.5", "memory_limit": "500Mi", "memory_request": "500Mi"}' where id = '<id-from-step-1>';
48+
```
49+
50+
## Debugging Connection Resources
51+
52+
Airbyte logs the resource requirements as part of the job logs as containers are created. Both source and destination containers are logged.
53+
54+
If a job is running out-of-memory, simply navigate to the Job in the UI, and look for the log to confirm the right configuration is being detected.
55+
56+
On Docker, the log will look something like this:
57+
```
58+
Creating docker container = destination-e2e-test-write-39-0-vnqtl with resources io.airbyte.config.ResourceRequirements@1d86d7c9[cpuRequest=<null>,cpuLimit=<null>,memoryRequest=200Mi,memoryLimit=200Mi]
59+
```
60+
61+
On Kubernetes, the log will look something like this:
62+
```
63+
2022-08-12 01:22:20 INFO i.a.w.p.KubeProcessFactory(create):100 - Attempting to start pod = source-intercom-check-480195-0-abvnr for airbyte/source-intercom:0.1.24 with resources io.airbyte.config.ResourceRequirements@11cc9fb9[cpuRequest=2,cpuLimit=2,memoryRequest=200Mi,memoryLimit=200Mi]
64+
```

docusaurus/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ module.exports = {
112112
'operator-guides/upgrading-airbyte',
113113
'operator-guides/reset',
114114
'operator-guides/configuring-airbyte-db',
115+
'operator-guides/configuring-connector-resources',
115116
'operator-guides/browsing-output-logs',
116117
'operator-guides/using-the-airflow-airbyte-operator',
117118
'operator-guides/using-prefect-task',

0 commit comments

Comments
 (0)