Monday, September 29, 2008

Capriccio: Scalable Threads for Internet Services

Capriccio is a user-level threading library for Linux. It attempts to simpify programming for high-concurrency servers while adding scalability and flexibility through the use of user-level threads, asynchronous I/O interface, linked stacks, and a resource-aware scheduler. The advantages of user-level threads over kernel threads are low-overhead synchronization, no kernel crossings for mutex acquire and release, and efficient memory management, although as of the paper's writing Capriccio only supports single-CPU threading.

Extensive compiler support is necessary for the linked stacks and scheduler; the result of the call-graph and checkpoint scheme is non-contiguous dynamically-sized stacks that can have their amounts of wasted stack space adjusted by the user. The resource-aware scheduler draws inspiration from the event-based handler system. Capriccio uses a blocking graph to automate scheduling at run-time; it maintains queues for each blocking graph node and dynamically decides which nodes' threads should run next based on current available resources. The bandwidth of Apache for 100+ clients increases when used with Capriccio, and thread-based Knot performs comparably to the event-based Haboob web server.

No comments: