共 13 句 · 中英对照 · 对应本级 10 个目标词
开始练这一级 →Last week our team had a long night with the order service.上周,我们团队因为订单服务熬了一个长夜。 At nine the phone woke us, and the log was full of red lines.九点时电话把我们叫醒,日志里全是红色的报错行。 Every page was slow, and some did not load at all.每个页面都很慢,有些页面根本加载不出来。
We looked at the queue first.我们先查看队列。 The service could not dequeue fast enough, so new jobs had to enqueue behind old ones.服务无法足够快地「出队」,所以新任务只能「入队」排在旧任务后面。 Backpressure made each slow call slower, so we added throttling and a retry limit.「背压」让每个慢调用变得更慢,于是我们加了「限流」和一个「重试」上限。
Then we found the real cause.然后我们找到了真正的原因。 Two workers held the same row and each waited for the other: a deadlock.两个工作线程持有同一行数据,各自等待对方,这就是「死锁」。 The cache also missed one invalidation step, so old data stayed in memory.缓存也漏掉了一步「失效」处理,所以旧数据一直留在内存里。 Our data sat on one machine, and sharding was the plan we had not done.我们的数据全放在一台机器上,而「分片」是我们一直没做的计划。
We put in a circuit breaker so a bad call stops at once.我们加了一个「熔断器」,这样坏调用会立刻停下。 The team changed the contract between the two services.团队修改了两个服务之间的「契约」。 In the morning the queue was short, the pages were fast, and sharding was on the board.到了早上,队列很短,页面很快,「分片」方案也写在了白板上。
数据来源:NGSL(CC BY-SA 4.0)· ECDICT(MIT License)。短文为本项目为练习编写的配套材料。