seda an architecture for well condi6oned scalable
play

SEDA AnarchitectureforWellCondi6oned, scalableInternetServices - PowerPoint PPT Presentation

SEDA AnarchitectureforWellCondi6oned, scalableInternetServices Ma=Welsh,DavidCuller,andEricBrewer UniversityofCalifornia,Berkeley Symposium on Operating Systems Principles (SOSP),


  1. SEDA
 An
architecture
for
Well‐Condi6oned,
 scalable
Internet
Services
 Ma=
Welsh,
David
Culler,
and
Eric
Brewer
 University
of
California,
Berkeley
 Symposium on Operating Systems Principles (SOSP), October 2001 http://www.eecs.harvard.edu/~mdw/proj/seda/ Presented by: Disha Gandhi

  2. Outline
 • Why
SEDA
??
 • What
is
SEDA
??
 • Thread
and
Event‐based
Concurrency
 • SEDA
Architecture
 • Asynchronous
I/O
Primi6ves
 • Applica6ons
and
Performance
Evalua6on
 2


  3. Mo6va6on
for
SEDA
 • Prototypical
applica6on:
web
server

 • Requirements
for
internet
services
 – Need
high
level
concurrency.
 – Handle
huge
varia6ons
in
load
(Slashdot
effect)
 – Handle
new
system
designs
to
manage
these
loads
 challenges
–
dynamic
content,
hos6ng
of
services
 on
general‐purpose
servers.
 • Well‐condi6oned
service:
simple
pipeline
 without
degrada6on
beyond
load
satura6on
 3


  4. What
is
SEDA???
 • From
Ma=
Welsh’s
PhD
work
at
Berkeley
 (2000‐2002)
 • A
design
for
highly
concurrent
server
 applica6ons
 • Combines
elements
of
both
thread
and
event‐ based
programming
 • Dynamic
resource
control
mechanisms
for
 automa6c
tuning
and
load
condi6oning

to
 handle
large
fluctua6ons
in
load
 4


  5. Thread
based
concurrency
model

 • Thread
per‐request
model
(commonly
used
design
for
 server
applica6ons)
 • Synchroniza6on
protects
shared
resources
 • OS
overlaps
computa6on
and
I/O
by
transparently
 switching
among
threads.
 • Cache/TLB
misses,
threads
scheduling,
lock
conten6on
 overheads.
 5


  6. Thread‐server

 performance
degrada6on
 • High
load
‐
high
context
 overhead.
 • Throughput
decreases
 • Response
6me
very
 high
as
task
queue
 length
increases
 • Not
good
for
 concurrency
 requirements
of
 Internet
 6


  7. Bounded
Thread
Pools
 • To
avoid
overuse
of
 But
:
 threads,
bind
the
size
of
 • is
it
fair
to
clients?
 thread
pool.
 • How
to
determine
 • Reject
addi6onal
 upper
limit?
 connec6ons.
 • Difficult
to
iden6fy
 • Common
solu6on
 internal
performance
 (Apache
etc)
 bo=lenecks.
 • Throughput,
overall
 performance
be=er
 7


  8. Pipeline
Model
Of
Computa6on
 8


  9. Event‐driven
concurrency
 • Small
number
of
threads
(typically
one
per
CPU)
 that
loop
con6nuously,
processing
events
from
a
 queue.

 • Events‐handlers
should
be
short‐lived.
 • I/O
must
be
non‐blocking.
 9


  10. Performance
 • Robust
to
load
 • Throughput
constant
 • Latency
linear.
 10


  11. Problems
with
Event‐driven
 • Scheduling
and
overhead
of
events
 • Choice
of
scheduling
algorithm
is
tailored
to
 applica6on.
 • No
principled
framework,
so
solu6ons
are
 typically
ad‐hoc,
lacking
modularity
 • “Structured
Event
queues”
to
improve
code
 modularity
and
simplify
applica6on
design.
 11


  12. Staged
Event‐Driven
Architecture
 Applica6on
decomposed
into
independent
stages
separated
by
queues.
 • Supports
massive
concurrency:

each
stage
has
own
thread
pool
 • Self‐contained
applica6on
components–
event
handler,
incoming
event
queue
 • and
thread
pool
–
clean
boundary
for
modularity/security
and
introspec6on.
(at
 cost
of
increased
latency)
 Finite
event
queues
can
provide:
 • 
 
backpressure:
blocking
on
a
full
queue
 
 
load
shedding:
dropping
events
 
 
errors
to
user,
etc.
 12


  13. Anatomy
of
a
Stage
 • Self‐contained
 applica6on
 components.
 • Applica6on‐supplied
 event
handler
 • Controller
dynamically
 adjusts
resource
 alloca6on.
 • Small
number
of
 threads
per
stage
 13


  14. Dynamic
Resource
Controller
 • Automa6cally
adapt
the
resource
usage
of
a
stage
 • based
on
observed
performance
and
demand
 Adjusts

batching
factor
to
increase
 • Adjust
number
of
threads
allocated
 throughput
while
maintaining
cache
 to
stage
based
on
actual
measured
 op6miza6on
and
task
aggrega6on
 usage
 14


  15. Using
Asynchronous
I/O
Primi6ves
 Asynchronous
socket
I/O
 • Uses
non‐blocking
I/O
 provided
by
OS
for
 services.
 Asynchronous
file
I/O
 • 
Uses
blocking
I/O
and
a
 bounded
threaded
pool.
 15


  16. Comparison
 • SEDA
based
layer:
non‐ blocking
I/O
by
OS
and
/ dev/poll
event‐driven
 mechanism
:
~constant
 I/O
bandwidth
 • Compa6bility
layer
that
 uses
blocking
sockets
 and
a
thread
pool:
 thread
thrashing
 16


  17. Sandstorm:
A
SEDA
Prototype
 • En6rely
in
java
 • Na6ve
libraries
for
non‐blocking
socket
I/O
 • Automated
memory
management
to
garbage‐collec6ng
 expired
events.
 • Each
applica6on
module
implements
a
simple
event
 handler
interface
with
a
single
method
call
which
processes
 a
batch
of
events
pulled
from
stages’s
incoming
event
 queue.
 • Run‐6me
system
and
associated
controllers
create
threads.
 • API’s
for
naming,
crea6ng
and
destroying
stages,
and
other
 func6ons.
 • Socket
and
file
I/O
mechanisms
as
standard
interfaces.
 17


  18. Haboob
:
SEDA
Web
server
 More
complicated
web
server:
10
stages,
4
for
asynchronous
socket
and
disk
I/ • O.
 • H=pParse
stage:
accept
new
client
connec6ons.
 H=pRecv
stage:
accept
HTTP
connec6on
and
request
events
and
pass
to
 • PageCache
stage
or
generate
response
directly
 PageCache:
in‐memory
Web
page
cache
using
hashtable
indexed
by
URL
 • Cachemiss:
handle
page
cache
misses,
using
asynchronus
file
I/O
to
read
from
 • disk
 H=pSend:
send
response
to
client,
sta6s6cs
gathering
 • High
modularity
 • 18


  19. Performance
Comparison
 • Throughput
stable
at
high
loads
for
all,
though
Haboob
is
the
best.
 • Apache
and
Flash
have
huge
varia6on
in
response
6me
(long
tails)
 • Haboob
has
low
varia6on
in
response
6me,
but
has
longer
average
 response
6me
 • Haboob
has
graceful
degrada6on,
apache
fairness
decline
quickly
 aker
its
limit
of
number
of
connec6ons.
 19


  20. Results:
Resource
Thro=ling
 1024
clients
repeatedly
request
dynamic
pages
with
I/O
and
computa6on
 • Apache
and
Haboob
(with
no
control)
process
all
requests,
Flash
rejects
some
due
to
 • a
bug
in
its
code.
 Haboob
controller
drops
(with
error)
if
average
response
6me
>
5
sec
 • 20


  21. Gnutella
packet
router
 • Use
of
SEDA
for
non‐tradi6onal
Internet
 services.
 • Rou6ng
packets
in

a
peer
to
peer
file
sharing
 network
 • 3
stages
in
SEDA
implementa6on:
 GnutellaServer,
GneutellaRouter
and
 Gneutellacatcher
 21


  22. Summary
 • SEDA
provides
a
framework
for
web
services
 (
handle
massive
concurrency
and
huge
 varia6ons
in
load).
 • Combined
approach
tries
to
achieve
 performance,
with
flexibility
and
ease
of
 programming.
 • SEDA
uses
dynamic
controllers
for
resource
 usage
and
scheduling
at
each
stage.

 • Robust
performance
as
per
published
results.
 22


  23. Current
state
of
SEDA
 • “a
number
of
recent
research
papers
have
demonstrated
that
the
 SEDA
prototype
(in
Java)
performs
poorly
compared
to
threaded
or
 event‐based
systems
implemented
in
C”
 • “The
most
 fundamental 
aspect
of
the
SEDA
architecture
is
the
 programming
model
that
supports
stage‐level
backpressure
and
 load
management.
Our
goal
was
never
to
show
that
SEDA
 outperforms
other
server
designs,
but
rather
that
acceptable
 performance
can
be
achieved
while
providing
a
disciplined
 apporach
to
overload
management.
Clearly
more
work
is
needed
to
 show
that
this
goal
can
be
met
in
a
range
of
applica6on
and
server
 environments.”
 • h=p://www.eecs.harvard.edu/~mdw/proj/seda/
 23


  24. Acknowledgement
 • h=p://www.eecs.harvard.edu/~mdw/proj/ seda/.
 • Previous
class
presenta6ons.
 24


Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend