Async I/O in Depth: HTTP Web Server

preview_player
Показать описание
With this video we create an HTTP Web Server in Rust using the TcpListener and TcpStream. We implement several variations of async architectures to work with our web server. Iterative Sync requests, forking multiple processes, pre-forked processes, and a threaded model. We cover the use of a Radix Tree to implement the router for our web server. We also cover sending and reading static files as well. We cover the use of a BufWriter and BufReader to handle reading and writing to the socket rather than having to explicitly manage the buffers themselves. *Bonus:* We also make use of a colored crate to make the pid values in our terminal look a bit better.

↠ References:

Cheers! 🍻

🦀 #rust #rustlang #rustprogramming #exercises #programming
Комментарии
Автор

I've been trying to learn rust but it's challenging. Would be awesome to see you explaining things (many of which you may consider trivial) and creating videos for people starting to write code in rust. Btw I consider your videos really interesting.

larrysummer
Автор

I think it's an excellent time to create a Patreon. Your videos are outstanding, so it would be nice to have the ability to give a penny for that :)

akorchyn
Автор

Your explanation and video quality is improving. Gread job sir!

pri_yan_shu_raj
Автор

Rust binary search could return any matching entries. Historically, it's implemented so that it returns the last entry that matches, but that behavior was never stated by the documentation and is now broken. There is no equivalent of lower_bound and upper_bound in C++.

liningpan
Автор

I think you have an issue with fork-version. It would be best to break the loop after you have handled the request (child-process). Otherwise, your end up that the system will kill you since you created too many processes.

As I understand, the fork-server has to have one process (root process) that distributes work to fork-processes. Still, the worker will become a servant in the current implementation after finishing the request, and you can see it in the logs.
timestamp: 12:17
Original PID: 56713
First child 56810
Next request root: 56713 -> everything is fine
Next request root: 56810 -> Oops, served by the child
Next request : 56713 -> everything is fine
Next request: 56811 -> hello, new boy.

I understand that it's just an example for understanding rather than a source, so it's just info to be aware of.

akorchyn
Автор

The content is rich and I am learning a lot. Do you have a repository where we can see the code?

jamesamo
Автор

Is there any way to make a proxy from my phone ip? Like making my phone a proxy server.

KillerKotHD
Автор

Is the code codes available on some repository i can access?

darkpikachu_.
Автор

explanation is still not very clear but improved.

pri_yan_shu_raj
Автор

Also, it would be nice if you could link related videos. There is "View more" box to link videos when you mention them :)

akorchyn
welcome to shbcf.ru