<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Next Stop - Ihcblog!</title>
  
  <subtitle>Some creations and thoughts sharing | sub site:ihc.im</subtitle>
  <link href="https://en.ihcblog.com/atom.xml" rel="self"/>
  
  <link href="https://en.ihcblog.com/"/>
  <updated>2025-04-03T00:00:00.000Z</updated>
  <id>https://en.ihcblog.com/</id>
  
  <author>
    <name>ihciah</name>
    
  </author>
  
  <generator uri="https://hexo.io/">Hexo</generator>
  
  <entry>
    <title>Rust2Go Part2: Exploring CGO Calls for Extreme Performance</title>
    <link href="https://en.ihcblog.com/rust2go-cgo-asm/"/>
    <id>https://en.ihcblog.com/rust2go-cgo-asm/</id>
    <published>2025-04-03T00:00:00.000Z</published>
    <updated>2025-04-03T00:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has an &lt;a href=&quot;https://www.ihcblog.com/rust2go-cgo-asm/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A year ago, I released an open-source project called &lt;a href=&quot;https://github.com/ihciah/rust2go&quot;&gt;Rust2Go&lt;/a&gt;（related blog: &lt;a href=&quot;https://en.ihcblog.com/rust2go&quot;&gt;Design and Implementation of a Rust-Go FFI Framework&lt;/a&gt;）, which provides high-performance asynchronous and synchronous call support from Rust to Go. This project serves as the foundation for several community projects and multiple internal projects within my company. I’ve continued optimizing its performance and developing new features.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I’ll be &lt;a href=&quot;https://www.rustasiaconf.com/speakers/hai-chi?locale=en&quot;&gt;speaking on this topic at Rust Asia Conf 2025&lt;/a&gt;—everyone interested is warmly welcome to join!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Recently, I explored CGO-related topics and, based on a newly developed high-performance CGO mechanism, added support in Rust2Go for actively invoking Rust from Go. This article focuses primarily on the former.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: This article is not limited to Rust. It is applicable to all Go cross-language projects. A corresponding repository and example are also provided. Users with such needs are welcome to adopt and use it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This article will proceed in the following order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Introduce the principles of CGO calls and their performance issues, which are the main targets of optimization;&lt;/li&gt;
&lt;li&gt;Show how to optimize CGO calls using the simplest assembly techniques;&lt;/li&gt;
&lt;li&gt;Highlight stack space issues and explain how switching to the G0 stack can resolve them;&lt;/li&gt;
&lt;li&gt;Introduce Async Preemption and how to block it to ensure the G0 stack remains unpolluted;&lt;/li&gt;
&lt;li&gt;Discuss the optimization results and application scenarios.&lt;/li&gt;
&lt;/ol&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="cgo" scheme="https://en.ihcblog.com/tags/cgo/"/>
    
    <category term="asm" scheme="https://en.ihcblog.com/tags/asm/"/>
    
    <category term="golang" scheme="https://en.ihcblog.com/tags/golang/"/>
    
  </entry>
  
  <entry>
    <title>Building Reliable Context-Passing Components in Rust</title>
    <link href="https://en.ihcblog.com/reliable-context-passing/"/>
    <id>https://en.ihcblog.com/reliable-context-passing/</id>
    <published>2024-09-22T21:00:00.000Z</published>
    <updated>2024-09-22T21:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has an &lt;a href=&quot;https://www.ihcblog.com/reliable-context-passing/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This article discusses my thoughts, designs, and implementations on creating a reliable context-passing component in Rust. My project, &lt;a href=&quot;https://crates.io/crates/certain-map&quot;&gt;certain-map&lt;/a&gt;, has been open-sourced (it was first released over a year ago, with more improvements made recently, which I will discuss later in this article). Feel free to use it!&lt;/p&gt;
&lt;p&gt;Project URL: &lt;a href=&quot;https://github.com/ihciah/certain-map&quot;&gt;https://github.com/ihciah/certain-map&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What problem does it solve:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;When passing context across components, it can leverage the compiler to ensure the existence of fields (i.e., when a component has a read dependency on a field in the Context, the preceding component must have written to that field, otherwise it will not compile).&lt;/li&gt;
&lt;li&gt;The context required by generic components can be defined as a generic parameter and constrained, which makes the component implementation more generic and not coupled to a specific type of Context.&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: Although the project name seems to suggest a map implementation, it is actually a struct generated using procedural macros. The reason it is named certain-map is that it was originally designed to replace TypeMap and ensure the existence of fields.&lt;/p&gt;
&lt;/blockquote&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
  </entry>
  
  <entry>
    <title>Mini VMM in Rust 4 - Implement Virtio Device</title>
    <link href="https://en.ihcblog.com/rust-mini-vmm-4/"/>
    <id>https://en.ihcblog.com/rust-mini-vmm-4/</id>
    <published>2024-08-04T17:50:00.000Z</published>
    <updated>2024-08-04T17:50:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust-mini-vmm-4/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This series of articles mainly records my attempt to implement a Hypervisor using Rust. The table of contents:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-1/&quot;&gt;Mini VMM in Rust - Basic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-2/&quot;&gt;Mini VMM in Rust - Mode Switch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-3/&quot;&gt;Mini VMM in Rust - Run Real Linux Kernel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-4/&quot;&gt;&lt;strong&gt;Mini VMM in Rust - Implement Virtio Devices&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This article is the fourth in the series. It will cover implementing a Virtio Queue and virtio-net from scratch and using TAP as the backend for a virtio-net device. To better assemble these components, additional components such as a Bus and EventLoop will also be added.&lt;/p&gt;
&lt;p&gt;During this experiment, I also contributed some PRs to firecracker and cloud-hypervisor, please refer to the end of the article.&lt;/p&gt;
&lt;p&gt;There is a lot of code in the article, please use the directory navigation on the right when necessary.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The previous three articles were completed in the second half of 2022, while this chapter and the corresponding experimental code have been in draft form until recently (now it is 2024). Over a few weekends, I added some code and completed this article.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The next article may support PCI devices and direct I&amp;#x2F;O for VF devices if I have the time(but don’t expect it, haha).&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="vmm" scheme="https://en.ihcblog.com/tags/vmm/"/>
    
    <category term="kvm" scheme="https://en.ihcblog.com/tags/kvm/"/>
    
  </entry>
  
  <entry>
    <title>Design and Implementation of a Rust-Go FFI Framework</title>
    <link href="https://en.ihcblog.com/rust2go/"/>
    <id>https://en.ihcblog.com/rust2go/</id>
    <published>2023-12-08T23:07:00.000Z</published>
    <updated>2024-08-03T23:07:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust2go/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This article will introduce the design and implementation of a Rust FFI (Foreign Function Interface) framework that I created for calling Golang code from Rust. It will cover the design from the perspective of a designer and implementer, considering various options and explaining the choices made and the reasons behind them. It will also cover some implementation details.&lt;/p&gt;
&lt;p&gt;The project is open-sourced on GitHub: &lt;a href=&quot;https://github.com/ihciah/rust2go&quot;&gt;https://github.com/ihciah/rust2go&lt;/a&gt;. It is a personal hobby project from the beginning, but it is also used in my current company. I will share this topic at this year’s &lt;a href=&quot;https://rustcc.cn/2024conf/&quot;&gt;Rust Conf China(2024)&lt;/a&gt; and welcome to attend.&lt;/p&gt;
&lt;p&gt;Compared to Golang, Rust programs are not garbage-collected and have stronger compile-time checks. Also thanks to LLVM, Rust gets the best possible compiler optimizations, which results in better performance and safety.&lt;/p&gt;
&lt;p&gt;At ByteDance, to drive cost optimization, I developed from scratch multiple business-critical Rust SDKs, including service discovery, metrics, log, and dynamic configuration. I initiated and participated in the development of a Rust RPC framework, as well as provided compilation and runtime images, internal crates sources, and a public mirror (rsproxy.cn). Built on top of these infrastructural projects, several core services were migrated to Rust, achieving significant performance gains: a reduction of over 30% in CPU usage and a notable decrease in the P99 latency for some latency-sensitive services. However, many of these services are such that they do not require active maintenance—like proxy and caching services—and hence were easier to migrate. Services with more complex and actively iterative business logic proved more challenging to shift to Rust.&lt;/p&gt;
&lt;p&gt;In theory, we could rewrite all Golang programs in Rust to achieve better performance, but in practice, this is met with considerable difficulties: First, rewriting all Golang dependencies may not be feasible; second, completing the rewrite all at once is difficult. If we could provide an efficient way of calling Golang from Rust, it would allow businesses to gradually make the switch to Rust, thereby addressing both issues.&lt;/p&gt;
&lt;p&gt;This article covers a lot of ground. The overall narrative flow is as follows: first, I’ll discuss the overall solution selection and provide a minimal PoC; then, starting from this minimal PoC, I’ll expand and refine the solution to support the necessary features; finally, I’ll discuss some implementation details of interest from a framework implementation perspective.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I shared this topic at the 2024 RustChinaConf. If you are interested, feel free to check out the video replay or the PPT(&lt;a href=&quot;https://www.bilibili.com/video/BV12hsheJErd&quot;&gt;video link&lt;/a&gt;, &lt;a href=&quot;https://r2.ihc.im/rust2go.pdf&quot;&gt;PPT link&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Please note these sharings are in Chinese. But if you have any question, feel free to reach me in any way(you can find my email and telegram in &lt;a href=&quot;https://en.ihcblog.com/about/&quot;&gt;about page&lt;/a&gt;).&lt;/p&gt;
&lt;/blockquote&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="ffi" scheme="https://en.ihcblog.com/tags/ffi/"/>
    
  </entry>
  
  <entry>
    <title>Rust HTTP Framework Design - Taking Axum 0.6 as an Example</title>
    <link href="https://en.ihcblog.com/http-framework-design-axum-as-an-example/"/>
    <id>https://en.ihcblog.com/http-framework-design-axum-as-an-example/</id>
    <published>2022-12-12T00:00:01.000Z</published>
    <updated>2022-12-12T00:00:01.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/http-framework-design-axum-as-an-example/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;An HTTP Server internally includes many parts: protocol implementation (h1, h2, compression, etc.), connection state management (keepalive), request distribution, middleware, business logic, and more. Users could implement all of these themselves, however, apart from the business logic, the rest are fairly common capabilities. By decoupling these generic capabilities from the user’s business logic, we arrive at what is known as an HTTP framework.&lt;/p&gt;
&lt;p&gt;In the Rust ecosystem, the hyper library already offers a relatively complete implementation of the HTTP protocol. Therefore, building an HTTP framework on top of hyper mainly requires adding capabilities such as routing, shared state, middleware, etc.&lt;/p&gt;
&lt;p&gt;This article discusses from the design perspective of an HTTP framework, using the new version of Axum as an example, how to provide rational abstractions and type constraints in Rust’s HTTP frameworks. Levering Rust’s powerful type system, we can write code that is both efficient and correct.&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="http" scheme="https://en.ihcblog.com/tags/http/"/>
    
  </entry>
  
  <entry>
    <title>Mini VMM in Rust 3 - Run Real Linux Kernel</title>
    <link href="https://en.ihcblog.com/rust-mini-vmm-3/"/>
    <id>https://en.ihcblog.com/rust-mini-vmm-3/</id>
    <published>2022-10-31T17:50:01.000Z</published>
    <updated>2022-10-31T17:50:01.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust-mini-vmm-3/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This series of articles mainly records my attempt to implement a Hypervisor using Rust. The table of contents:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-1/&quot;&gt;Mini VMM in Rust - Basic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-2/&quot;&gt;Mini VMM in Rust - Mode Switch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-3/&quot;&gt;&lt;strong&gt;Mini VMM in Rust - Run Real Linux Kernel&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-4/&quot;&gt;Mini VMM in Rust - Implement Virtio Devices&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This article is the third in the series, where we’ll do some preparatory work and actually get a real Linux system running.&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="vmm" scheme="https://en.ihcblog.com/tags/vmm/"/>
    
    <category term="kvm" scheme="https://en.ihcblog.com/tags/kvm/"/>
    
  </entry>
  
  <entry>
    <title>Mini VMM in Rust 2 - Mode Switch</title>
    <link href="https://en.ihcblog.com/rust-mini-vmm-2/"/>
    <id>https://en.ihcblog.com/rust-mini-vmm-2/</id>
    <published>2022-10-31T17:25:01.000Z</published>
    <updated>2022-10-31T17:25:01.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust-mini-vmm-2/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This series of articles mainly records my attempt to implement a Hypervisor using Rust. The table of contents:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-1/&quot;&gt;Mini VMM in Rust - Basic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-2/&quot;&gt;&lt;strong&gt;Mini VMM in Rust - Mode Switch&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-3/&quot;&gt;Mini VMM in Rust - Run Real Linux Kernel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-4/&quot;&gt;Mini VMM in Rust - Implement Virtio Devices&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This article is the second in the series, which mainly introduces a few common operating modes and switch between them.&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="vmm" scheme="https://en.ihcblog.com/tags/vmm/"/>
    
    <category term="kvm" scheme="https://en.ihcblog.com/tags/kvm/"/>
    
  </entry>
  
  <entry>
    <title>Mini VMM in Rust 1 - Basic</title>
    <link href="https://en.ihcblog.com/rust-mini-vmm-1/"/>
    <id>https://en.ihcblog.com/rust-mini-vmm-1/</id>
    <published>2022-10-31T17:20:01.000Z</published>
    <updated>2022-10-31T17:20:01.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust-mini-vmm-1/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This series of blog posts mainly records my process of trying to implement a Hypervisor in Rust.&lt;/p&gt;
&lt;p&gt;Why am I writing this series? A few months ago, when I was exploring KVM in my spare time, I encountered some difficulties. Many articles on the Internet did not explain things clearly, and there wasn’t a single article that could build a VMM from scratch and clearly explain the meaning and reason of each Magic Number. I hope my sharing can help beginners avoid some detours to a certain extent. Of course, there may be some misunderstandings in my explanations, and I welcome corrections from everyone.&lt;/p&gt;
&lt;p&gt;Table of Contents:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-1/&quot;&gt;&lt;strong&gt;Mini VMM in Rust - Basic&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-2/&quot;&gt;Mini VMM in Rust - Mode Switch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-3/&quot;&gt;Mini VMM in Rust - Run Real Linux Kernel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-mini-vmm-4/&quot;&gt;Mini VMM in Rust - Implement Virtio Devices&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This article is the first in the series, which mainly covers some introductory knowledge and runs some actual code.&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="vmm" scheme="https://en.ihcblog.com/tags/vmm/"/>
    
    <category term="kvm" scheme="https://en.ihcblog.com/tags/kvm/"/>
    
  </entry>
  
  <entry>
    <title>ShadowTLS: A Better TLS Camouflage Proxy</title>
    <link href="https://en.ihcblog.com/a-better-tls-obfs-proxy/"/>
    <id>https://en.ihcblog.com/a-better-tls-obfs-proxy/</id>
    <published>2022-10-04T12:51:01.000Z</published>
    <updated>2023-02-20T16:00:01.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/a-better-tls-obfs-proxy/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This article mainly analyzes the currently popular Trojan protocol and proposes a better solution based on the characteristics of current man-in-the-middle (MITM) attacks.&lt;/p&gt;
&lt;p&gt;The implementation of this solution is ShadowTLS, for which you can find the complete code and pre-compiled binaries on &lt;a href=&quot;https://github.com/ihciah/shadow-tls&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;</summary>
    
    
    
    
    <category term="proxy" scheme="https://en.ihcblog.com/tags/proxy/"/>
    
    <category term="tls" scheme="https://en.ihcblog.com/tags/tls/"/>
    
  </entry>
  
  <entry>
    <title>Rust Runtime Design and Implementation - IO Compatibility Part</title>
    <link href="https://en.ihcblog.com/rust-runtime-design-5/"/>
    <id>https://en.ihcblog.com/rust-runtime-design-5/</id>
    <published>2022-06-07T00:00:00.000Z</published>
    <updated>2022-06-07T00:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust-runtime-design-5/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This series of articles mainly introduces how to design and implement a Runtime based on the io-uring and Thread-per-core model.&lt;/p&gt;
&lt;p&gt;Our final Runtime product &lt;strong&gt;Monoio&lt;/strong&gt; is now open source, and you can find it at &lt;a href=&quot;https://github.com/bytedance/monoio&quot;&gt;github.com&amp;#x2F;bytedance&amp;#x2F;monoio&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-1/&quot;&gt;Rust Runtime Design and Implementation - General Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-2/&quot;&gt;Rust Runtime Design and Implementation - Design Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-3/&quot;&gt;Rust Runtime Design and Implementation - Design Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-4/&quot;&gt;Rust Runtime Design and Implementation - Component Part&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-5/&quot;&gt;&lt;strong&gt;Rust Runtime Design and Implementation - IO Compatibility Part&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This article is the fifth in the series. Originally, the series concluded with four articles, but with the recent addition of epoll support (&lt;a href=&quot;https://github.com/bytedance/monoio/pull/73&quot;&gt;!73&lt;/a&gt;), I decided to write about the design of this part as well.&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="runtime" scheme="https://en.ihcblog.com/tags/runtime/"/>
    
  </entry>
  
  <entry>
    <title>Rust Runtime Design and Implementation - Component Part</title>
    <link href="https://en.ihcblog.com/rust-runtime-design-4/"/>
    <id>https://en.ihcblog.com/rust-runtime-design-4/</id>
    <published>2021-12-08T00:00:00.000Z</published>
    <updated>2021-12-08T00:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust-runtime-design-4/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This series of articles mainly introduces how to design and implement a Runtime based on the io-uring and Thread-per-core model.&lt;/p&gt;
&lt;p&gt;Our final Runtime product &lt;strong&gt;Monoio&lt;/strong&gt; is now open source, and you can find it at &lt;a href=&quot;https://github.com/bytedance/monoio&quot;&gt;github.com&amp;#x2F;bytedance&amp;#x2F;monoio&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-1/&quot;&gt;Rust Runtime Design and Implementation - General Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-2/&quot;&gt;Rust Runtime Design and Implementation - Design Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-3/&quot;&gt;Rust Runtime Design and Implementation - Design Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-4/&quot;&gt;&lt;strong&gt;Rust Runtime Design and Implementation - Component Part&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-5/&quot;&gt;Rust Runtime Design and Implementation - IO Compatibility Part&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This article is the fourth in the series, and we have mostly covered the design aspects previously. In this part, we will focus on components such as channels.&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="runtime" scheme="https://en.ihcblog.com/tags/runtime/"/>
    
  </entry>
  
  <entry>
    <title>Rust Runtime Design and Implementation - Design Part 2</title>
    <link href="https://en.ihcblog.com/rust-runtime-design-3/"/>
    <id>https://en.ihcblog.com/rust-runtime-design-3/</id>
    <published>2021-12-07T00:00:00.000Z</published>
    <updated>2021-12-07T00:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust-runtime-design-3/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This series of articles mainly introduces how to design and implement a Runtime based on the io-uring and Thread-per-core model.&lt;/p&gt;
&lt;p&gt;Our final Runtime product &lt;strong&gt;Monoio&lt;/strong&gt; is now open source, and you can find it at &lt;a href=&quot;https://github.com/bytedance/monoio&quot;&gt;github.com&amp;#x2F;bytedance&amp;#x2F;monoio&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-1/&quot;&gt;Rust Runtime Design and Implementation - General Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-2/&quot;&gt;Rust Runtime Design and Implementation - Design Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-3/&quot;&gt;&lt;strong&gt;Rust Runtime Design and Implementation - Design Part 2&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-4/&quot;&gt;Rust Runtime Design and Implementation - Component Part&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-5/&quot;&gt;Rust Runtime Design and Implementation - IO Compatibility Part&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This article is the third in the series, continuing the discussion on design trade-offs for the runtime environment.&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="runtime" scheme="https://en.ihcblog.com/tags/runtime/"/>
    
  </entry>
  
  <entry>
    <title>Rust Runtime Design and Implementation - Design Part 1</title>
    <link href="https://en.ihcblog.com/rust-runtime-design-2/"/>
    <id>https://en.ihcblog.com/rust-runtime-design-2/</id>
    <published>2021-12-06T00:00:00.000Z</published>
    <updated>2021-12-06T00:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust-runtime-design-2/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This series of articles mainly introduces how to design and implement a Runtime based on the io-uring and Thread-per-core model.&lt;/p&gt;
&lt;p&gt;Our final Runtime product &lt;strong&gt;Monoio&lt;/strong&gt; is now open source, and you can find it at &lt;a href=&quot;https://github.com/bytedance/monoio&quot;&gt;github.com&amp;#x2F;bytedance&amp;#x2F;monoio&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-1/&quot;&gt;Rust Runtime Design and Implementation - General Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-2/&quot;&gt;&lt;strong&gt;Rust Runtime Design and Implementation - Design Part 1&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-3/&quot;&gt;Rust Runtime Design and Implementation - Design Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-4/&quot;&gt;Rust Runtime Design and Implementation - Component Part&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-5/&quot;&gt;Rust Runtime Design and Implementation - IO Compatibility Part&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This article is the second in the series, starting with Monoio as an example to discuss the design choices and trade-offs in Runtimes, while referencing and comparing with the designs of Tokio and Glommio.&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="runtime" scheme="https://en.ihcblog.com/tags/runtime/"/>
    
  </entry>
  
  <entry>
    <title>Rust Runtime Design and Implementation - General Introduction</title>
    <link href="https://en.ihcblog.com/rust-runtime-design-1/"/>
    <id>https://en.ihcblog.com/rust-runtime-design-1/</id>
    <published>2021-12-05T00:00:00.000Z</published>
    <updated>2021-12-05T00:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/rust-runtime-design-1/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This series of articles mainly introduces how to design and implement a Runtime based on the io-uring and Thread-per-core model.&lt;/p&gt;
&lt;p&gt;Our final Runtime product &lt;strong&gt;Monoio&lt;/strong&gt; is now open source, and you can find it at &lt;a href=&quot;https://github.com/bytedance/monoio&quot;&gt;github.com&amp;#x2F;bytedance&amp;#x2F;monoio&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-1/&quot;&gt;&lt;strong&gt;Rust Runtime Design and Implementation - General Introduction&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-2/&quot;&gt;Rust Runtime Design and Implementation - Design Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-3/&quot;&gt;Rust Runtime Design and Implementation - Design Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-4/&quot;&gt;Rust Runtime Design and Implementation - Component Part&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.ihcblog.com/rust-runtime-design-5/&quot;&gt;Rust Runtime Design and Implementation - IO Compatibility Part&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This article is the first in the series, mainly introducing some general concepts as well as writing a very simple Runtime as an example.&lt;/p&gt;
&lt;p&gt;UPDATE: &lt;a href=&quot;https://meetings.feishu.cn/s/1iekwum9skd98&quot;&gt;Here is a presentation video I made(in Chinese)&lt;/a&gt;, and &lt;a href=&quot;https://drive.google.com/file/d/1qNOi3RJB8DvCLTOjMehsxZPLo4sZuxiQ/view&quot;&gt;the corresponding PPT&lt;/a&gt;. Interested viewers are welcome to watch the playback :)&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="runtime" scheme="https://en.ihcblog.com/tags/runtime/"/>
    
  </entry>
  
  <entry>
    <title>Some interesting attempts at eBPF with Rust</title>
    <link href="https://en.ihcblog.com/ebpf-fun/"/>
    <id>https://en.ihcblog.com/ebpf-fun/</id>
    <published>2021-12-01T00:00:00.000Z</published>
    <updated>2021-12-01T00:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/ebpf-fun/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I’ve recently made two attempts with eBPF and found it quite interesting, so I thought I’d share.&lt;/p&gt;</summary>
    
    
    
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
    <category term="ebpf" scheme="https://en.ihcblog.com/tags/ebpf/"/>
    
  </entry>
  
  <entry>
    <title>Reflections on proxy Design</title>
    <link href="https://en.ihcblog.com/thought-about-proxy/"/>
    <id>https://en.ihcblog.com/thought-about-proxy/</id>
    <published>2021-11-27T00:00:01.000Z</published>
    <updated>2021-11-27T00:00:01.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/thought-about-proxy/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This article mainly summarizes &lt;strong&gt;common issues and thoughts in proxy framework design&lt;/strong&gt;; it also touches on some engineering designs within the &lt;strong&gt;Rust + Tower&lt;/strong&gt; ecosystem. Although there’s already plenty of discussion on this topic online, who knows, maybe after reading this article, you’ll come up with a new idea? &lt;del&gt;Found out that since joining the company, I’ve been writing nothing but proxies&lt;/del&gt;&lt;/p&gt;</summary>
    
    
    
    
    <category term="proxy" scheme="https://en.ihcblog.com/tags/proxy/"/>
    
    <category term="rust" scheme="https://en.ihcblog.com/tags/rust/"/>
    
  </entry>
  
  <entry>
    <title>Exploring a Seamless Cloud Drive Encryption Solution</title>
    <link href="https://en.ihcblog.com/one-encrypt/"/>
    <id>https://en.ihcblog.com/one-encrypt/</id>
    <published>2019-08-06T14:13:24.000Z</published>
    <updated>2025-06-04T23:50:31.989Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/OneEncrypt/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This article will introduce an unobtrusive method of encrypting cloud storage (using OneDrive as an example), and the code has been &lt;a href=&quot;https://github.com/ihciah/OneEncrypt&quot;&gt;open sourced&lt;/a&gt; after the project was essentially complete.&lt;/p&gt;</summary>
    
    
    
    
    <category term="fun" scheme="https://en.ihcblog.com/tags/fun/"/>
    
  </entry>
  
  <entry>
    <title>Using an SD Card with Bad Blocks on a Development Board</title>
    <link href="https://en.ihcblog.com/use-a-corrupted-sd-card/"/>
    <id>https://en.ihcblog.com/use-a-corrupted-sd-card/</id>
    <published>2019-01-24T20:57:00.000Z</published>
    <updated>2019-01-24T20:57:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/How-to-Use-a-Corrupted-SD-Card/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The Raspberry Pi has already ruined three of my SD cards. Although I was able to directly contact SanDisk and Samsung customer service on two occasions, where they replaced the SD cards unconditionally adhering to the warranty terms.&lt;/p&gt;
&lt;p&gt;However, SD (TF) cards can’t endure many write cycles. Depending on the type of flash memory cells, MLC (Multi-Level Cell) has a longer life expectancy than TLC (Triple-Level Cell) chips. Cheaper SD cards generally use TLC chips, which can only withstand a few thousand write&amp;#x2F;erase cycles. Typical Linux systems frequently delete and write a large amount of log data during use, which means that SD cards cannot be used reliably for a long period.&lt;/p&gt;
&lt;p&gt;This time I tried to boot up the board with a damaged SD card using some unusual methods.&lt;/p&gt;</summary>
    
    
    
    
    <category term="fun" scheme="https://en.ihcblog.com/tags/fun/"/>
    
  </entry>
  
  <entry>
    <title>Speed Up Shadowsocks</title>
    <link href="https://en.ihcblog.com/speed-up-shadowsocks/"/>
    <id>https://en.ihcblog.com/speed-up-shadowsocks/</id>
    <published>2019-01-09T16:54:36.000Z</published>
    <updated>2019-01-09T16:54:36.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/How-to-Speed-Up-Shadowsocks/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/593b33688128f0addc3eb6db36140405f60a4a56.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;This article briefly summarizes current methods for accelerating internet access and details an acceleration project I developed based on Shadowsocks: &lt;a href=&quot;https://github.com/ihciah/go-shadowsocks-magic&quot;&gt;go-shadowsocks-magic&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;UPDATE 2019-10: Building on the ideas from this project, I extended it to support arbitrary TCP connections by decoupling the multi-connection acceleration: &lt;a href=&quot;https://github.com/ihciah/rabbit-tcp&quot;&gt;Rabbit TCP&lt;/a&gt;, which shows some improvements in stability and latency.&lt;/p&gt;</summary>
    
    
    
    
    <category term="fun" scheme="https://en.ihcblog.com/tags/fun/"/>
    
  </entry>
  
  <entry>
    <title>Memoirs of Tinkering with the MiaoMiao Printer</title>
    <link href="https://en.ihcblog.com/miaomiaoji/"/>
    <id>https://en.ihcblog.com/miaomiaoji/</id>
    <published>2018-11-01T14:29:54.000Z</published>
    <updated>2018-11-01T14:29:54.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;This article also has a &lt;a href=&quot;https://www.ihcblog.com/miaomiaoji/&quot;&gt;Chinese version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let’s dig out some past work. These were some projects I worked on in July last year, and some of them might have become obsolete by now.&lt;/p&gt;
&lt;p&gt;Last summer, I stumbled upon this device called the MiaoMiao Printer. As someone who enjoys tinkering, I got involved with reverse engineering and developing related to the MiaoMiao Printer. All the resources are available at: &lt;a href=&quot;https://github.com/ihciah/miaomiaoji-tool&quot;&gt;https://github.com/ihciah/miaomiaoji-tool&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The MiaoMiao Printer is a Bluetooth thermal printer that you can connect to and print from using its app via Bluetooth. I once saw on Weibo that DIYGOD had fun with a remote print push project, which inspired me to create something similar. However, I did not fancy the idea of constantly needing to operate it manually from my phone. Considering I had a Raspberry Pi 3 handy, with Bluetooth functionality, I decided to take apart the MiaoMiao Printer’s app, extract its communication protocol, and then set up a control script on the Raspberry Pi.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/dce4ccef2e6f24f1a076d00d4c3a6a7893629d69.jpg&quot;&gt;&lt;/p&gt;</summary>
    
    
    
    
    <category term="Fun" scheme="https://en.ihcblog.com/tags/Fun/"/>
    
  </entry>
  
</feed>
