计算机英语词库 第 1 级 · 阅读短文

共 12 句 · 中英对照 · 对应本级 10 个目标词

开始练这一级 →

Last week our team got a report that one endpoint was slow.上周,我们团队收到一份报告,说有一个接口很慢。 We measured the elapsed time of every request and wrote down each number.我们测量了每个请求的「耗时(elapsed time)」,并记下了每一个数字。 The average run time was much higher than our baseline from the month before.平均「运行时间(run time)」比我们上个月的「基线(baseline)」高出很多。

The time complexity of the code had not changed, so the algorithm was not the reason.代码的「时间复杂度(time complexity)」并没有变化,所以原因不是算法。 We found a retry loop with no wait between tries.我们发现了一个重试循环,两次尝试之间没有任何等待。 Two requests changed the same value at once, and that race condition made the work repeat.两个请求同时修改同一个值,这个「竞态条件(race condition)」让工作重复执行。

The fix was to make the operation idempotent, so a second try did not write again.修复方法是让这个操作变成「幂等(idempotent)」,这样第二次尝试就不会再次写入。 We also added a small lock around the shared value.我们还在共享的值周围加了一个小锁。

After the change, the execution time of that endpoint fell by half.修改之后,那个接口的「执行时间(execution time)」下降了一半。 Throughput went up and latency went down on the same server.在同一台服务器上,「吞吐量(throughput)」上升了,「延迟(latency)」下降了。 We compared the new runtime against the old baseline and shared the result with the team.我们把新的「运行时(runtime)」和旧的「基线(baseline)」做了对比,并把结果分享给团队。 The lesson was simple: measure first, then change one thing at a time.教训很简单:先测量,然后一次只改一处。

数据来源:NGSL(CC BY-SA 4.0)· ECDICT(MIT License)。短文为本项目为练习编写的配套材料。

返回小步过关 · 英语单词闯关练习