streamflex
play

StreamFlex High-throughput Stream Programming in Java Jesper Spring - PowerPoint PPT Presentation

StreamFlex High-throughput Stream Programming in Java Jesper Spring Jean Privat, Rachid Guerraoui, Jan Vitek High Throughput Stream Programming in Java Realtime and Java The Real-time Specification for Java is being used today in real


  1. StreamFlex High-throughput Stream Programming in Java Jesper Spring Jean Privat, Rachid Guerraoui, Jan Vitek

  2. High Throughput Stream Programming in Java Realtime and Java The Real-time Specification for Java is being used today in real world programs... ...but it is large, complex and error-prone A simpler programming model for a particular class of applications will help increase adoption Focus on streaming-style concurrent and real-time applications

  3. High Throughput Stream Programming in Java Challenges Minimal stream processing requirements: keep the data moving ⇒ no buffering respond instantaneously ⇒ no messages dropped

  4. High Throughput Stream Programming in Java StreamFlex Programming abstraction for high-throughput stream processing: sub-millisecond response times without interference from non-time critical activities familiar programming model that reuses standard libraries safe, non-blocking interaction with plain Java type safe while remaining expressive minimal changes to the virtual machine

  5. High Throughput Stream Programming in Java Plan of this talk Challenges for high-throughput stream processing Programming model Static checking Implementation Empirical validation Conclusions

  6. High Throughput Stream Programming in Java StreamFlex Programming Model A program is a graph of concurrently executing filters communicating through non-blocking channels Plain Plain Clock Clock Java Java Filter Filter Filter Filter

  7. High Throughput Stream Programming in Java Programmer’s View of Memory StreamFlexGraph Heap Area Filter Filter Stable Area out in Transient Area Capsule Channel Channels

  8. High Throughput Stream Programming in Java Programming Model A Filter defines an activity , which: specified in abstract work() method made up of user-defined and library data types Clocks are priority scheduled filters that can preempt GC Filters operate on disjoint partitions of the heap stable holds persistent data, not GC ’ ed transient is a scratch pad reclaimed after each execution object lifetimes are per-class, using Stable markers

  9. High Throughput Stream Programming in Java Programming Model Filters communicate with capsules , which are: restricted to primitives and primitive array types allocated and managed by the runtime Capsules are put on channels , which: are bounded non-blocking queues Trigger expressions release filters

  10. High Throughput Stream Programming in Java Interaction with Java threads Plain Java Java can invoke methods on Filters causing: a change in allocation context pinning of @borrow arguments start of a lightweight transaction class PacketReader extends Filter { ... @atomic void write(@borrow byte[] b) { ... } }

  11. High Throughput Stream Programming in Java Intrusion Detection with StreamFlex Analyzes stream of incoming raw network packets Detects intrusion attempts through pattern matching ~1,500 LOC, 27 classes, 10 stable classes, 1 atomic method, 7 filters, 1 clock, 1 plain Java thread etc. Processing rate is 750Mb/s ! VSIP Read Trust Clock Ok Fail Join Tear Dump

  12. High Throughput Stream Programming in Java Intrusion Detection with StreamFlex class Intrusion extends StreamFlexGraph { Intrusion(int periodInMicros) { clock = makeClock(periodInMicros); read = makeFilter(PacketReader.class); ... connect(clock, read, “in”); connect(read, “out”, trust, “in”, 10, 1); ... validate(); } } ... new Intrusion(80).start();

  13. High Throughput Stream Programming in Java Intrusion Detection with StreamFlex class PacketReader extends Filter { private TimeChannel in; private Channel<Ether_Hdr> out; private Buffer buffer = new Buffer(16384); public void work() { TCP_Hdr p = (TCP_Hdr)makeCapsule(TCP_Hdr.class); readPacket(p); out.put(p); } } class Buffer implements Stable { .. }

  14. High Throughput Stream Programming in Java Programmer’s View of Memory Intrusion Heap Area PacketReader Stable Area Clock, 80us Buffer in public void work() { public void work() { TCP_Hdr p = out.put(); Transient Area } ... out out.put(p); } TimeChannel Channels Channel

  15. High Throughput Stream Programming in Java Programmer’s View of Memory Intrusion Heap Area PacketReader Stable Area Clock, 80us Buffer in public void work() { public void work() { TCP_Hdr p = out.put(); Transient Area } ... out out.put(p); } TimeChannel Channels Channel

  16. High Throughput Stream Programming in Java Programmer’s View of Memory Intrusion Heap Area PacketReader Stable Area Clock, 80us Buffer in public void work() { public void work() { TCP_Hdr p = out.put(); Transient Area } ... out out.put(p); } TimeChannel Channels Channel

  17. High Throughput Stream Programming in Java Programmer’s View of Memory Intrusion Heap Area PacketReader Stable Area Clock, 80us Buffer in public void work() { public void work() { TCP_Hdr p = out.put(); Transient Area } ... out out.put(p); } TimeChannel Channels Channel

  18. High Throughput Stream Programming in Java Programmer’s View of Memory Intrusion Heap Area PacketReader Stable Area Clock, 80us Buffer in public void work() { public void work() { TCP_Hdr p = out.put(); Transient Area } ... out out.put(p); } TimeChannel Channels Channel

  19. High Throughput Stream Programming in Java Programmer’s View of Memory Intrusion Heap Area PacketReader Stable Area Clock, 80us Buffer in public void work() { public void work() { TCP_Hdr p = out.put(); Transient Area } ... out out.put(p); } TimeChannel Channels Channel

  20. High Throughput Stream Programming in Java Plan of this talk Challenges for high-throughput stream processing Programming model Static checking Implementation Empirical validation Conclusions

  21. High Throughput Stream Programming in Java Implicit Ownership Type System Checking is modular at the granularity of a Filter Ensure no dangling pointers by: Objects owned by a Filter never accessed from outside the Filter Filters never refer to Heap Area illegal references objects subject to GC Stable objects don ’ t Filter Stable Area refer to transient Stable objects don ’ t Transient Area refer to Capsules Capsules

  22. High Throughput Stream Programming in Java Plan of this talk Challenges for high-throughput stream processing Programming model Static checking Implementation Empirical validation Conclusions

  23. High Throughput Stream Programming in Java Virtual Machine Support Priority-Preemptive Scheduling Memory management memory regions pinning of borrowed objects operations for changing allocation context Software Transactional Memory simple log-based implementation Type Checker Implementation A pluggable type system integrated with javac

  24. High Throughput Stream Programming in Java Plan of this talk Challenges for high-throughput stream processing Programming model Static checking Implementation Empirical validation Conclusions

  25. High Throughput Stream Programming in Java Event Correlation Benchmark Processing time: StreamFlex vs Java Ovm, AMD Athlon 64 X2 Dual Core 4400+ with 2GB. Linux 2.6.17 with high resolution timer patches and a tick period of 1 μ s. 400 350 Sfx/Ovm Java/Ovm 300 250 200 150 100 50 0 1 101 201 301 401 501 601 701 801 901 1001

  26. High Throughput Stream Programming in Java Predictability Inter-arrival times for a task with 80 μ s period Corresponds to predictability level of 98% Ovm, AMD Athlon 64 X2 Dual Core 4400+ with 2GB. Linux 2.6.17 with high resolution timer patches and a tick period of 1 μ s. 1500 1000 counts 500 0 40 60 80 100 120 140 160 180 microseconds

  27. High Throughput Stream Programming in Java Plan of this talk Challenges for high-throughput stream processing Programming model Static checking Implementation Empirical validation Conclusions

  28. High Throughput Stream Programming in Java Related Work Stream Processing Thies, Karczmarek, Amarasinghe. Streamit: A language for streaming applications , CC 02. Real-time Bollella et al. The Real-time Specification for Java. Addison-Wesley, 2000. Spoonhower, Auerbach, Bacon, Cheng, Grove Eventrons: A Safe Programming Construct for High-Frequency Hard Real-Time Applications. PLDI, 2006 Spring, Pizlo, Guerraoui, Vitek. Reflexes: Programming Abstractions for Highly Responsive Systems , VEE 07. Auerbach, Bacon, Iercan, Christoph Kirsch, V.T. Rajan, Harald Röck, and Rainer Trummer. Java Takes Flight: Time-portable Real-time Programming with Exotasks , LCTES 07. Ownership Types Noble, Potter, Vitek. Flexible Alias Protection. ECOOP 98. Boyapati, Lee, Rinard. Ownership type for safe memory management in real-time Java. PLDI 03.

  29. High Throughput Stream Programming in Java Conclusions StreamFlex is a practical abstraction for integrating high throughput stream processing with non-time critical applications The StreamFlex static type safety rules are sufficiently expressive The benchmarks demonstrate high throughput and high level of predictability

  30. High Throughput Stream Programming in Java

  31. High Throughput Stream Programming in Java Predictability Measured missed deadlines (BeamFormer). AMD Athlon 64 X2 Dual Core 4400+ with 2GB. Linux 2.6.17 with high resolution timer patches and a tick period of 1 μ s. 60 50 40 microseconds 30 20 10 0 0 1000 2000 3000 4000 5000

Recommend


More recommend