- 204
- 350 248
Vagelis Prokopiou
Greece
เข้าร่วมเมื่อ 2 พ.ค. 2017
Stuff related to technology and programming.
Tips, tricks and solutions to problems I have encountered.
Extensive coverage of my favorite topics which are GNU/Linux, Rust, Drupal and JavaScript.
If you are a Windows user, I am sorry....
Tips, tricks and solutions to problems I have encountered.
Extensive coverage of my favorite topics which are GNU/Linux, Rust, Drupal and JavaScript.
If you are a Windows user, I am sorry....
Web api benchmarking: Rust (Axum) vs Rust (Hyper)
========== Axum Oha ==========
CPU: 50%
RAM: 4MB
Summary:
Success rate: 1.0000
Total: 6.8491 secs
Slowest: 0.0207 secs
Fastest: 0.0005 secs
Average: 0.0068 secs
Requests/sec: 14600.4602
Total data: 8.82 GiB
Size/request: 92.46 KiB
Size/sec: 1.29 GiB
Response time histogram:
0.002 [4826] |■■■■■
0.004 [14648] |■■■■■■■■■■■■■■■■■
0.005 [18571] |■■■■■■■■■■■■■■■■■■■■■■
0.007 [26227] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.009 [20009] |■■■■■■■■■■■■■■■■■■■■■■■■
0.011 [10094] |■■■■■■■■■■■■
0.013 [3900] |■■■■
0.015 [1245] |■
0.016 [365] |
0.018 [80] |
0.020 [35] |
Latency distribution:
10% in 0.0031 secs
25% in 0.0048 secs
50% in 0.0068 secs
75% in 0.0087 secs
90% in 0.0105 secs
95% in 0.0116 secs
99% in 0.0141 secs
Status code distribution:
[200] 100000 responses
========== Axum Wrk ==========
CPU: 50%
RAM: 6MB
Running 30s test @ localhost:3000/api/users
6 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 5.49ms 2.13ms 18.32ms 69.05%
Req/Sec 2.93k 156.41 3.30k 67.44%
525279 requests in 30.01s, 46.37GB read
Requests/sec: 17504.97
Transfer/sec: 1.55GB
========== Hyper Oha ==========
CPU: 50%
RAM: 9MB
Summary:
Success rate: 1.0000
Total: 5.4824 secs
Slowest: 0.0146 secs
Fastest: 0.0004 secs
Average: 0.0055 secs
Requests/sec: 18240.2136
Total data: 8.91 GiB
Size/request: 93.44 KiB
Size/sec: 1.63 GiB
Response time histogram:
0.001 [3526] |■■■■
0.003 [10695] |■■■■■■■■■■■■■■
0.004 [15196] |■■■■■■■■■■■■■■■■■■■■■
0.005 [22288] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.006 [23069] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.008 [14155] |■■■■■■■■■■■■■■■■■■■
0.009 [7140] |■■■■■■■■■
0.010 [2797] |■■■
0.012 [841] |■
0.013 [241] |
0.014 [52] |
Latency distribution:
10% in 0.0025 secs
25% in 0.0039 secs
50% in 0.0055 secs
75% in 0.0069 secs
90% in 0.0083 secs
95% in 0.0091 secs
99% in 0.0108 secs
Status code distribution:
[200] 100000 responses
========== Hyper Wrk ==========
CPU: 50%
RAM: 5.5MB
Running 30s test @ localhost:3001/api/users
6 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.37ms 1.70ms 14.41ms 69.36%
Req/Sec 3.68k 231.89 4.20k 63.28%
659951 requests in 30.00s, 58.86GB read
Requests/sec: 21995.96
Transfer/sec: 1.96GB
CPU: 50%
RAM: 4MB
Summary:
Success rate: 1.0000
Total: 6.8491 secs
Slowest: 0.0207 secs
Fastest: 0.0005 secs
Average: 0.0068 secs
Requests/sec: 14600.4602
Total data: 8.82 GiB
Size/request: 92.46 KiB
Size/sec: 1.29 GiB
Response time histogram:
0.002 [4826] |■■■■■
0.004 [14648] |■■■■■■■■■■■■■■■■■
0.005 [18571] |■■■■■■■■■■■■■■■■■■■■■■
0.007 [26227] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.009 [20009] |■■■■■■■■■■■■■■■■■■■■■■■■
0.011 [10094] |■■■■■■■■■■■■
0.013 [3900] |■■■■
0.015 [1245] |■
0.016 [365] |
0.018 [80] |
0.020 [35] |
Latency distribution:
10% in 0.0031 secs
25% in 0.0048 secs
50% in 0.0068 secs
75% in 0.0087 secs
90% in 0.0105 secs
95% in 0.0116 secs
99% in 0.0141 secs
Status code distribution:
[200] 100000 responses
========== Axum Wrk ==========
CPU: 50%
RAM: 6MB
Running 30s test @ localhost:3000/api/users
6 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 5.49ms 2.13ms 18.32ms 69.05%
Req/Sec 2.93k 156.41 3.30k 67.44%
525279 requests in 30.01s, 46.37GB read
Requests/sec: 17504.97
Transfer/sec: 1.55GB
========== Hyper Oha ==========
CPU: 50%
RAM: 9MB
Summary:
Success rate: 1.0000
Total: 5.4824 secs
Slowest: 0.0146 secs
Fastest: 0.0004 secs
Average: 0.0055 secs
Requests/sec: 18240.2136
Total data: 8.91 GiB
Size/request: 93.44 KiB
Size/sec: 1.63 GiB
Response time histogram:
0.001 [3526] |■■■■
0.003 [10695] |■■■■■■■■■■■■■■
0.004 [15196] |■■■■■■■■■■■■■■■■■■■■■
0.005 [22288] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.006 [23069] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.008 [14155] |■■■■■■■■■■■■■■■■■■■
0.009 [7140] |■■■■■■■■■
0.010 [2797] |■■■
0.012 [841] |■
0.013 [241] |
0.014 [52] |
Latency distribution:
10% in 0.0025 secs
25% in 0.0039 secs
50% in 0.0055 secs
75% in 0.0069 secs
90% in 0.0083 secs
95% in 0.0091 secs
99% in 0.0108 secs
Status code distribution:
[200] 100000 responses
========== Hyper Wrk ==========
CPU: 50%
RAM: 5.5MB
Running 30s test @ localhost:3001/api/users
6 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.37ms 1.70ms 14.41ms 69.36%
Req/Sec 3.68k 231.89 4.20k 63.28%
659951 requests in 30.00s, 58.86GB read
Requests/sec: 21995.96
Transfer/sec: 1.96GB
มุมมอง: 942
วีดีโอ
Rust: When to use Result and when to use Option
มุมมอง 34511 หลายเดือนก่อน
#rustlang #rust #programming #functionalprogramming
What Can I Invest In? Exploring Investment options
มุมมอง 102ปีที่แล้ว
#investing #stocks #stockmarket #financialfreedom #dividends #portfolio #wealthbuilding #retirement #realestate #cryptocurrency #passiveincome #trading #personalfinance #moneymanagement #riskmanagement #investmentstrategies #stockpicks #assetallocation #financialgoals #investmentadvice
Γιατί να επενδύσω;
มุมมอง 73ปีที่แล้ว
#Investing #financialfreedom #wealthbuilding #personalfinance #stocks #realestateinvesting #passiveincome #retirementplanning #investmenttips #dividendinvesting #valueinvesting #investmentstrategies #riskmanagement #longterminvesting #financialeducation
A tribute to Rust (and all the strongly typed languages)
มุมมอง 188ปีที่แล้ว
A tribute to Rust (and all the strongly typed languages)
Adding multithreading to youtube-dl through Rust
มุมมอง 561ปีที่แล้ว
Adding multithreading to youtube-dl through Rust
Web api benchmarking: Python (FastAPI) vs Rust (Axum) with database (Dockerized)
มุมมอง 2.8Kปีที่แล้ว
Web api benchmarking: Python (FastAPI) vs Rust (Axum) with database (Dockerized)
How Rust can save you a ton of integration tests (and bugs)
มุมมอง 610ปีที่แล้ว
How Rust can save you a ton of integration tests (and bugs)
Why deal with local installations of services (when we have Docker)?
มุมมอง 117ปีที่แล้ว
Why deal with local installations of services (when we have Docker)?
Rust: Actix-web to Axum port: Shared mutable state and the tale of 2 Mutexes
มุมมอง 1.1Kปีที่แล้ว
Rust: Actix-web to Axum port: Shared mutable state and the tale of 2 Mutexes
Rust: Matching on (custom) enum discriminant values through From implementations
มุมมอง 363ปีที่แล้ว
Rust: Matching on (custom) enum discriminant values through From implementations
Rust Serde: Simplifying types through attributes
มุมมอง 509ปีที่แล้ว
Rust Serde: Simplifying types through attributes
Rust Yew: Interfacing with js libraries (Colyseus)
มุมมอง 527ปีที่แล้ว
Rust Yew: Interfacing with js libraries (Colyseus)
Rust Yew: Interfacing with js libraries
มุมมอง 1.1K2 ปีที่แล้ว
Rust Yew: Interfacing with js libraries
Safety (#3): C# && Java vs Rust (Parallelism and mutation)
มุมมอง 6902 ปีที่แล้ว
Safety (#3): C# && Java vs Rust (Parallelism and mutation)
Channel announcements: FFI && Memberships
มุมมอง 1382 ปีที่แล้ว
Channel announcements: FFI && Memberships
Rust is taking the programming world by storm
มุมมอง 6232 ปีที่แล้ว
Rust is taking the programming world by storm
Web api benchmarking: Java (Vert.x) vs Rust (actix-web) #4
มุมมอง 1.6K2 ปีที่แล้ว
Web api benchmarking: Java (Vert.x) vs Rust (actix-web) #4
Web api benchmarking: Some clarifications #2
มุมมอง 3472 ปีที่แล้ว
Web api benchmarking: Some clarifications #2
Web api benchmarking: Java (Vert.x) vs Rust (actix-web) #3
มุมมอง 1.7K2 ปีที่แล้ว
Web api benchmarking: Java (Vert.x) vs Rust (actix-web) #3
Web api benchmarking: Java (Vert.x) vs Rust (actix-web) #2
มุมมอง 1.2K2 ปีที่แล้ว
Web api benchmarking: Java (Vert.x) vs Rust (actix-web) #2
Web api benchmarking: JavaScript Bun runtime vs Rust actix-web
มุมมอง 1.1K2 ปีที่แล้ว
Web api benchmarking: JavaScript Bun runtime vs Rust actix-web
unsaferust.org and thoughts on the (unsafe Rust) subject
มุมมอง 3342 ปีที่แล้ว
unsaferust.org and thoughts on the (unsafe Rust) subject
why do not you benchmark latest actix-web vs axum?
Because it's been a while since I made the video.
you're right but it's also recommended to invert variables and values to make sure you don't get theses errors. So instead of doing : if $order = 1 , you do : if 1 = $order, you will get the error. It's only useful in that case, if you were to compare two variables, it would not show an error. It's also a good practice to use the === instead of == in PHP.
Thanks man. I inherited the codebase. Your points though are valid and useful.
They literally inflated his stats when he averaged 37 in 1987😂
Would be interesting to see the comparison with current versions. .NET Core had quite a bit of optimizations since version 6.
That's a good idea. Thanks man.
@@Vagelis_Prokopiou My assumption is that in real world scenarious .NET Core can potentially be even sometimes faster when more advanced optimizations are applied, like code generators, like Spans, like FrozenDictionary etc. Not saying that it's not possible to do with Rust, but some things, like for example Regex and Json code generators is something that you likely won't try to manually implement if it's not provided via the standard means already.
Hi man. Maybe. But my personal preference is Rust. I have used both languages and the feeling of robustness I get from Rust is golden. And it is backed up by the result.
@@Vagelis_Prokopiou Sure, just saying that MS is putting a lot of effort into optimizing .NET Core for web APIs usage scenarios. When in really performance critical scenarios we now have .NET Core Minimal APIs, we have data structures optimized for reads (like FrozenDictionary), we have fast stack-based Spans which are now used for common substring operations, we have code generators and so on. Rust is not as widely used for the web API scenarios, so it may not have the same kind of tooling as of yet (correct me if I am wrong).
Well, I am kind of sceptical, since .net core still has the overhead of the runtime and the GC. Rust uses LLVM which is very good at optimizing code. In any case, a benchmark can provide insight. If you want you get setup a GitHub repo with some API, and I will reproduce it in Rust. And then we can check.
Wow!!!!!
what a crock of shit
Hello, more of & ty 😂
Thank you for this comparison, sir.
I did similar benchmark axum-hyper (was hyper below version 1.0) - using ab test utils, hyper was faster 2-3ms per request. I use hyper/tokio pair ever since, and never look back. Also - custom router is not that hard to add to hyper server, so You should not be confined to single endpoint server.
Palikari eise.
I say use Option when there is only one obvious reason something could fail. If there are multiple reasons something would fail then a Result is best.
Alright, I’m going to rewrite my api to rust😂
It will be the best decision of your life.
@@Vagelis_Prokopiou It would make sense tbh, because my API's serves as a Backend for multiplayer game, where speed is obviously cruical. Thanks for great comparison, I will start re-writing my API asap
going on x264 means it gets rendered on the cpu. thats not efficient but can do desktop or browser, or even gaming if you had a nasa computer, the reason youve got the same error, is to my suspect just the fact that youre running omn a ryzen and not an intel chip, aka youre still missing out on the amd drivers. note that the H before 264 or 265 means its hardware based, aka it uses your gpu, while x.264 means its the cpu being used, so changing your setting from hardware to software mode, if youre on intel like me, wont solve the issue, since you changed from rendering on your extremely fast gpu to a crap output by the cpu (there is a reason we have different processing units for different tasks.) So you're essentially doing a workaround with the cost of the output being at risk of getting crappy.
THANK YOU!!!
Awesome video man.... just what i was looking for to the point. if possible can you show the other way around as well...👍
I had to get here
Thank you so much! It works flawlessly on Linux Mint
Cool. Thanks for the feedback
thank you for the code. I chunked out the pieces needed to fix my install.. help for anyone with questions I had done a sudo apt-get purge phpmyadmin to pull phpmyadmin out so I could use the install commands from this to setup.
Τhanks for the feedback man.
Thanks the video was helpful. 🔥
Thanks for the feedback man.
thanks!
You are welcome man.
Hey, you should consider restricting rust to a single thread as well as Bun.
🤔 I am not sure you would ever do that if you used Rust, so why do it in the benchmark?
what if we test with real network call .If we are using localhost it doesn’t show the actual results !example aws api server with Asia region and benchmark from the europe or USA region.
I don't think we want the overhead of the network. We want pure code performance. In any case, the setup is the same for both APIs, so we have the same comparison baseline.
merci beaucoup Ca a bien marché Merciii
Thank you.
Does Tiberius work? I tried it but for some, my python implementation works but rust with tiberius not
This video is the same as trying to compare wood to air, what a waist of time! Stick to "hello world" apps, they won't error if you're not a complete tool...
Thanks for your valuable input.
haha suck python
I tried increasing Postgres' max_connections and FastAPI's results improved a lot. database: command: postgres -c 'max_connections=10000'
Did you also tested the Rust API with the max connections config?
@@Vagelis_Prokopiou After increasing the number of Gunicorn workers as well, Rust is still about 5x - 7x faster than FastAPI on my computer. This result seems more reasonable to me.
@@tdd44 Rust is expected to be faster. The issue is that even with the db overhead, the difference is substantial.
Thank you
Thank you too man.
Was it actual findings or some false positive that you found during the video ?
found out in the #2 video, phenomenal!
BULLSHIT,, there's a new Video of PHIL JACKSON exposing how MICHAEL JORDAN concentrated HARD on winning the SCORING TITLE every season, so he did care about STATS ......... Of course no player will every admit that they are trying to pad their stats, but its not a reality, because they all do it to some degree, including JORDAN
Can you provide the link?
@@Vagelis_Prokopiou th-cam.com/video/bXSHGnb4YoU/w-d-xo.html
@@Vagelis_Prokopiou th-cam.com/video/zWLsa-TEs2s/w-d-xo.htmlsi=tqL6He_SiG7AClQS
such bullshit 😂
@@Vagelis_Prokopioujust search up Phil Jackson on Michael Jordan in conversation with John Salley live talks Los Angeles LiveTalksLA and go to 2:09-3:00 and you’ll hear Phil Jackson admit Michael Jordan was worried about winning scoring titles
Great video, It was precisely what I was looking for.
Thank you Marcelo.
This isn't a fair comparison. Laravel is a massive framework which gets processed per request. I doubt actix-web is equally bloated. Granted, I would still expect Rust to win, but a fairer comparison would have been if you wrote the database code from scratch in PHP.
Hi @YourComputer. Thanx for your feedback. The objective of this benchmark was not fairness. The objective was to compare these 2 off the shelf solutions and help "you" make educated decisions, based on the comparison data, going forward.
@@Vagelis_Prokopiou Educated decisions tend to require fairness (albeit, decisions are often the result of politics).
I believe the point you raise is not valid because no one in the industry hand writes his db related code when he chooses to use Laravel. But anyone is entitled to his opinion and everyone can reach his own conclusions. So your feedback is of course welcome.
@@Vagelis_Prokopiou And yet, you likely wrote your own db related code for rust, which would have been a very trimmed-down version in comparison to Laravel. If we're simply speaking within the context of web APIs (especially if the decision is not up to the developer, which many times is not up to the developer), assuming that everyone would use Laravel for web API development for PHP would be false. Since all you were doing for Laravel was filling an array with 100 instances of `User`s and echoing the array in JSON format, I decided to do the same but without bloat of Laravel, and even ran it through PHP's built-in server. Running the same benchmark I get: Concurrency Level: 1000 Time taken for tests: 2.247 seconds Complete requests: 50000 Failed requests: 0 Total transferred: 452000000 bytes HTML transferred: 443850000 bytes Requests per second: 22248.29 [#/sec] (mean) Time per request: 44.947 [ms] (mean) Time per request: 0.045 [ms] (mean, across all concurrent requests) Transfer rate: 196410.66 [Kbytes/sec] received
@@YourComputer Nice 🙂 My objections are: 1) I did not write any db related code for Rust. The db code is provided off the shelf. 2) The issue is not what I am doing with Laravel. After all, I am doing the same thing for Rust. The issue is what is the performance of Lavarel under the given conditions. 3) Your setup is not Laravel, so it is irrelevant to this specific benchmark. 4) No one runs a PHP application through the PHP's build-in server in production. Therefore, your setup is irrelevant to this specific benchmark. Apart from that, thanx for the benchmark info. It is interesting indeed.
Rust, C, etc, will always be faster than Java when comparing pure "low level " operations. The question is that in real world applications, in a world of multi-core computation, that performance difference it's basically irrelevant,except for very specific high performance applications. For big applications is very important to consider things other than language: toolchain; ecosystem (number and maturity of libraries, etc), ease of coding, programmers availability, etc
Hi @rallealyt. Thanx for your feedback. Yes, I agree. A lot of things must be considered before commiting to a certain solution.
Sounds good to me! :)
git add . git commit write multiline commit messages hit Esc to escape :wq to write and quit git push
When you're using `oha`, you have `--latency-correction`, but that flag is ignored unless you set `-q {queries per second}`. Consequently, I suspect this benchmark suffers from the coordinated omission problem. What do you think?
Hi Luke. Nice observation. I don't have any opinion on this. I have to research it.
Ευχαριστω πολυ για το tutorial! <3
Να σαι καλά :-)
thank you!
Is Unit Test same like blackbox or whitebox testing ? can we do it when system still running without maintenance on system ?
Hi man. Whatever testing, should be done before the code reaches production. Production is never disrupted, apart from the deployments.
Thanks a lot for the detailed benchmark <3 We appreciate your efforts , I'm wondering how much NET 7 would improve in cpu & memory usage compared to NET 6
thanks for the detailed comparison <3
Glad it was helpful man.
For benchmark u need disable logging, its take a lot of time of cpu and scheduler
sir, why bcrypt so hard to bruteforce ? i try to understand how bycrypt works but still i don't get it. can you explain how it works ? that will be helpfull thanks
Hi man. You can check the paper by the creators themselves. It is pretty descriptive. www.openbsd.org/papers/bcrypt-paper.pdf
@@Vagelis_Prokopiouthanks a lot sir, this paper is very helpfull for my kriptonalisis study 👍
you sloved my problem , thanks a lot.
You're welcome man
I already expected the outcome of this even before watching the video, since compiled language will always be better than interpreted language, and Rust is one of the fastest compiled lang, while Python is probably the worst and slowest interpreted lang, But it still shocking to see this bloodbath 🤣🤣 I'm thinking PHP 8.2 even without swoole could still massacre python, Now Im curious to see a benchmark between PHP (with swoole) vs NodeJS
Your guinea pig is indeed very awesome, thankyou for sharing :D
Thank you too for the feedback 🙂
Thank you, I didn't realized you had to escape the curly brackets ;D.
Happy to help Dario 🙂
that's a lot of json encoding. i gues it's normal for servers to do that but i'm worried you're benching that instead of the server
Thanks for the feedback Farzher. Do you have some other workload in mind that would be more appropriate?
@@Vagelis_Prokopiou yeah, simply make an endpoint that returns Hello World. that way you're only benching the web server framework
The issue is that I don't want to bench web frameworks, but language efficiency for a given workload. It could be something non web related for that matter. I just chose a web related workload because the web is such a fundamental "thing". Therefore I don't think that what you propose can provide us with enough valuable feedback. Maybe calculating something else or rendering something could be a viable alternative.
@@Vagelis_Prokopiou yeah idk depends. if you're doing light work like serving a cached file/string then that's basically equal to Hello World and i just want to see how much overhead the web framework it using. how many concurrent requests will it let me do, with how much latenchy
@@stephenkamenar Well, that's a different comparison. I am doing "languages" comparisons so far, but you want "web frameworks" comparisons. I will make a video describing this difference and asking for feedback. If I get enough feedback I will do the "web frameworks" comparisons too.
is there a commit for this code?
Hi man. I haven't to check to tell you the truth. I think I have a repo for it.