Skip to content

Commit a7335d5

Browse files
committed
Feat: Monolake graphs and minor fixes
1 parent c26b4e4 commit a7335d5

22 files changed

Lines changed: 156 additions & 51 deletions

content/en/docs/monolake/Architecture/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Architecture"
33
linkTitle: "Architecture"
44
weight: 3
55
keywords: ["Proxy", "Rust", "io_uring", "Architecture"]
6-
description: "This doc covers architecture design and features"
6+
description: "Architecture and design deep dive"
77
---
88

99

content/en/docs/monolake/Architecture/context.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
title: "Context Management"
33
linkTitle: "Context"
44
weight: 4
5-
description: "Deep dive into Monolake's io_uring-based runtime and performance characteristics compared to traditional event-based runtimes"
65
---
76

8-
# Context Management with `certain_map`
7+
# `certain_map`
98

109
In a service-oriented architecture, managing the context data that flows between different services is a critical aspect of the system design. The [`certain_map`](https://docs.rs/certain-map/latest/certain_map/) crate provides a powerful way to define and work with typed context data, ensuring the existence of required information at compile-time.
1110

content/en/docs/monolake/Architecture/runtime.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ One of the defining characteristics of Monoio is its thread-per-core architectur
2020
When working with asynchronous I/O in Rust, understanding the underlying mechanisms of different runtimes is crucial. Two prominent approaches are the io-uring-based runtimes(Monolake) and the traditional event notification based runtimes (Tokio, async-std) which use mechanisms like kequeue and epoll. The fundamental difference between these two models lies in how they manage resource ownership and I/O operations.
2121

2222
io_uring operates on a submission-based model, where the ownership of resources (such as buffers) is transferred to the kernel upon submission of an I/O request. This model allows for high performance and reduced context switching, as the kernel can process the requests asynchronously. When an I/O operation is completed, the ownership of the buffers is returned to the caller. This ownership transfer leads to several implications:
23-
1. Ownership Semantics: In io-uring, since the kernel takes ownership of the buffers during the operation, it allows for more efficient memory management. The caller does not need to manage the lifecycle of the buffers while the operation is in progress.
2423

25-
2. Concurrency Model: The submission-based model allows for a more straightforward handling of concurrency, as multiple I/O operations can be submitted without waiting for each to complete. This can lead to improved throughput, especially in I/O-bound applications.
24+
1. **Ownership Semantics**: In io-uring, since the kernel takes ownership of the buffers during the operation, it allows for more efficient memory management. The caller does not need to manage the lifecycle of the buffers while the operation is in progress.
25+
26+
2. **Concurrency Model**: The submission-based model allows for a more straightforward handling of concurrency, as multiple I/O operations can be submitted without waiting for each to complete. This can lead to improved throughput, especially in I/O-bound applications.
2627

2728
In contrast, Tokio employs systems like kequeue and epoll. In this model, the application maintains ownership of the buffers throughout the lifetime of the I/O operation. Instead of transferring ownership, Tokio merely borrows the buffers, which has several implications:
2829

29-
1. Buffer Management: Since Tokio borrows buffers, the application is responsible for managing their lifecycle. This can introduce complexity, especially when dealing with concurrent I/O operations, as developers must ensure that buffers are not inadvertently reused while still in use.
30+
1. **Buffer Management**: Since Tokio borrows buffers, the application is responsible for managing their lifecycle. This can introduce complexity, especially when dealing with concurrent I/O operations, as developers must ensure that buffers are not inadvertently reused while still in use.
3031

31-
2. Polling Mechanism: The polling model in Tokio requires the application to actively wait for events, which can result in increased context switches and potentially less efficient use of system resources compared to the submission-based model of io-uring.
32+
2. **Polling Mechanism**: The polling model in Tokio requires the application to actively wait for events, which can result in increased context switches and potentially less efficient use of system resources compared to the submission-based model of io-uring.
3233

3334
## Async IO Trait divergence
3435

content/en/docs/monolake/Architecture/service.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ description: "Overview of Monolake's service architecture, factory patterns, and
77

88
## Services
99

10-
{{< figure src="/img/docs/monolake_service.jpeg" width="1000" height="600" caption="Service Architecture" >}}
10+
<style>
11+
.figure-caption {
12+
text-align: center;
13+
}
14+
</style>
15+
16+
{{< figure src="/img/docs/monolake_service.jpeg" width="1000" height="600" caption="Service Architecture" class="figure-caption" >}}
1117

1218
The Service pattern is a fundamental abstraction in network programming, popularized by the Tower library in the Rust ecosystem. At its core, a Service represents an asynchronous function that processes requests and returns responses. This pattern is particularly powerful for building networking applications as it enables:
1319

content/en/docs/monolake/Config Guide/_index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: "Config Guide"
33
linkTitle: "Config Guide"
44
weight: 5
5-
date: 2023-07-3
65
description: "Comphrensive guide to configuring monolake proxy"
76
---
87

content/en/docs/monolake/FAQ/_index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: "FAQ"
33
linkTitle: "FAQ"
4-
date: 2023-07-03
54
weight: 7
65
keywords: ["Monolake", "HTTP", "Proxy", "Q&A"]
76
description: "Monolake Frequently Asked Questions and Answers."

content/en/docs/monolake/Getting Started/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: "This page provides a quick start guide for setting up and running
88

99
## Prerequisites
1010

11-
- **Linux Kernel Support**: IO-uring requires a Linux kernel version that has io_uring support. Generally, kernel versions 5.1 and above provide the necessary support. Ensure that your target system has an appropriate kernel version installed. Monolake will fall back to epoll on Mac OS.
11+
- **Linux Kernel Support**: io_uring requires linux kernel support. Generally, kernel versions 5.1 and above provide the necessary support. Ensure that your target system has an appropriate kernel version installed. Monolake will fall back to epoll on Mac OS.
1212
- **Rust nightly**: See the "Rust installation section" below
1313

1414
## Quick Start

content/en/docs/monolake/Overview/_index.md

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: "Overview"
33
linkTitle: "Overview"
44
weight: 1
55
keywords: ["Proxy", "Rust", "io-uring"]
6-
description: "This doc provides an overview of Monolake, a high-performance network service framework."
76
---
87

98
## Monolake
@@ -27,25 +26,19 @@ By focusing on cutting-edge Rust and io_uring, Monolake aims to provide develope
2726

2827
## Performance
2928

30-
HAR TODO: Move performance section from benchmarks to here
31-
32-
### Test environment
29+
#### Request Per Second (RPS) vs. Body Size
30+
| RPS | TP99 |
31+
| :------------------------------------------------- | :-------------------------------------------------: |
32+
| ![image](/img/docs/https_req_per_sec_vs_body_size.png) | ![image](/img/docs/https_tp99_latency_vs_body_size.png) |
33+
| |
34+
| ![image](/img/docs/http_req_per_sec_vs_body_size.png) | ![image](/img/docs/http_tp99_latency_vs_body_size.png) |
3335

3436
### Concurrency performance
35-
36-
HAR TODO: Update with latest benchmarks
37-
38-
| QPS | TP99 | TP999 |
39-
| :------------------------------------------------- | :-------------------------------------------------: | :--------------------------------------------------: |
40-
| ![image](/img/docs/performance_concurrent_qps.png) | ![image](/img/docs/performance_concurrent_tp99.png) | ![image](/img/docs/performance_concurrent_tp999.png) |
41-
42-
### Throughput performance
43-
44-
Change packet size with a fixed concurrency of 100.
45-
46-
| QPS | TP99 | TP999 |
47-
| :----------------------------------------------- | :-----------------------------------------------: | :------------------------------------------------: |
48-
| ![image](/img/docs/performance_bodysize_qps.png) | ![image](/img/docs/performance_bodysize_tp99.png) | ![image](/img/docs/performance_bodysize_tp999.png) |
37+
| RPS | TP99 |
38+
| :------------------------------------------------- | :-------------------------------------------------: |
39+
| ![image](/img/docs/https_req_per_sec_vs_worker_threads.png) | ![image](/img/docs/https_tp99_latency_vs_worker_threads.png) |
40+
| |
41+
| ![image](/img/docs/http_req_per_sec_vs_worker_threads.png) | ![image](/img/docs/http_tp99_latency_vs_worker_threads.png) |
4942

5043
## Related Projects
5144

@@ -57,15 +50,11 @@ Change packet size with a fixed concurrency of 100.
5750

5851
| Crate | Description |
5952
|-------|-------------|
60-
| [monoio-transports](https://github.com/monoio-rs/monoio-transports) | A foundational crate that provides high-performance, modular networking capabilities, including connectors and utilities for efficient network communications |
61-
| [service-async](https://github.com/ihciah/service-async) | A foundational crate that introduces a refined Service trait with efficient borrowing and zero-cost abstractions, as well as utilities for service composition and state management |
62-
| [certain-map](https://github.com/ihciah/certain-map) | A foundational crate that provides a typed map data structure, ensuring the existence of specific items at compile-time, useful for managing data dependencies between services |
63-
| [monoio-thrift](https://github.com/monoio-rs/monoio-thrift) | Monoio native, io_uring compatible thrift implementation |
64-
| [monoio-http](https://github.com/monoio-rs/monoio-http) | Monoio native, io_uring compatible HTTP/1.1 and HTTP/2 implementation |
65-
| [monoio-nativetls](https://github.com/monoio-rs/monoio-tls) | The native-tls implementation compatible with monoio |
66-
| [monoio-rustls](https://github.com/monoio-rs/monoio-tls) | The rustls implementation compatible with monoio |
67-
68-
## Blogs
69-
70-
- [Monolake: How ByteDance Developed Its Own Rust Proxy to Save Hundreds of Thousands of CPU Cores](TODO)
71-
- [Monolake open source summit](TODO)
53+
| [monoio-transports](https://crates.io/crates/monoio-transports) | A foundational crate that provides high-performance, modular networking capabilities, including connectors and utilities for efficient network communications |
54+
| [service-async](https://crates.io/crates/service-async) | A foundational crate that introduces a refined Service trait with efficient borrowing and zero-cost abstractions, as well as utilities for service composition and state management |
55+
| [certain-map](https://crates.io/crates/certain-map) | A foundational crate that provides a typed map data structure, ensuring the existence of specific items at compile-time, useful for managing data dependencies between services |
56+
| [monoio-thrift](https://crates.io/crates/monoio-thrift) | Monoio native, io_uring compatible thrift implementation |
57+
| [monoio-http](https://crates.io/crates/monoio-http) | Monoio native, io_uring compatible HTTP/1.1 and HTTP/2 implementation |
58+
| [monoio-nativetls](https://crates.io/crates/monoio-native-tls) | The native-tls implementation compatible with monoio |
59+
| [monoio-rustls](https://crates.io/crates/monoio-rustls) | The rustls implementation compatible with monoio |
60+

content/en/docs/monolake/Tutorial/_index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: "Tutorial"
33
linkTitle: "Tutorial"
44
weight: 4
55
keywords: ["Proxy", "Rust", "io_uring", "Architecture"]
6-
description: "This is a developer guide"
76
---
87

9-
In this guide, we'll walk through the process of implementing a HTTP routing service using the [monolake-services](TODO) crate. This service will handle incoming HTTP requests and route them to appropriate upstream servers based on the configured routes and their associated endpoints.
8+
In this guide, we'll walk through the process of implementing an HTTP routing service using the `monolake-services` crate. This service will handle incoming HTTP requests and route them to appropriate upstream servers based on the configured routes and their associated endpoints.

content/en/docs/monolake/Tutorial/code.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: "Putting it all together"
33
linkTitle: "Putting it all together"
44
weight: 3
5-
description: "This doc covers how to manage configuration and context"
65
---
76

87
## Putting it all together

0 commit comments

Comments
 (0)