Course contentsShow
← Cloud and Infrastructure
Lesson 462 of 2,9899. Serverless ComputeFree lesson

Event-Driven Execution Model

Understand how functions are triggered by events rather than running continuously.

Event-Driven Execution Model

What you'll learn: How serverless functions respond to events instead of running continuously like traditional servers.

How Functions Wake Up When Needed

In traditional computing, servers run 24/7 waiting for work—like a store that stays open all night even when no customers visit. The event-driven execution model works differently: functions only run when something specific happens, like a motion sensor that turns on lights only when it detects movement.

What Triggers a Function?

An event is any action or occurrence that signals your function to execute. Common event sources include:

  • HTTP requests – A user visits a URL
  • File uploads – A new image appears in storage
  • Database changes – A record is updated
  • Queue messages – A task is added to a queue
  • Scheduled times – A cron-like timer fires

When an event occurs, the cloud provider automatically:

  1. Provisions compute resources
  2. Loads your function code
  3. Executes your function with event data
  4. Tears down resources when complete

The Cost and Efficiency Advantage

Because functions only consume resources during execution (often milliseconds), you pay only for actual compute time. There's no idle time where servers sit waiting for work. This is fundamentally different from the traditional model where you provision capacity based on peak load and pay continuously.

The Stateless Nature

Each function execution is independent and stateless—it starts fresh, processes the event, and exits. Functions don't "remember" previous executions unless you store state externally (in databases, caches, or storage services).

Key Takeaway: The event-driven execution model means functions are triggered by specific events and run only when needed, consuming resources for seconds or milliseconds rather than 24/7, making them cost-efficient and automatically scalable.