Skip to content
检测中

Concurrency and Performance

日期:2026-06-17 · 场景:Concurrency and Performance

📖 Vocabulary

WordMeaningExample
asynchronous 异步的;调用后不立即返回结果,靠回调或事件通知完成We refactored the payment step to be asynchronous so the API can respond without waiting for the bank.
我们把支付步骤改成了异步,这样 API 不必等银行确认就能返回。
callback 回调;任务完成时被调用的函数Register a callback that fires when the payment gateway replies, then update the order status.
注册一个回调,在支付网关应答时触发,再更新订单状态。
concurrency 并发;多个任务在同一时段交错或同时执行的能力Raising concurrency on the worker pool lets us handle more requests at once.
提高 worker 池的并发度,能让我们同时处理更多请求。
throughput 吞吐量;单位时间内系统处理的请求数或数据量Better throughput means fewer timeouts during peak hours.
更高的吞吐量意味着高峰时段超时更少。
latency 延迟;从发起请求到收到响应之间的时间Our average latency doubled after the holiday sale, so we are investigating the checkout flow.
大促之后我们的平均延迟翻倍,所以正在排查结账流程。

🎧 Audio

💬 Dialogue

A: We have a serious latency problem in the checkout flow. A:我们的结账流程有严重的延迟问题。

B: Right. The numbers show our average latency doubled after the holiday sale. B:对。数据显示,大促之后我们的平均延迟翻倍了。

A: I think the root cause is the synchronous payment calls. We should make them asynchronous. A:我觉得根因是同步的支付调用,我们应该改成异步。

B: Agreed. An asynchronous design would let us return a response before the bank confirms. B:同意。异步设计能让我们在银行确认之前就返回响应。

A: We can register a callback that fires when the payment gateway replies. A:我们可以注册一个回调,在支付网关应答时触发。

B: Good. The callback can then update the order status in the background. B:好。回调再在后台更新订单状态。

A: We also need to raise concurrency on the worker pool. Right now it is capped at ten. A:我们还得提高 worker 池的并发度,现在被限制在十个。

B: Higher concurrency should lift our throughput and clear the queue faster. B:更高的并发度应该能提升吞吐量,更快清空队列。

A: Exactly. Better throughput means fewer timeouts during peak hours. A:没错。更好的吞吐量意味着高峰时段超时更少。

B: Let me draft the design doc and we can review it tomorrow. B:我来起草设计文档,我们明天评审。

Released under the ISC License.