利用请求跟踪改善Duolingo体验
Duolingo works to improve the performance of our apps for all of our learners. As Duolingo has grown over time with new courses, features, and millions of additional users, several teams are working behind the scenes to keep things running smoothly. This post will focus on a backend feature called Request Tracing that has led to significant improvements in performance.
Duolingo努力为所有学习者提高我们的应用程序的性能。随着Duolingo的发展,新的课程、功能和数以百万计的额外用户,几个团队在幕后工作,以保持事情顺利进行。这篇文章将重点介绍一项名为 "请求追踪 "的后端功能,该功能使性能得到了显著改善。
Duolingo is steadily moving from a monolithic architecture (a few large, tightly-coupled services) to a microservice architecture (many small, loosely-coupled services). This has its advantages, but also has tradeoffs, including operational complexity and observability.
Duolingo正在稳步地从单体架构(几个大型的、紧密耦合的服务)转向微服务架构(许多小型的、松散耦合的服务)。这有它的优点,但也有权衡,包括操作的复杂性和可观察性。
For example, with an isolated service, it's straightforward to log its requests and do some simple profiling to find out what calls are doing. But how do you get that observability when many services interact together, as is the case with microservice architecture? To that end, we've recently added request tracing at Duolingo, which has given us observability and insights into our services.
例如,对于一个孤立的服务,记录其请求并做一些简单的剖析以找出调用的情况是很直接的。但是,当许多服务一起互动时,你如何获得这种可观察性,就像微服务架构的情况一样?为此,我们最近在Duolingo增加了请求跟踪,这让我们对服务有了可观察性和洞察力。
The results and highlights of this initiative have been promising:
这一举措的结果和亮点是很有希望的。
- 10% reduction in Duolingo's latency, in the first weeks of testing!
- 在测试的头几周,Duolingo的延迟减少了10%!
- Substantial error, latency, cost, and infrastructure reductions across the stack
- 大量减少整个堆栈的错误、延迟、成本和基础设施
- Cool pictures (see below!)
- 酷炫的图片(见下文)。
Sampled Request Tracing with Jaeger
用Jaeger进行采样请求追踪
Jaeger is a wonderful open-source request tracing tool that we began using in 2019. There are a plethora of request tracers, but we chose Jaeger as having the best compatibility and support for our stack (mostly Python and JVM services).
Jaeger是一个很棒的开源请求追踪工具,我们在2019年开始使用。有大量的请求追踪器,但我们选择了Jaeger,因为它对我们的堆栈(主要是P...