Capriccio: Scalable Threads for Internet Services ( by Behren, Condit, Zhou, Necula, Brewer ) Presented by Alex Sherman and Sarita Bafna.

Slides:



Advertisements
Similar presentations
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley.
Advertisements

Chess Review May 8, 2003 Berkeley, CA Compiler Support for Multithreaded Software Jeremy ConditRob von Behren Feng ZhouEric Brewer George Necula.
1 SEDA: An Architecture for Well- Conditioned, Scalable Internet Services Matt Welsh, David Culler, and Eric Brewer Computer Science Division University.
1 Capriccio: Scalable Threads for Internet Services Matthew Phillips.
SEDA: An Architecture for Well- Conditioned, Scalable Internet Services Matt Welsh, David Culler, and Eric Brewer Computer Science Division University.
Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services Matt Welsh, David Culler, and Eric Brewer Computer Science Division University of.
CS 623 Lecture #9 Yen-Yu Chen Utku Irmak. Papers to be read Better operating system features for faster network servers.Better operating system features.
Precept 3 COS 461. Concurrency is Useful Multi Processor/Core Multiple Inputs Don’t wait on slow devices.
Capriccio: Scalable Threads for Internet Services (von Behren) Kenneth Chiu.
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, George Necula and Eric Brewer University of California at Berkeley.
Capriccio: Scalable Threads For Internet Services Authors: Rob von Behren, Jeremy Condit, Feng Zhou, George C. Necula, Eric Brewer Presentation by: Will.
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
3.5 Interprocess Communication
Why Events Are a Bad Idea (for high-concurrency servers) Author: Rob von Behren, Jeremy Condit and Eric Brewer Presenter: Wenhao Xu Other References: [1]
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Multithreading Allows application to split itself into multiple “threads” of execution (“threads of execution”). OS support for creating threads, terminating.
Silberschatz, Galvin and Gagne ©2011Operating System Concepts Essentials – 8 th Edition Chapter 4: Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Threads, Thread management & Resource Management.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services Presented by Changdae Kim and Jaeung Han OFFENCE.
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley.
CS333 Intro to Operating Systems Jonathan Walpole.
Lecture 5: Threads process as a unit of scheduling and a unit of resource allocation processes vs. threads what to program with threads why use threads.
5204 – Operating Systems Threads vs. Events. 2 CS 5204 – Operating Systems Forms of task management serial preemptivecooperative (yield) (interrupt)
Multithreaded Programing. Outline Overview of threads Threads Multithreaded Models  Many-to-One  One-to-One  Many-to-Many Thread Libraries  Pthread.
Department of Computer Science and Software Engineering
CSE 60641: Operating Systems Next topic: CPU (Process/threads/scheduling, synchronization and deadlocks) –Why threads are a bad idea (for most purposes).
Processes & Threads Introduction to Operating Systems: Module 5.
1 Cooperative Task Management without Manual Stack Management or Event-driven Programming is not the Opposite of Threaded Programming Atul Adya, Jon Howell,
Thread basics. A computer process Every time a program is executed a process is created It is managed via a data structure that keeps all things memory.
Capriccio: Scalable Threads for Internet Service
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
Holistic Systems Programming Qualifying Exam Presentation UC Berkeley, Computer Science Division Rob von Behren June 21, 2004.
Threads versus Events CSE451 Andrew Whitaker. This Class Threads vs. events is an ongoing debate  So, neat-and-tidy answers aren’t necessarily available.
1 Why Events Are A Bad Idea (for high-concurrency servers) By Rob von Behren, Jeremy Condit and Eric Brewer (May 2003) CS533 – Spring 2006 – DONG, QIN.
CS533 Concepts of Operating Systems Jonathan Walpole.
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Paper Review of Why Events Are A Bad Idea (for high-concurrency servers) Rob von Behren, Jeremy Condit and Eric Brewer By Anandhi Sundaram.
Operating System Concepts
Chapter 4: Threads 羅習五. Chapter 4: Threads Motivation and Overview Multithreading Models Threading Issues Examples – Pthreads – Windows XP Threads – Linux.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapter 4 – Thread Concepts
Capriccio:Scalable Threads for Internet Services
Capriccio : Scalable Threads for Internet Services
Threads vs. Events SEDA – An Event Model 5204 – Operating Systems.
Why Events Are A Bad Idea (for high-concurrency servers)
Processes and Threads Processes and their scheduling
Chapter 4 – Thread Concepts
CS399 New Beginnings Jonathan Walpole.
Presenter: Godmar Back
Capriccio – A Thread Model
Chapter 4: Threads.
Why Threads Are A Bad Idea (for most purposes)
Why Events Are a Bad Idea (for high concurrency servers)
Why Threads Are A Bad Idea (for most purposes)
Why Threads Are A Bad Idea (for most purposes)
CS 5204 Operating Systems Lecture 5
Presentation transcript:

Capriccio: Scalable Threads for Internet Services ( by Behren, Condit, Zhou, Necula, Brewer ) Presented by Alex Sherman and Sarita Bafna

Main Contribution Capriccio implements a scalable user- level thread package as an alternative to event-based and kernel-thread models. The authors demonstrate scalability to 100,000 threads and argue the model should be a more efficient alternative for Internet Server implementation

Key Features Scalability with user-level threads –Cooperative scheduling –Asynchronous disk I/O –Efficient thread operations - O(1) Linked stack management Resource-aware scheduling

Outline Related Work and “Debate” Capriccio Scalability Linked Stack Management Resource-Aware Scheduling Conclusion

Related Work Events vs. Threads (Ouserhout, Laura and Needham, Adya, SEDA) User-level thread packages (Filaments, NT Fibers, State Threads, Scheduler Activations) Kernel Threads (NTPL, Pthreads) Stack Management (Lazy Threads)

Debate – event-based side Event-based arguments by Ousterhout (Why threads are bad?, 1996) –Events are more efficient (context switching, locking overheads with threads) –Threads - hard to program (deadlocks, synchronization) –Poor thread support (portability, debugging) Many event-based implementation (Harvest, Flash, SEDA)

Debate – other arguments Neutral argument by Lauer and Needham (On the duality of OS system structures, 1978) Pro-thread arguments by Behren, Condit, Brewer (Why events are bad?, 2003) –Greater code readability –No “stack-ripping” –Slow thread performance - implementation artifact –High performance servers more sensitive to scheduling

Why user-level threads? Decoupling from the OS/kernel –OS independence –Kernel variation –Address application-specific needs Cooperative threading – more efficient synchronization Less “kernel crossing” Better memory management

Implementation Non-blocking wrappers for blocking I/O Asynchronous disk I/O where possible Cheap synchronization Efficient O(1) thread operations

Benchmarks (left) Capriccio scales to 100,000 threads (right) Network I/O throughput with Capriccio only has 10% overhead over epoll With asynchronous I/O disk performance is comparable in Capriccio vs. other thread packages

Disadvantages of user-level threads Non-blocking wrappers of blocking I/O increase kernel crossings Difficult to integrate with multiple processor scheduling

Dynamic Linked Stacks Problem: Conservative stack allocations per thread are unsuitable for programs with many threads. Solution: Dynamic stack allocation with linked chunks alleviates VM pressure and improves paging behavior. Method: Compile-time analysis and checkpoint injection into the code.

Weighted Call Graph Each node is a call site annotated with the maximum stack space for that call. Checkpoints must be inserted at each recursive frame and well-spaced call sites. Checkpoints determine whether to allocate a new stack chunk.

Challenging cases Function pointers are only determined at run-time. External function calls require conservative stack allocation.

Apache Benchmark Given 2 KB “max-path” only 10.6% call sites required check-pointing code. Overhead in the number of instructions was 3-4%.

Resource-Aware Scheduling Key idea: View an application as a sequence of stages separated by blocking points. Method: Track resources (CPU, memory, file descriptors) used at each stage and schedule threads according to resources.

Blocking Graph Tracking CPU cycles and other resource usage at each edge and node. Threads are scheduled so that for each resource, utilization is increased until maximum throughput and then throttled back.

Pitfalls Maximum capacity of a particular resource is difficult to determine (e.g: internal memory pools) Thrashing is not easily detectable. Non-yielding threads lead to unfairness and starvation in cooperative scheduling. Blocking graphs are expensive to maintain (for Apache stack trace overhead is 8% of execution time).

Web Server Performance Apache on a 4x500 MHz Pentium server has 15%higher throughput with Capriccio.

Conclusion Capriccio demonstrates a user-level thread package that achieves –High scalability –Efficient stack management –Scheduling based on resource usage Drawbacks –Performance not comparable to event-based systems –High overhead in stack tracing –Lack of sufficient multi-processor support

Future Work Extending Capriccio to work with multiple processors Reducing the kernel crossings with batching asynchronous network I/O Disambiguate function pointers in stack allocation Improving resource-aware scheduling –Tracking variance in resource usage –Better detection of thrashing