Skip to content

Commit 44586d1

Browse files
committed
update docs
1 parent 323c312 commit 44586d1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

docs/templates/agent-metadata.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,23 @@ usr sys idl wai stl| read writ| recv send| in out | int csw
123123

124124
Agent metadata can generate a significant write load and overwhelm your database
125125
if you're not careful. The approximate writes per second can be calculated using
126-
the formula:
126+
the following formula (applied once for each unique metadata interval):
127127

128128
```text
129-
(metadata_count * num_running_agents * 2) / metadata_avg_interval
129+
num_running_agents * write_multiplier / metadata_interval
130130
```
131131

132-
For example, let's say you have
132+
For example, let's say you have:
133133

134134
- 10 running agents
135-
- each with 6 metadata snippets
136-
- with an average interval of 4 seconds
135+
- each with 4 metadata snippets
136+
- where two have an interval of 4 seconds, and the other two 6 seconds
137137

138-
You can expect `(10 * 6 * 2) / 4` or 30 writes per second.
138+
You can expect at most `(10 * 2 / 4) + (10 * 2 / 6)` or ~8 writes per second.
139+
The actual writes per second may be a bit lower due to batching of metadata.
140+
Adding more metadata with the same interval will not increase writes per second,
141+
but it may still increase database load slightly.
139142

140-
One of the writes is to the `UNLOGGED` `workspace_agent_metadata` table and the
141-
other to the `NOTIFY` query that enables live stats streaming in the UI.
143+
We use a `write_multiplier` of `2` because each metadata write generates two
144+
writes. One of the writes is to the `UNLOGGED` `workspace_agent_metadata` table
145+
and the other to the `NOTIFY` query that enables live stats streaming in the UI.

0 commit comments

Comments
 (0)