Mozilla的Rust如何极大地提高了我们的服务器端性能

Like building state-of-the-art web apps? Come work at Figma!

喜欢构建最先进的网络应用程序?来Figma工作吧!

At Figma, performance is one of our most important features. We strive to enable teams to work at the speed of thought, and our multiplayer syncing engine is a critical part of this vision. Everyone should see each change made to a Figma document in real time.

Figma,性能是我们最重要的功能之一。我们努力使团队能够以思维的速度工作,而我们的多人同步引擎是这一愿景的关键部分。每个人都应该实时地看到对 Figma 文档所做的每一个改动。

The multiplayer server we launched with two years ago is written in TypeScript and has served us surprisingly well, but Figma is rapidly growing more popular and that server isn’t going to be able to keep up. We decided to fix this by rewriting it in Rust.

我们两年前推出的多人游戏服务器是用TypeScript编写的,而且出乎意料地好用,但Figma正迅速变得越来越流行,该服务器将无法跟上。我们决定用Rust重写它来解决这个问题。

Rust is a new programming language from Mozilla, the company that makes Firefox. They’re using it to build a next-generation browser prototype called Servo which demonstrates that browsers can be way faster than they are today. Rust is similar to C++ in performance and low-level ability but has a type system which automatically prevents whole classes of nasty bugs that are common in C++ programs.

Rust是Mozilla的一种新的编程语言,Mozilla是一家生产Firefox的公司。他们正在用它来构建一个名为Servo的下一代浏览器原型,这表明浏览器可以比现在快很多。Rust在性能和底层能力方面与C++相似,但它有一个类型系统,可以自动防止C++程序中常见的整类讨厌的错误

We chose Rust for this rewrite because it combines best-in-class speed with low resource usage while still offering the safety of standard server languages. Low resource usage was particularly important to us because some of the performance issues with the old server were caused by the garbage collector.

我们选择Rust进行重写,因为它结合了一流的速度和低资源使用率,同时还提供了标准服务器语言的安全性。低资源使用率对我们特别重要,因为旧服务器的一些性能问题是由垃圾收集器造成的。

We think this is an interesting case study of using Rust in production and want to share the issues we encountered and the benefits we achieved in the hope that it will be useful to others considering a similar rewrite.

我们认为这是一个在生产中使用Rust的有趣案例,并希望分享我们遇到的问题和取得的收益,希望它对其他考虑类似重写的人有所帮助。

Scaling our service with Rust

用Rust扩展我们的服务

Our...

开通本站会员,查看完整译文。

Home - Wiki
Copyright © 2011-2024 iteam. Current version is 2.139.0. UTC+08:00, 2024-12-23 10:45
浙ICP备14020137号-1 $Map of visitor$