FastAPI سب سے تیز Python frameworks میں سے ایک ہے کیونکہ یہ Starlette (ایک ہلکا ASGI framework) پر بنایا گیا ہے اور async-native ہے، بہت سے بیک وقت I/O-bound requests کو مؤثر طریقے سے سنبھالتا ہے۔ لیکن اسے تیز رکھنے کے لیے async کو صحیح طریقے سے استعمال کرنا ضروری ہے — سب سے عام غلطی event loop کو block کرنا ہے۔
یہ تیز کیوں ہے
✓ ASGI + Starlette — a modern async foundation (vs older WSGI sync frameworks)
✓ Async-native — one process handles thousands of concurrent I/O-bound requests
by overlapping wait times, instead of one-at-a-time
✓ Pydantic v2 — validation/serialization core is now in Rust (very fast)
✓ Minimal overhead per request
Async model اہم ہے: جب ایک request کسی database query یا API call کا انتظار کرتا ہے، تو سرور دوسری requests کو سنبھالتا ہے — I/O-bound workloads کے لیے زیادہ throughput دیتا ہے۔
