62
loading...
This website collects cookies to deliver better user experience
Dave works for an eCommerce start-up, one day, he was given a task to find out if the micro-services which he has been writing is scalable and optimized. The marketing team wants to run a big flash sale for a couple of days and expects a massive influx of online traffic to the website and the mobile app.
Well, you could run this benchmark on any compatible system. Benchmarks make sense as long as you test them on the same hardware environment.
ab -k -c 350 -n 5000 http://<rpi ip>:3000/
Dave is also a champion chess player and, he has been challenged to play chess with not one but ten different players all at once! He has essentially two approaches
Approach 1- Dave decides to play one player at a time* and, if the average time per game is 10minutes (assuming other players are making quick decisions like our champ!), even then it takes 10 mins X 10 players = at least 100 minutes (i.e. over 1.6 hours)
Approach 2 - Dave plays all players at once! How is that possible? Every time an opponent takes time to think about their next move, Dave moves on to the next player and the next. It continues till the last move of the last remaining game.
Now swap the crazy madness of a guy playing chess with multiple people with a RESTful service. The opponents are external DB or service/APIs with which the RESTful service will communicate. Yes, that's how Sync & Async works and, since we are dealing with computers and not humans, they always perform actions as instructed!
A few salient features FastAPI brings like Automatic data model documentation, JSON validations, serialization and more. One could achieve the same results in the other two frameworks by writing more code as they are minimalistic by design.
If you are starting a new project and you are willing to give GoLang a try. Fiber is a great place to start and, there are many frameworks to choose from