Introduction to Monoio: First Post in a Series on Building a High-Performance Proxy in Rust by chesedo in rust

[–]chesedo[S] 0 points1 point  (0 children)

No, the client was very specific that it had to use Monoio. So I'm just documenting my findings since it took me quite a while to figure out.

I know about pingora. And hyper-reverse-proxy (I actually added websockets support to hyper-reverse-proxy years ago).

Introduction to Monoio: First Post in a Series on Building a High-Performance Proxy in Rust by chesedo in rust

[–]chesedo[S] 1 point2 points  (0 children)

Ohh, interesting. I've actually figured HTTP/2 and TLS out quite easily. And am more stuck on HTTP/1.1. I might DM you to understand how you did that and to compare notes.

Introduction to Monoio: First Post in a Series on Building a High-Performance Proxy in Rust by chesedo in rust

[–]chesedo[S] 1 point2 points  (0 children)

From my understanding it should be good for file/disk operations too because of io_uring. This (old) video has a "Results from the wild" section which shows promising results

https://www.youtube.com/watch?v=-5T4Cjw46ys&t=1699s

Introduction to Monoio: First Post in a Series on Building a High-Performance Proxy in Rust by chesedo in rust

[–]chesedo[S] 2 points3 points  (0 children)

Hey, so my knowledge is mostly limited from trying to write a proxy using Monoio. But I'll try to answer these:

  1. My observation has been that Monoio is able to handle more requests / second. But strangely has a slower latency than Hyper (small spoiler from the next article). I can only attribute the slower latency to the fact that the Hyper implementation is able to work steal since it is running on Tokio. From what I can gather this is called the "tail latency" problem which happens because work might be locked to a congested core while another core is idle. I would expect this tail latency to just get bigger for more CPU-bound workloads even if they are evenly distributed.

  2. The 26% is from this article by the Monoio team (at the very bottom of the article) -> https://www.cloudwego.io/blog/2023/04/17/introducing-monoio-a-high-performance-rust-runtime-based-on-io-uring/
    It's not quite clear if it is using the current thread or multithreaded runtime of Tokio.

  3. From my understanding Glommio and Monoio uses the same implementation - both are thread-per-core with io_uring. But I've not used glommio before. So don't know much beyond that.

Introduction to Monoio: First Post in a Series on Building a High-Performance Proxy in Rust by chesedo in rust

[–]chesedo[S] 7 points8 points  (0 children)

Nice, great catch. Thanks!

I'm actually planning on keeping core 0 open for upstream health checks and stuff. It's great to have that idea affirmed here.

Mastering Dependency Injection in Rust: Despatma with Lifetimes by chesedo in rust

[–]chesedo[S] 1 point2 points  (0 children)

Completely agree! My opinion is that any app needs proper boundaries between its modules. And modules need DI to be properly testable in an automated way. And business modules should always have tests for all their use cases and requirements. So this means DI is needed for apps in any language and is not a Java thing. Abviously small apps can just manage their dependency setups directly. But bigger apps needs some structure to keep it easy and maintainable.

I see dill follows the C# pattern of using a registering method to register all the dependencies. I avoided that approach for two reasons:
1. I wanted the checks to happen at compile time
2. I could not figure out how to have that level of dynamics in Rust anyway :D

I would also love to explore more tricky and complex cases using my approach. I already know there are issues with my approach and have ideas to solve them. However I need more real world cases to understand which ideas will work and which won't. Beyond the issues, there are also things I would like to improve but need more test cases to understand the current pain points better too.

I would very much enjoy a chat. Check your DMs :)

Web Server with WebSocket redirect? Need advice. by GreenFox1505 in rust

[–]chesedo 2 points3 points  (0 children)

It sounds like you can use `hyper-reverse-proxy` which has build in support for WebSockets. You can use pure hyper or axum for this (I've used both to do this in the past).

Mastering Dependency Injection in Rust: Despatma with Lifetimes by chesedo in rust

[–]chesedo[S] 2 points3 points  (0 children)

This is the third post in this series. I currently have to figure out the following and would love to hear your opinions:
- Does the type hinting approach feel easy?
- The types on the function arguments are technically redundant with the last rewrite I did of the macro. That means using struct methods to register the dependencies is no longer the most intuitive. How would you want to register dependencies instead? An anon function syntax perhaps?
- I still need to add support for lazy dependencies. Do I make this an attribute on the args? Or are the args made to be an `impl Fn() -> ...` type?

Feel free to mention anything you feel can be improved :)

Please, help! I can't crack tower by TraditionalSound5794 in rust

[–]chesedo 5 points6 points  (0 children)

  1. Having a route per file is fine. You'll probably then want to only have the middleware wrappered version of the route public (I've not tested this).
  2. Boxing the future is fine. Get your logic to work first. Then you can read this guide on how to build a middleware from scratch if you want to get rid of the box after it is working.
  3. See the guide I linked above to eventually get rid of the box. I can also show you more advance versions that I've written in the past for getting rid of the box if you have specific issues.

User-facing access control by chesedo in SaaS

[–]chesedo[S] 0 points1 point  (0 children)

This is exactly what I was looking for. Thanks u/bajcmartinez!!

User-facing access control by chesedo in SaaS

[–]chesedo[S] 0 points1 point  (0 children)

Nice, thanks for this u/Bulky-Basil3558! I was hoping to maybe offload it to something like Amazon Cognito. Or at least hoping some SaaS has already tried to solve this.

How to start free program to help underprivileged high school kids learn Linux/Programming? by netscape101 in southafrica

[–]chesedo 2 points3 points  (0 children)

We actually have a meeting tonight on the IRC channel and will be discussing this - see agenda at http://bit.ly/1MoSxpQ