Editor: Zhang Handong

RustChinaConf 2021 is open for application

Application Details

The latest patches to add Rust support to the Linux kernel have appeared

Miguel Ojeda has been leading work on “Rust for Linux” – a project now funded by Google to make the programming language available in the kernel. Although the 5.14 kernel merge window is currently underway, it is not marked as a pull request phase and is not expected to land until the next cycle or later. This follows a “call for comments” patch issued in April.

Enablement of Rust for Linux now totals over 33,000 lines of code, in part because they currently include a subset of Rust’s “alloc” standard library in the tree, modified for kernel purposes. Eventually, the developers will try to put the changes into the upstream Alloc Crate, but for now in the kernel tree, where the other required libraries are also done.

Another change with these new patches is that while previous releases required nightly versions of the Rust compiler, the kernel can now compile with beta and stable versions of Rustc. However, kernel support does require some of the functionality of the Rust compiler and is currently viewed upstream as a source of instability.

In addition to AArch64, PowerPC, and X86_64, THE ARM 32-bit and RISC-V architectures are now supported by Rust for Linux.

In addition to Rust pipes in the Linux kernel, the initial user of Rust support was the Android Binder IPC implementation in Rust, which is still considered a work in progress.

These latest Rust for Linux kernel patches can be found in the kernel mailing list:

Lore.kernel.org/lkml/202107…

This news comes from: www.cnbeta.com/articles/te…

Facebook from Java to Rust | Buck’s future

Buck is a fast Android build that Facebook unveiled at Facebook Mobile DevCon in 2013. Since then, it has expanded to support apps written in more than 15 languages, targeting platforms including phones, servers, smart devices and VR headsets.

Over time, however, Buck did not keep pace with this growth in functionality and flexibility, and did not make the necessary architectural changes and improvements to manage this complexity. As New features were developed internally and externally at Facebook, it was found that this led to significant implementation complexity and increased challenges to change core and language rules. While the team began an initiative nearly four years ago to gradually make some of these cross-domain architectural improvements to Buck, the changes were very difficult.

So, starting in 2020, the team started thinking, what would it be like to build Buck from scratch? How do you write a build system that will scale over the next 10 or 20 years?

While considering this rewrite, we took the opportunity to experiment and validate Rust as a technology stack for building systems. Facebook has invested heavily in the Rust programming language, with many projects using it with great success. We found this language very appropriate for a number of reasons:

  1. The Rustasync/awaitThe syntax makes writing asynchronous code very smooth, and Rust helps get the complicated details of concurrency right. Each migration of Buck’s Java computing to concurrent computing was a months-long struggle, and there was still a significant single-threaded bottleneck.
  2. Rust has a number of high-level language features that make development easier and more enjoyable. These are features like enumerations, pattern matching, traits, procedure macros, and all the other features that Rust developers like so much.
  3. Rust provides greater control over memory allocation. GC languages (even generational collection) have challenges when dealing with incremental calculations like Buck.
  4. Rust is high-performance. We have seen significant acceleration in rewriting some programs with Rust.

You may see less progress on Buck in the coming months, but rest assured that we will continue to work hard to provide the best build system for the community. We recognize that an important part of the sharing process is defining a smooth transition for Buck’s users and ensuring that the community can move forward with us. We plan to make this public by January 2022, when we will have more details on the current Buck user transition.

Developers.facebook.com/blog/post/2…

Recent rust-related issues excerpts from Zhihu

  • In 2021, is Rust a good alternative to C++ in some lower-level areas?
  • How difficult is modern C++ compared to Rust?
  • How do you see the application prospects of Rust?
  • How will Rust be better than C++ in 2021?
  • What are the advantages of Rust?
  • Is it true that rust, as a security-oriented HPC programming language, is better than c++ when it comes to HFT systems?

What is Rust + Copilot?

Recently, the Discord engineers tried using Copilot to aid in the development of the Rust project. It didn’t work out very well.

Video watch: T.Me /rust_daily_…

Rust GameDev #23

This issue of the Game Development Report contains some very creative games. Write Rust tired, can play, all open source.

  1. Eat snakes. Wasm support, can web play. Level design is thoughtful. Based on BEVY 0.5.
  • Github.com/szunami/tai…
  • szunami.itch.io/taileater
  1. Egregoria, the Sim City builder, tries to replicate the modern world as well as possible. Implementation based on Legion ECS.

Github.com/Uriopass/Eg…

  1. Blightmud Blightmud is a command line terminal MUD client that supports many MUD servers, such as Bat.org.

Github.com/Blightmud/B…

  1. Dango, multiplayer physics sandbox game. Based on BEVY, Nphysics physics engine, CrystalObs network library, etc. Dango currently runs server on WASM in the browser, and other players join through WebrTC.

Github.com/ErnWong/dan…

  1. Hyper-farmer: Based on Bevy, the game is simple but creative, and works on hand coordination
  • Wilsk. W.. IO/the hyper – farme… Play online
  • Github.com/will-hart/c…
  1. Fish – Game, based on macroquad game engine implementation, support WASM
  • Fedorgames. W.. IO/fish – playing online game
  • Github.com/heroiclabs/… The source code
  • Github.com/not-fl3/mac… The game engine

gamedev.rs/news/023/

CNCF has two more Rust projects

Good to see both wasmCloud and Krustlet submitted to the CNCF Sandbox at the same time:

  • WasmCloud: github.com/cncf/toc/is…
  • Krustlet: github.com/cncf/toc/is…

Zenoh performance enhancement story | Wander through Rust Asynchronous Wonderland

In Rust Maginze monthly interim introduced Zenoh 4: open source products | eclipse Zenoh power fog and edge calculation

Eclipse ZenOH (read: /zeno/) provides zero-overhead Pub/Sub, Store/Query, and computation.

Zenoh unifies dynamic/static/in-use data and provides computational results. It blends traditional Pub/Sub with geographically distributed storage, query, and computation in a measured way, while retaining a level of time and space efficiency that far exceeds any mainstream protocol stack.

The official website is zenoh.io.

GitHub repository eclipse-ZenOH/ZenOH.

The Eclipse Edge Native Working Group was launched in December 2020 and Zenoh was introduced to Eclipse. Rewrite Zenoh with Rust.

In this article, the Zenoh team dissects how they improved asynchronous performance to double.

  • The 8-byte payload exceeds 3.5m MSG /s
  • The payload of 1Mb is greater than 45Gb/s
  • In a Backlogged scenario, the latency is as low as 35 microseconds

How did the team do it?

One: preparation

  1. Prepare the test environment for reproducible results. Because many external factors can affect code performance, this is to eliminate them. Here’s a great guide: easyperf.net/blog/2019/0…
  2. Read the Rust Performance Manual thoroughly. We found it insightful for Rust’s performance tips and tricks as well as profiling techniques. A blog on how to write high-performance code in Rust is also a good reference.

(Sys) Look for hot performance

  1. We started with flamegraph to generate the flamegraph, looking for asynchronous performance hot spots in zenoh. However, asynchro makes the flame diagram quite difficult to read, because asynchronous schedulers and Future actuators appear almost everywhere in the flame diagram. So the performance profiling tool was changed to perF, which provides a clearer hotspot map, especially for serialization and deserialization.
  2. Improved serialization/deserialization related implementation, with a direct performance increase of 100%. But this improvement was not reflected in the throughput tests.

Three: heap allocation or stack allocation?

The Zenoh team has been avoiding heap allocation at critical points. A close examination with ValGrind revealed no unnecessary heap allocation and a low cache miss ratio. So the team started checking for stack allocation problems, using a flag of the Rust compiler (available only at Rust Nightly) to verify how big a data structure is and its memory alignment.

Rust $RUSTFLAGS= -zprint-type-sizes cargo build –release to compile Zenoh this way. Output:

print-type-size type: `net::protocol::proto::msg::Data`: 304 bytes, alignment: 8 bytes
print-type-size     field `.key`: 40 bytes
print-type-size     field `.data_info`: 168 bytes
print-type-size     field `.payload`: 96 bytes
Copy the code

Asynchronous data structures are also printed this way. Then the team discovered a painful truth:

  1. Asynchronous futures, once compiled, take up tens of kilobytes in the stack. These futures are called every time a message needs to be sent over the network.
  2. Zenoh’s extensive use of asynchrony now results in stacks that are too deep and too large, putting a lot of stress on memory.
  3. On reflection, the team isolated asynchronous code in certain parts, especially network interactions, and switched to synchronization for the rest of the code. Thus balancing synchronous and asynchronous, drawing on the best of both worlds. Significantly reduced stack memory stress, with huge performance improvements.

Four: performance test results

The team’s performance test environment was: AMD Ryzen 5800X, 32GB of ram, over 100Gb Ethernet connection, configured according to the performance Test Environment configuration guide described earlier.

For specific performance test charts, see the article further. You can also follow the Zenoh team’s blog as they continue to refine their performance.

Zenoh. IO/blog / 2021-0…

Fan Chuchu, a post-90s tsinghua alumnus and an assistant professor of MIT, won ACM Doctoral Thesis Award and Ralf Jung honorary nomination in Rust Community

Ralf Jung’s doctoral dissertation is “Understanding and Evolving the Rust Programming Language” (people.mpi-sws.org/~jung/phd/t…

RalfJung’s work formalized the Safe Rust security model and also modeled the Unsafe Rust UB check. Well deserved.

Mp.weixin.qq.com/s/wkjexOyXX…

Tokio support IO – uring

Tokio provides support for the IO – Uring system API on Linux. Asynchronous file operations are provided in this release, and support for more operations will be added in subsequent releases.

The Tokio-Uring API will likely form the basis for tokio 2.0, which will likely be released in 2024 and then integrated with the library.

Tokio. Rs/blog / 2021-0…

Comparison of Rust vs Elixir code amount under the same function: Ockam

Ockam is a suite of tools for mutual authentication and end-to-end encryption of messages between distributed applications. Both Rust and Elixir implementations are currently available.

From the ratio of Rust to Elixir:

  • Rust 69.3%
  • Elixir of 30.7%

Since it is the same feature implementation (Rust has two more feature implementations than Elixir), is it possible to infer from the amount of code that Elixir is twice as efficient as Rust?

I don’t think so. You also need to look at the scene. This project is designed for distributed messaging, which may be more productive because of Elixir’s default support. Rust may need to do a little more groundwork.

For example, many people say that Rust compiles HelloWorld larger than C, but some of c’s base libraries are supported by default and do not need to be carried by rust.

Github.com/ockam-netwo…

CNCF announces Linkerd’s graduation

Linkerd was the first project to join the CNCF sandbox, then known as Inception, and is now the first service Grid project to receive graduate status.

“Oliver Gould, Founder of Linkerd and Buoyant chief technology officer. “Our mission is to bring simplicity and user empathy to the service grid space, and we have had to work tirelessly to dispel the common perception that the service grid is complex and cumbersome. While we made controversial technology decisions — going Rust instead of C++, building ‘micro agents’ specific to the service grid instead of using generic agents, focusing on Kubernetes instead of building abstraction layers — these decisions have been validated, and our global community of operators is once again betting on this vision.”

  • Linkerd. IO / 2021/07/28 /…
  • Chinese mp.weixin.qq.com/s/P5dQjVe0j…
  • linkerd.io/

Rust Search Extension 1.3.0- RC release available!

Friends who want to experience in advance welcome to download and help test this page, if there is no bug will be officially released over the weekend!

  • Github.com/huhu/rust-s…
  • rust.extension.sh/changelog/

Arti: A pure Rust implementation of Tor

Today, I’m pleased to announce the new era of Tor.

For the past year or so, we’ve been working on “Arti,” a project to rewrite Tor with Rust. Thanks to funding from Zcash Open Major Grants (ZOMG), we were finally able to add Arti to our list of priorities and devote more time to it.

Below I’ll talk about why we’re doing this project, what it means for Tor users and operators, where it could go in the future, and how people can help.

  • Blog.torproject.org/announcing-…
  • Gitlab.torproject.org/tpo/core/ar…

Scott Mabin joined Lexin Full time

Scott Mabin has joined Espressif full-time to provide Rust support for all of their chips and improve the Rust ecosystem for their chips.

Founded in 2008, Lexin Technology (stock code: 688018) is a global fabless semiconductor company with offices in China, the Czech Republic, India, Singapore and Brazil and teams from more than 20 countries and regions.

organization

The ESP-enabled forked compiler has been moved to the ESP-RS organization, along with some IDF support sections – more on that soon. Discussions in the ESP-RS/Rust repository have already begun, and over the past month, Espressif has hosted weekly community meetings focused on advancing rust support.

The Rust standard library on Espressif chips

@ivMarkov has been working on porting Rust STD libraries to ESP-IDF, a C-based development environment for Espressif chips. Esp-idf has a Newlib environment that can be used to build Rust libraries. @ivMarkov put together a rust-ESP32-STD-Hello demo to demonstrate its capabilities, including WiFi, threading, and a driver using ESP-IDF to drive the display. Very cool stuff! There are some teething issues that you can track here, but hopefully we’ll be able to start making these patches available upstream soon.

To complement the Espressif chip standard library, ESP-IDF-HAL has been updated and moved into the ESP-RS organization. Crate has apis for using peripherals and hardware that are not abstractions from the standard library, such as SPI peripherals. Along with HAL, ESP-IDF-SVC was added, which is an implementation of the embedded SVC feature of the Espressif chip. The goal behind Embedded-SVC is to provide abstraction around higher-level embedded services, WiFi, Ping, HTTPD, NVS, and more.

Mabez. / dev/blog posts /…

Lemmy release v0.11.3

Lemmy is similar to Reddit, Hacker News, etc. You subscribe to forums that interest you, post links and discussions, then vote and comment on them. Behind the scenes it’s very different; Anyone can easily run a server, all of which are federated (like email) and connected to the same universe, called Fediverse. For a link aggregator, this means that users registered on one server can subscribe to forums on any other server and have discussions with users registered elsewhere.

The overall goal is to create an easily self-hosted, decentralized alternative to Reddit and other link aggregators, free of corporate control and interference.

  • Github.com/LemmyNet/le…
  • lemmy.ml/post/75818