Editor: Zhang Handong


Pyre – HTTP: Python HTTP Server implemented with Rust

It has not yet reached production availability level.

Pyre-http is implemented almost entirely in Rust, and PyO3 is also used for compatibility with Python’s ASGI/Asyncio ecosystem.

Specifically, essentially rewriting the entire Asyncio server and protocol API with pure Rust reduces Python calls to an average of only 1-2 calls per request.

Some of the author’s observations:

Rust and Python work well together, but there are places where it’s expensive.

Writing asynchronous code in Rust for asynchronous Python requires a completely different perspective on what you’re writing in Python, and you’re better off writing in the event-driven state machine style rather than the normal callback-based Future in Python.

Writing asynchronous Python does not mean writing advanced asynchronous Rust, and to be fair, Python does too in most cases; In general, you would expect to see most of the server code completely synchronized.

Github.com/Project-Dre…

Fang: Background task processing library

The author’s mental process of handling background tasks:

  1. The original method (naivety)

Perform each synchronization in the Tokio task in the same thread. When there is a lot of concurrency, there is a problem: some synchronization tasks are not executed at all. Developers don’t have any control over Tokio tasks, so there’s no way to check the total number of tasks, what tasks are currently being performed, etc.

Interestingly, the author wrote an article about this in 2020: In Rust, you don’t need a background task framework

However, the author now has the idea of implementing a simple background task processing library.

  1. Fang’s plan (simple, but not naive)

    A. Tasks are stored in the Postgres database. B. Fang starts a specified number of workers, and each Worker is an independent thread for performing tasks. C. If there are no remaining tasks in the database, the Worker will sleep for a specified number of seconds. D. If any worker fails during the task execution, it will be restarted.

The Fang solution was indeed crude and very tightly bound to the Postgres database. Fang relies on Locks(FOR UPDATE SKIP LOCKED) of the Postgres database because each Worker must process tasks only once.

Personal opinion:

This approach is more traditional, such as Ruby’s Delayed_job, or Sidekiq (which relies on Redis).

In fact, there are quite a few background task libraries in the Rust community, but many are not maintained. This may be due to the unstable nature of the Rust asynchronous ecosystem.

One currently maintained (but not active) language-neutral background task library, ocypod, is redis based and deserves attention. But it relies on Tokio 0.2.

Jonhoo implemented a Faktory-RS, a Rust client and worker implementation of the high-performance task system Faktory. Faktory is a new product (implemented in GO language) by Sidekiq (after the realization of wealth freedom), which supports heterogeneous systems and can be used as producers and consumers in any language. Despite mixed reviews, the author already had a very successful implementation of Sidekiq.

Faktory features:

  • The Faktory Server (Not worker) supports features such as retry
  • No specific reliance on Redis, built-in RocksDB for message storage
  • Provides a WebUI similar to the Sidekiq
  • Heterogeneous systems are supported and some useful features accumulated from Sidekiq are retained
  • The Faktory interface format is simple, with queue, JobType, and ARgs at its core
  • At present, domestic cloud service providers do not provide Faktory related services, which need to be maintained by themselves
  • Version 1.5.1 has been released

Fang related links:

  • Github.com/ayrat555/fa…
  • introduction

Enarx: Application deployment system in a trusted execution environment

It is said that red Hat and some well-known enterprises together.

Enarx is CPU-architecture independent, allowing the same application code to be deployed on multiple targets, abstracting issues such as cross-compilation and different authentication mechanisms between hardware vendors. Currently, support for AMD SEV and Intel SGX is in the works.

Enarx uses WebAssembly as the foundation for its isolation and portability.

github.com/enarx/enarx

Cargo C: Builds and installs C-ABI-compliant dynamic and static libraries.

It generates and installs the correct PKG-config files, static and dynamic libraries, and the C header used by any C (and C-compatible) software.

Github.com/lu-zero/car…

The Macroquad game engine isolated the audio system

The Macroquad Game Engine recently isolated its audio system as a more general Rust package, which is a unified abstraction of multiple audio backends for multiple platforms, with the following completion:

  • Web: WebAudio
  • Android: OpenSLES
  • Linux: Alsa
  • Mac: CoreAudio
  • Windows: Wasapi
  • IOS: CoreAudio(?)

Github.com/not-fl3/qua…

Gloo v0.3.0 release

The Gloo team is pleased to announce a new and long overdue Gloo release: V0.3.0. Gloo is a modular toolkit for building fast, reliable Web applications and libraries using Rust and WASM.

Gloo – rs. Web. App/blog/releas…

Throne: Scripting language for game prototyping and story logic

@Tobmansf has been researching scripting languages for game prototyping and story logic. It compilers to WebAssembly and is available in t-mw.github. IO /throne-play… Give it a try.

github.com/t-mw/throne

The zero-cost deserialization framework RKYV has released version 0.7.1

Github.com/djkoloski/r…

A Voxel engine for Rust and TypeScript implementations

Based on actix-Web implementation

  • Github.com/ian13456/mi…
  • IO /? World = terr…

Slowly nibble series Rust | Gazebo Dupe Dupe of the library

Original title: Rust Nibbles – Gazebo: Dupe

Is there anything wrong with “Rust Nibbles” translating into “Rust Nibbles”?

This is the Rust Nibbles series from Facebook for Develpers about Facebook’s open-source Rust libraries.

Gazebo is a basic library written by Facebook engineers that contains a series of tested Rust utilities in the form of stand-alone modules. This article introduces the Dupe trait in Gazebo.

In Rust, there are two related features for “copying” a value –Copy and Clone.

A third similar trait was introduced in Gazebo, called Dupe, which can be used in Gazebo Prelude. (Dupe means to copy objects/negatives).

Copy is an automatic behavior of the compiler and is inexpensive to Copy. Clone does not. Arc can be used to reduce Clone costs, but Arc makes code reading expensive. Let xs = ys. Clone (); You may need to look at a lot of context to figure out whether Clone or Arc was called. Of course you can use let xs = Arc:: Clone (ys) to improve readability, but the downside is that it breaks abstraction.

So Gazebo introduced the Dupe trait, let xs = ys. Dupe ().

use gazebo::prelude::*;
#[derive(Clone, Dupe)]
struct MyArc(Arc<String>);
Copy the code

Take a look at the implementation source: github.com/facebookinc…

pub trait Dupe: Clone {
    fn dupe(&self) - >Self {
        self.clone()
    }
}
Copy the code

It looks similar to Clone, but is only available for constant or zero assignments, such as Arc. Because Dupe only implements these types.

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

Want to write a script with Rust?

Rust-script, which allows you to run rust files and expressions without any setup or compilation steps.


$ echo 'println! ("Hello, World!"); ' > hello.rs $ rust-script hello.rs Hello, World!Copy the code

Crate dependency is also supported

#! /usr/bin/env rust-script/ /! This is a regular crate doc comment, but it also contains a partial
//! Cargo manifest.  Note the use of a *fenced* code block, and the
/ /! `cargo` "language".
/ /!
/ /! ```cargo
/ /! [dependencies]
/ /! Time = "0.1.25"
/ /!
fn main() {
    println!("{}", time::now().rfc822z());
}

Copy the code
$ rust-script now
Wed, 28 Oct 2020 00:38:45 +0100
Copy the code
  • rust-script.org/
  • Github.com/fornwall/ru…

Quilkin: An open source UDP proxy for game servers

Launched by Embark and Google Cloud, the goal is to provide any game studio with the same online capabilities as the giants.

Medium.com/embarkstudi…

Franzplot: Teaching software implemented by Rust

A research assistant at the Politecnico di Milano taught the course “Curves and Surfaces for Design”, which explains three-dimensional mathematical concepts to design students. Since there was no handy teaching tool, the ta implemented one herself using Rust.

The first version was implemented by CPP. Then the new version was rewritten in Rust. Why?

  1. He ran up too much technical debt in the CPP version for open source collaboration
  2. OpenGL has been scrapped by Apple
  3. Want to make tools more powerful

So, the tool has now been rewritten with WebGPU + Rust. Based on the github.com/gfx-rs/wgpu

FranzPlot is currently closed source but may open source in the future. Because despite the software rewrite, there is still some technical debt to deal with. I also want to use WGSL completely instead of GLSL, and I want to replace the interface with a pure Rust implementation, such as the EGUI framework. Now imGUI-RS is used.

GFX – rs. Making. IO/stories/fra…

Delicate a lightweight distributed task scheduling platform

The features are as follows:

  1. Enrich Rust ecology. It is a small and medium-sized project (3W+ code), involving interaction ends including (front-end, Server, agent) JS & RUST interweaving, so that new students can realize a RUST project as a reference.
  2. The c-terminal interactions are designed to meet user habits as far as possible. In addition to performance, the project is very concerned about the comfort of human use.
  3. There are some newly defined concepts such as binding, where A task is not directly associated with A machine but an abstraction of the associated machine (binding). When there are hundreds of tasks that need to be migrated from machine A to machine B, the task is automatically migrated with only one change to the association.

Github.com/BinChengZha…

A secure one is available for#[no_std]Asn.1 decoder framework

Github.com/XAMPPRocky/…

Rust implements the next generation package manager for Windows, very fast

There’s only an Alpha release, but it’s already 5 times faster than the current package manager that comes with Windows.

Github.com/novus-packa…

Loadstone is a secure bare-metal bootloader

Rust started writing the bootloader. This looks like a pretty serious project, with 1.0.0 released so far. Provides the following functions:

  • Multi-mirror operations: store, copy, upgrade, verify, and start. Flexible configuration
  • Supports external Flash chips
  • Golden Image rollbacks
  • Automatic or application-triggered upgrades

Those of you at the bottom, please pay serious attention to this project.

Github.com/absw/loadst…

A research OS: NrOS

Node Replicated Kernel (NRK) was originally a prototype research-based Os project in VMware Research, and now some academic achievements have been made. The main feature is to explore the architecture of future operating systems.

nrkernel.systems/

Sycamore v0.5.0 release

Sycamore is a library for building homogeneous Web applications in Rust and WebAssembly. Version v0.5.0 is the largest release of Sycamore to date and includes a number of new features and bug fixes. This version also introduces a full-featured routing system

The article links: sycamore-rs.net lify. App/news/announ…

Nanorand v0.6 release

Nanorand is a fast, lightweight and efficient random number generator that delivers nanorand::WyRand at speeds up to 16.4 GB/s on the M1 Macbook Air.

Nanorand has now released V0.6, RandomGen supports signed integers and floating-point numbers, RandomRange supports signed integers.

Github.com/Absolucy/na…

Hora 0.1.0 from

Hora, Library for Approximate Nearest Neighbor Search (ANNS) implemented by Rust. V0.1.0 was first released, focusing on the approximate nearest neighbor search domain, and has implemented HNSW (Hierarchical Navigable Small World Graph Index) Index, SSG (Satellite System Graph) Index, PQIVF (Product Quantization Inverted File) index, BruteForceIndex, and others are coming soon.

Hora can be deployed on any operating system platform, it already supports PC operating systems Linux, Mac OS, Windows, will support mobile operating systems IOS and Android, and will support embedded systems (NO_STD) in the future, and will support multiple language bindings, including Python, Javascript, Java, Ruby, Swift and R.

Related link information: github.com/hora-search…