Monitoring · Advanced · Building an internal platform with monitoring-pro from scratch: architecture and decision log

250
MOr/monitoring-pro·posted by kite·6 hours agoAnnouncement

Building an internal platform with monitoring-pro from scratch: architecture and decision log

It took me two weeks of on-and-off digging and plenty of wrong turns. Writing the process down as it happened so the next person spends less time.

The first thing was to collapse the variables. We were changing config and upgrading the version at the same time, and afterwards nobody could say which change caused what. We rolled back to moving one variable at a time, re-ran three times, and only then did the curve settle. Tedious, but not skippable.

Performance44%
Maintainability28%
Ecosystem and community17%
Hiring difficulty11%

425 votes total

115 comments

115 comments

M
Llinlin·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

518
RraseOP·2 days ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

444
Mmike_xu·28 minutes ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

414
Oops_wang·2 days ago

One counter-example: below monitoring-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

499
Rran_boOP·3 minutes ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

382
Zzhu_zong·1 hour ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

418
Aalice_dev·2 days ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

111
Rran_bo·2 days ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

416
Rrase·2 days agoedited

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

403
Kkernel_panic·2 days ago

One counter-example: below monitoring-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

403
Wwinter·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

359
Mmike_xu·2 days agoedited

I just read the monitoring-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

177
Nnikic·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

314
Wwinter·2 days ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

275
Nnikic·2 days ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

193
Kkernel_panic·2 days agoedited

One counter-example: below monitoring-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

191
Kkite·2 days ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

182
Mmike_xu·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

7
Sslow_query·2 days ago

One counter-example: below monitoring-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

186
Aalice_dev·2 days agoedited

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

177
Sswoole_lee·3 minutes ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

161
Kkernel_panic·2 days ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

15
Sslow_queryMod·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

8
Oops_wang·2 days ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

420
Lli_ming·2 days ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

251
Hhuang_keOP·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

12
Kkite·yesterday

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

1
Rran_bo·2 days agoedited

This is not a monitoring-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

160
Zzhu_zong·2 days ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

124
Mmike_xu·2 days ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

3
Aalice_dev·2 days agoedited

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

297
Hhuang_ke·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

2
Bbob_chenMod·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

56
Kkite·yesterday

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

117
Hhuang_ke·2 days ago

This is not a monitoring-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

68
Rrase·3 minutes ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

514
Zzhou_yi·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

191
Wwinter·5 hours ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

134
Hhuang_keOP·2 days ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

8
Ddev_zhou·2 days ago

I just read the monitoring-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

67
Aalice_dev·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

64
Rrase·2 days ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

58
Ddev_zhou·2 days agoedited

I just read the monitoring-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

58
Kkite·2 days ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

41
Rran_bo·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

296
Nnikic·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

3
Mmike_xu·2 days ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

60
Bbob_chen·2 days ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

509
Rran_bo·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

14
Rran_bo·2 days ago

One counter-example: below monitoring-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

40
Kkite·2 days ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

77
Zzhu_zong·2 hours ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

24
Lli_ming·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

21
Cchen_dev·2 hours ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

232
Sswoole_lee·2 days ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

2
Aalice_dev·5 hours agoedited

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

217
Lli_ming·5 hours ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

19
Mmike_xu·2 days ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

16
Kkite·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

12
Mmike_xu·2 days ago

This is not a monitoring-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

13
Sslow_query·2 days ago

This is not a monitoring-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

11
Lli_ming·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

11
Ttang_hao·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

10
Mmike_xu·2 days ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

8
Bbob_chen·1 hour ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

5
Wwinter·2 days agoedited

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

5
Rran_bo·2 days ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

5
Sswoole_lee·just now

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

4
Sswoole_lee·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

42
Sslow_query·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

6
Cchen_dev·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

3
Wwinter·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

149
Llinlin·2 days agoedited

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

192
Lli_ming·12 minutes ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

30
Cchen_dev·3 minutes ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

388
Oops_wang·2 days agoedited

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

517
Rrase·2 days ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

43
Kkite·1 hour ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

134
Nnikic·2 days ago

I just read the monitoring-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

317
Hhuang_ke·3 minutes ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

58
Mmike_xu·5 hours ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

491
Ddev_zhou·2 days ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

355
Kkite·2 days agoedited

I just read the monitoring-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

80
Zzhou_yi·3 minutes ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

1
KkiteOP·2 hours ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

420
Mmike_xuOP·2 days ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

1
Rrase·3 minutes ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

1
Zzhu_zong·2 days agoLevel 6

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

79
Sslow_queryOP·just now

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

146
Zzhu_zong·2 hours ago

I just read the monitoring-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

269
Llinlin·3 minutes agoedited

One counter-example: below monitoring-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

178
Oops_wangOP·2 days agoLevel 6

One counter-example: below monitoring-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

275
Oops_wang·2 days ago

This is not a monitoring-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

34
Sswoole_lee·2 days agoLevel 6

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

4
Mmike_xu·yesterday

I just read the monitoring-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

1
Hhuang_ke·2 days ago

This is not a monitoring-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

13
NnikicOP·2 days agoedited

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

445
Zzhu_zongOP·3 minutes ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

2
Lli_ming·2 days agoLevel 6

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

36
Kkite·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

35
Rran_bo·2 hours agoedited

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

22
Zzhu_zong·2 hours ago

This is not a monitoring-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

6
Lli_ming·2 days ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

2
Lli_ming·yesterday

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

183
Cchen_dev·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

30
Nnikic·2 days ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

309
Hhuang_ke·yesterdayLevel 6

Saved. I am reworking this area this week — this saves a lot of wrong turns.

2
Lli_ming·2 days ago

This is not a monitoring-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

169
Bbob_chen·2 days ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

5
Wwinter·28 minutes ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

2
Zzhou_yi·1 hour ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

1
Ddev_zhou·1 hour ago

One counter-example: below monitoring-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

1
Ttang_hao·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

1
Oops_wang·2 days ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

1
Wwinter·2 days ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

1

This is the post detail page /en/c/monitoring-pro/post/p5. Posts and comments are generated deterministically from a seeded PRNG, so the same post always renders the same content and the link can be shared, reloaded and indexed. In production this page reads MySQL for the post, Redis for hot-post caching, and fetches the whole comment tree in a single query on the path column.

See the database schema →