cs161 2004 Lecture 10: Event/Thread Hybrids Assignment 2 Execute helper from current dir, not explicit pathname You should be able to use multiple helpers. (give a switch?) What is "Well-conditioned"? Throughput reaches a maximum and stays there Delay increases linearly with load (queuing delay) Close-loop vs Open-loop services. Fairness (extra delay impacts everyone equally) Strawmen: Threaded (discussion implies kernel) TLB, Scheduling, Locks - Virtualization costs Throughput plummets as load increases (and latency spikes) Bounded threading Fairness is difficult (But this is a TCP artifact) Request per thread means difficult to act globally (balancing, shedding) Event-driven Hard to ensure you don't block - page faults, GC Event scheduling is ad-hoc SEDA goals: Massive concurrency Well-conditioned Introspection Self-tuning Draw pictures, explain architecture. (application picture (fig 5)) (single stage (fig 6)) What does this arch buy you? Explicit queues, stages allow better decision making Individual (dynamic) thread pools per stage Control batching factor Don't worry (much) about blocking Debugging and performance tuning, understanding Dynamic thread pool size Add threads if queue grows too much (up to a maximum) Remove idle threads Will adding threads always help? Will removing idle threads matter? Isn't there a maximal size that makes sense? Why more or less? Batching Process multiple events in a single stage with a single invocation When does this help? (cache effects, simultaneous disk reqs) Java implementation GC helps build good programs: collect events, buffers Native code for asynch sockets Files accessed with thread pools Only one thread for any single file at a time (fits their model?) This is NIO Haboob: web server (vs Apache, Flash) Throughput on cached pages: small constant diff, why? probably select(), maybe batching? (Why don't they explain?!) Fairness: apache is bad, why? 150 client limit, everyone else waits Response time distribution (take time to explain CDF) THIS IS A TRAVESTY. Flash is penalized for using select() and easy fix What about SEDA could/would help it win this? Grace under load: SEDA can do interesting load shedding It's not clear this is a good idea when all stages are about equal Flash does "as well" by mistake (or is it a msitake?) Gnutella Packet router Open-loop Appears to be "packets" inside a TCP stream Protection from slow sockets read arbitrarily fast, write is slow, too much mem. close connections with a big queue. why not let the back pressure propagate? hard with SEDA? GC doesn't mean you never worry about memory How will this impact your mail servers? (must not read in big mails before send) No class on Friday, go to Bjarne Stroustroup's talk at 3pm