App Design · News · War story: app-design-news timezone handling almost cost us a full day of billing

1.3K
ADr/app-design-news·posted by kite·6 hours agoInternals

War story: app-design-news timezone handling almost cost us a full day of billing

Most app-design-news articles stop at "how to use it" and never cover "when not to use it". This is an attempt at the second half.

One last trap: in container environments remember to adjust the memory-related parameters in step. Otherwise the host limit and the process expectation disagree, and the symptom is intermittent, unreproducible failure.

Keep it and wait for an official fix44%
Switch to a third-party option now28%
Fork and maintain it ourselves17%
Write an adapter layer and wait11%

2208 votes total

574 comments

574 comments

· first 120 loaded
M
Wwinter·3 minutes 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.

489
Rran_boOP·2 days ago

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

30
Kkernel_panic·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.

483
Sswoole_lee·just now

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

452
Llinlin·5 hours ago

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

388
Zzhou_yi·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.

383
Zzhou_yi·2 days ago

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

363
RraseOP·yesterday

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.

406
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.

362
Aalice_dev·2 days ago

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

361
Bbob_chen·28 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.

285
Oops_wangOP·2 days ago

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

349
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.

72
Cchen_dev·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.

15
Kkite·yesterday

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.

331
LlinlinMod·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.

136
Bbob_chen·2 days ago

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

311
Zzhu_zongMod·2 days ago

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

23
Rrase·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.

320
Cchen_dev·2 days ago

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

304
Wwinter·2 days ago

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

236
Bbob_chen·1 hour ago

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

228
Hhuang_ke·3 minutes ago

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

220
Zzhu_zong·3 minutes ago

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

38
Lli_ming·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.

323
Rrase·2 days ago

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

464
Kkernel_panic·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.

1
Sslow_query·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.

246
KkiteOP·2 days ago

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

102
Llinlin·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.

303
Bbob_chen·5 hours 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.

156
Aalice_dev·just now

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.

174
Kkite·just now

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

123
Cchen_dev·2 days 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.

1
Ttang_haoOP·2 days ago

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

95
Sswoole_lee·2 days ago

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

167
Rrase·2 days agoedited

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

141
RraseOP·2 days ago

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

80
Ddev_zhou·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.

202
Ttang_hao·just now

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

140
Hhuang_ke·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.

7
WwinterOP·28 minutes 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.

44
Zzhou_yi·1 hour agoedited

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

96
Rran_bo·yesterdayedited

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

374
Rrase·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.

322
Nnikic·2 days ago

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

35
Rran_boOP·28 minutes 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.

158
Sswoole_leeOP·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.

296
Oops_wang·2 days ago

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

70
Sswoole_lee·2 days ago

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

1
Oops_wang·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.

1
Mmike_xu·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.

96
Lli_ming·3 minutes agoedited

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

50
Sslow_query·1 hour ago

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

410
Nnikic·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.

309
Llinlin·2 days ago

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

116
Lli_ming·2 days agoedited

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

436
Nnikic·2 days agoedited

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

40
NnikicOP·28 minutes ago

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

194
Kkernel_panicOP·2 days agoedited

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

13
Sslow_query·28 minutes 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.

204
Kkernel_panic·2 days ago

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

65
Kkernel_panic·just now

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

62
Mmike_xu·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.

3
Ttang_hao·2 days ago

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

479
Sswoole_lee·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.

13
Lli_mingOP·just nowedited

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.

1
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.

57
Cchen_dev·2 days ago

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

41
Aalice_dev·2 days ago

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

26
Hhuang_ke·28 minutes ago

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

25
Bbob_chen·2 hours 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.

104
Ttang_hao·2 days ago

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

270
Zzhou_yi·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.

106
Kkernel_panic·2 days ago

One counter-example: below app-design-news 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
Sswoole_lee·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.

89
Aalice_dev·2 days ago

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

180
Kkite·2 days ago

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

95
Oops_wang·2 days agoLevel 6

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.

474
Sswoole_lee·yesterdayLevel 6

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

105
Bbob_chen·5 hours ago

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

15
Zzhou_yi·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.

82
Llinlin·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.

190
Oops_wang·1 hour 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.

79
Cchen_dev·2 days ago

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

400
Rran_bo·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.

346
Kkite·2 days agoLevel 6

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

138
Zzhou_yi·5 hours agoedited

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.

130
Oops_wang·2 days agoedited

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

72
Aalice_dev·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.

454
Zzhou_yi·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.

17
Kkite·12 minutes agoedited

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

3
Lli_ming·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.

54
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.

2
Oops_wang·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.

2
Ddev_zhou·2 hours ago

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

30
Zzhou_yi·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.

482
Rrase·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.

386
Kkernel_panic·2 days agoLevel 6

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.

505
Ddev_zhou·2 hours agoLevel 6

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.

436
Kkite·2 days agoLevel 6

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

136
Bbob_chen·2 days ago

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

10
Hhuang_ke·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_devOP·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.

34
Ttang_haoOP·2 days agoedited

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

137
Oops_wang·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.

18
Sswoole_lee·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.

144
Zzhu_zong·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.

180
Zzhu_zong·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.

141
Sslow_query·2 days ago

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

23
Bbob_chen·2 days ago

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

20
Bbob_chen·2 days ago

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

339
Mmike_xuOP·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.

80
Lli_ming·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.

64
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.

19
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.

19
Kkite·2 days agoedited

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

17
Oops_wang·2 days ago

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

14
Oops_wang·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
Zzhu_zong·12 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

This is the post detail page /en/c/app-design-news/post/p7. 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 →