Skip to content

用 libc 模拟一个相当于 mio 简单版的实现

License

Notifications You must be signed in to change notification settings

artshell/rust-epoll-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-epoll-example

Start with cargo run. Then, you can send HTTP requests to the server at http://127.0.0.1:8000.

Try to send many requests and look at the log of the server, to see how requests are handled concurrently, although we're only running one thread.

For example, you can send a file:

while true; do curl --location --request POST 'http://localhost:8000/upload' \--form 'file=@/home/somewhere/some_image.png' -w ' Total: %{time_total}' && echo '\n'; done;

If you run this script multiple times at once, you'll see logs of the sort:

...
requests in flight: 6
...

and you'll also see, that the response times stay constant, which means we're handling multple requests concurrently.

About

用 libc 模拟一个相当于 mio 简单版的实现

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%