Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Going Reactive in Java with Typesafe Reactive Platform


Published on


In this presentation by Jamie Allen, we do a deep dive into the Typesafe Reactive Platform from the Java developer’s perspective, to learn how Typesafe supports the entire Reactive application development lifecycle.

Reactive application development is becoming mainstream and considered a mission-critical need for future growth. This new wave of business applications are message-driven, elastic, resilient and responsive by nature, designed to scale elastically and maintain responsiveness during even large failures. With the Typesafe Reactive Platform (RP), including Play Framework and Akka, Java developers can start to use tools designed for building distributed systems that deliver highly-responsive user experiences. Regardless of whether you code in Java or Scala, Typesafe RP provides a resilient and message-driven application stack that scales effortlessly on multicore and cloud computing architectures.

Published in: Software
  • Be the first to comment

Going Reactive in Java with Typesafe Reactive Platform

  1. 1. Going Reactive in Java with the Typesafe Reactive Platform Jamie Allen Senior Director of Global Services
  2. 2. @jamie_allen Reactive Applications
  3. 3. This is an era of profound change
  4. 4. Implications are massive, change is unavoidable Reactive Applications Users are demanding richer and more personalized experiences. Yet, at the same time, expecting blazing fast load time. Users Mobile and HTML5; Data and compute clouds; scaling on demand. Modern application technologies are fueling the always-on, real-time user expectation. Applications Businesses are being pushed to react to these changing user expectations… ...and embrace modern application requirements. Businesses
  5. 5. As a matter of necessity, businesses are going Reactive
  6. 6. About Typesafe – Proven Technology Go Reactive Conversions up 20% Mobile orders up 98% Achieved > 10x performance improvement…on the same hardware Reduced code base by 99% from 479,000 to 5,000 lines Improved elasticity to handle 100X increase in traffic Reduced production server usage by 80%
  7. 7. Reactive applications share four traits
  8. 8. Reactive applications react to changes in the world around them
  9. 9. Message-Driven • Loosely coupled architecture, easier to extend, maintain, evolve • Asynchronous and non-blocking • Concurrent by design, immutable state • Lower latency and higher throughput Reactive Applications “Clearly, the goal is to do these operations concurrently and non-blocking, so that entire blocks of seats or sections are not locked. We’re able to find and allocate seats under load in less than 20ms without trying very hard to achieve it.” Andrew Headrick, Platform Architect, Ticketfly
  10. 10. The difference between Concurrent and Parallel Reactive Applications
  11. 11. Amdahl's Law Reactive Applications
  12. 12. Reactive applications scale up and down to meet demand
  13. 13. Elastic • Scalability and elasticity to embrace the Cloud • Leverage all cores via asynchronous programming • Clustered servers support joining and leaving of nodes • More cost-efficient utilization of hardware • Avoid contention on shared resources Reactive Applications “Our traffic can increase by as much as 100x for 15 minutes each day. Until a couple of years ago, noon was a stressful time. Nowadays, it’s usually a non-event.” Eric Bowman, VP Architecture, Gilt Groupe
  14. 14. Reactive applications are architected to handle failure at all levels
  15. 15. Resilient • Failure is embraced as a natural state in the app lifecycle • Resilience is a first-class construct • Failure is detected, isolated, and managed • Applications self heal Reactive Applications “The Typesafe Reactive Platform helps us maintain a very aggressive development and deployment cycle, all in a fail-forward manner. It’s now the default choice for developing all new services.” Peter Hausel, VP Engineering, Gawker Media
  16. 16. Isolate failure at all levels • Threads • Within one node • Across many nodes (JVMs) • Across many physical servers • Across data centers Reactive Applications
  17. 17. Reactive applications enrich the user experience with low latency response
  18. 18. Responsive • Real-time, engaging, rich and collaborative • Create an open and ongoing dialog with users • More efficient workflow; inspires a feeling of connectedness • Fully Reactive enabling push instead of pull Reactive Applications “The move to these technologies is already paying off. Response times are down for processor intensive code–such as image and PDF generation–by around 75%.” Brian Pugh, VP of Engineering, Lucid Software
  19. 19. Cost of writing applications that are not Reactive • Cost to your wallet and the environment of leveraging unnecessary hardware • No ability to be responsive to your users in the face of bursty traffic and failure, leading to loss of customers Reactive Applications
  20. 20. Typesafe ConductR Applications Cluster and Infrastructure Mangement
  21. 21. The Java language and ecosystem is powerful • Few languages have as much enterprise support and stability • More than 50% of Typesafe customers for Akka and Play Framework use them from the Java APIs • Many of Typesafe's largest customers use our technologies from the Java API • Java 8 brought many of the syntax features that are included in Scala for more expressive APIs Reactive Applications
  22. 22. • Simple message-oriented programming model for building multi-threaded applications • Makes it easier to create reliable concurrent programs • Raises the abstraction level • no more shared state, memory visibility, thread notifications, locks, concurrent collections, … • high CPU utilization, low latency, high throughput and scalability are included declaratively • Applications are more reliable with hierarchical fault tolerance through supervision Go Reactive
  23. 23. Reactive Applications
  24. 24. Reactive Applications 27 A B BarFoo C B E A D C /Foo /Foo/A /Foo/A/B /Foo/A/D Guardian System Actor Name resolution—like a file-system
  25. 25. Reactive Applications 28
  26. 26. Reactive Applications 29
  27. 27. • A completely different approach to managing runtime failures • Everyone familiar with DDD knows about Domain Events and models them into their application • Exceptions are Domain Events with specific connotations about your application's state • Supervision gives you the tools to handle those Failure Domain Events that you know about, as well as those you don't Reactive Applications
  28. 28. • Full cluster support (sharding and elastic routing) • Conflict-free Replicated Data Structures (CRDTs) • Persistent actors via event sourcing • Integration with Apache Camel • OSGi compatible • TestKit: support for asynchronous/distributed testing • Coming soon: Akka Streams and Akka HTTP Go Reactive
  29. 29. • Play is a web application framework, inspired by Ruby on Rails • Simple tasks should be simple • Hard tasks should be possible • Focus on developer productivity and happiness • Rapid development and iteration • Developer Console • Instant feedback by refreshing your browser window • Compilation Errors • Code, templates and routes • Built on Akka for speed and scale • Container-less, asynchronous and non-blocking Reactive Applications
  30. 30. • Play is based on HTTP • Has an asset compiler for CoffeeScript, Less, etc • JSON is a first class citizen • WebSocket support • Can be used with pluggable existing libraries and tools from the JVM and Web ecosystems (Angular, JPA, etc) Reactive Applications
  31. 31. • Play pushes you toward linear scalability by keeping the web tier stateless Reactive Applications
  32. 32. package controllers; import play.mvc.*; public class Application extends Controller { public static Result index() { return ok("Hello everybody!"); // returns a Result } } Reactive Applications • Play has a simple model for managing requests
  33. 33. import*; import static play.libs.F.Promise; WSRequestHolder request = WS.url(""); Promise<WSResponse> promiseGetResponse = request.get(); Promise<WSResponse> promisePostResponse = request .setContentType("application/x-www-form-urlencoded") .post("param1=value1"); Reactive Applications • Play has a sophisticated and asynchronous Web Service API with OAuth & OpenID
  34. 34. Promise<Double> computePiAsync() { return Promise.promise(new Function0<Double>() { public Double apply() { return (...); }}); } Promise<Result> promiseOfResult = computePIAsync().map( new Function<Double,Result>() { public Result apply(Double pi) { return ok("PI value computed: " + pi); }}); Reactive Applications • Fully asynchronous and non-blocking, even pre-Java 8
  35. 35. Promise<Double> computePiAsync() { return Promise.promise(() -> ...); } Promise<Result> promiseOfResult() { return computePIAsync().map(Double d -> ok("PI value computed: " + pi)); } Reactive Applications • Java 8 syntax with Lambdas is cleaner, though
  36. 36. Reactive is being adopted across a wide range of industries.
  37. 37. Online Services Retail Education Technology Social Media Finance Broad Adoption
  38. 38. Typesafe delivers the world’s leading Reactive platform on the JVM.
  39. 39. Typesafe Activator – How to get started Reactive Applications
  40. 40. EXPERT TRAINING Delivered on-site for Akka and Play with Java Help is just a click away. Get in touch with Typesafe about our training courses. • Intro Workshop to Apache Spark • Fast Track & Advanced Scala • Fast Track to Akka with Java or Scala • Fast Track to Play with Java or Scala • Advanced Akka with Java or Scala Ask us about local trainings available by 24 Typesafe partners in 14 countries around the world. CONTACT US Learn more about on-site training
  41. 41. ©Typesafe 2015 – All Rights Reserved