@@ -123,19 +123,23 @@ usr sys idl wai stl| read writ| recv send| in out | int csw
123
123
124
124
Agent metadata can generate a significant write load and overwhelm your database
125
125
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) :
127
127
128
128
``` text
129
- (metadata_count * num_running_agents * 2) / metadata_avg_interval
129
+ num_running_agents * write_multiplier / metadata_interval
130
130
```
131
131
132
- For example, let's say you have
132
+ For example, let's say you have:
133
133
134
134
- 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
137
137
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.
139
142
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