Web Server Architectures: CS 4244: Internet Programming Dr. Eli Tilevich
Web Server Architectures: CS 4244: Internet Programming Dr. Eli Tilevich
Architectures
Logging
Security (e.g., access control)
Traffic analysis
Require centralized data structures to implement
Main Server Architectures
Multi-process (Apache on Unix)
Multi-threaded (Apache on NT/XP)
Single process event driven (Zeus, thttpd)
Asymmetric multi-process event-driven (Flash)
Multi-Process Architecture
Process 1
Accept Parse HTTP Read File or
generate content
Send Data
Connection Request
…
Process N
Accept Parse HTTP Read File or
generate content
Send Data
Connection Request
Event Dispatcher
Event Dispatcher
Helper 1 Helper N
Disk + + - (whole +
(only one server proc.
Blocking blocks)
proc.)
Memory - + + +
(separate
Cons. mem. space
per proc.)
Disk + + - (one disk +
request at a
Usage time)
Challenges of Using Threads
Need for synchronization
Deadlocks, starvation
Race conditions
Scheduling can be tricky
Challenges of Using Events
Only one process/thread is used
High latency for long running handlers
Control flow is obscure
Difficult to write, understand, and modify
Hybrid Approach
SEDA: Staged Event-Driven Architecture
SEDA: An Architecture for Well-Conditioned, Scalable
Internet Services, Matt Welsh, David Culler, and Eric
Brewer. In Proceedings of the Eighteenth Symposium on
Operating Systems Principles (SOSP-18), Banff, Canada,
October, 2001.