فهم نموذج تنفيذ Serverless
تعمّق في كيفية تشغيل دوال Serverless فعليًا: نماذج الاستدعاء، وبدء التشغيل البارد، والتزامن، والطبيعة عديمة الحالة للدوال.
فهم نموذج تنفيذ Serverless درس مجاني في Serverless Backend with AWS Lambda & API Gateway على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Serverless Backend with AWS Lambda & API Gateway، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Serverless Backend with AWS Lambda & API Gateway 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Functions as the Unit of Compute
In serverless, the function is the unit of deployment and scaling. The platform provisions compute only when an event arrives, and scales to zero when idle.
Event-Driven Invocation
Functions run in response to events — an HTTP request, a queue message, a file upload, a schedule. The event payload lands in your handler.
Synchronous vs Asynchronous
Invocations are synchronous (caller waits for the result) or asynchronous (event is queued, processed later, and retried on failure).
A Minimal Handler
A handler takes an event and returns a response — the platform manages everything around it. Run this to see it in action.
def handler(event, context):
name = event.get("name", "world")
return {"message": "Hello, " + name}
print(handler({"name": "Ada"}, None))Cold Starts
The first call on fresh capacity hits a cold start: the platform fetches code, boots a runtime, and initializes. Warm calls afterward are much faster.
Reducing Cold Start Impact
Tame cold starts by keeping packages small, picking fast-starting runtimes, and using provisioned concurrency on latency-critical paths.
Concurrency and Scaling
Each concurrent event runs in its own instance. The platform scales out automatically, so 1000 simultaneous requests can mean 1000 parallel executions.
The Execution Environment
An instance handles one request, then gets reused for the next. Code outside the handler runs once per environment — perfect for setting up shared connections.
db = connect() # runs once per warm environment
def handler(event, context):
return db.query(event["id"])Statelessness
Functions are stateless: never count on in-memory data surviving between calls, since instances come and go. Persist state in a database, cache, or object store.
Timeouts and Limits
Functions cap out on duration, memory, and payload size. Break long work into steps or another service — and note that more memory also means more CPU.
Cost Model
You pay for invocations × duration × memory. Idle functions cost nothing, which makes serverless economical for spiky or low-volume workloads.
Quick Check
Test your understanding of the serverless execution model.
Recap
Recap of the execution model: event-driven sync/async calls, cold starts you can mitigate, automatic concurrency, environment reuse, statelessness, and pay-per-use.
تعلم Serverless Backend with AWS Lambda & API Gateway مع معلم ذكاء اصطناعي — مجانًا
اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.
- الدورات
- 12
- الدروس
- 48
الأسئلة الشائعة
هل درس «فهم نموذج تنفيذ Serverless» مجاني؟
نعم — نص درس «فهم نموذج تنفيذ Serverless» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Serverless Backend with AWS Lambda & API Gateway، انتقل إلى CoddyKit PRO. تتضمن دورة Serverless Backend with AWS Lambda & API Gateway 4 دروس في المجموع.
ماذا ستتعلم في «فهم نموذج تنفيذ Serverless»؟
تعمّق في كيفية تشغيل دوال Serverless فعليًا: نماذج الاستدعاء، وبدء التشغيل البارد، والتزامن، والطبيعة عديمة الحالة للدوال. تتمرن على Serverless Backend with AWS Lambda & API Gateway مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Serverless Backend with AWS Lambda & API Gateway؟
لا تُشترط خبرة سابقة. Serverless Backend with AWS Lambda & API Gateway على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «فهم نموذج تنفيذ Serverless»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Serverless Backend with AWS Lambda & API Gateway هذا؟
نعم. كل درس في Serverless Backend with AWS Lambda & API Gateway يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- ما هي البنية عديمة الخوادم؟
- نظرة عامة على خدمات AWS الأساسية
- أول دالة Lambda باستخدام Python
- فهم نموذج تنفيذ Serverless