The document discusses reactive applications and the Typesafe Reactive Platform. Reactive applications are message-driven, elastic, resilient, and responsive. They react to changes, scale up and down based on demand, handle failures, and provide low-latency responses. The Typesafe platform includes Akka for building concurrent applications and Play Framework for developing web applications. Both use reactive principles and support features like clustering, event sourcing, and web services. Typesafe delivers training and support for organizations adopting a reactive approach using their Java-based tools.
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. As a matter of necessity,
businesses are going Reactive
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%
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
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
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. Isolate failure at all levels
• Threads
• Within one node
• Across many nodes
(JVMs)
• Across many physical
servers
• Across data centers
Reactive Applications
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. 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
23. 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
24.
25. • 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
30. • 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
31. • 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
32.
33. • 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
34. • 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
35. • Play pushes you toward linear scalability by keeping
the web tier stateless
Reactive Applications
36. 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
37. import play.libs.ws.*;
import static play.libs.F.Promise;
WSRequestHolder request = WS.url("http://page.com");
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
38. 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
39. 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
44. 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
New York Times article, for impatient end users, the blink of an eye is just too long.
http://www.nytimes.com/2012/03/01/technology/impatient-web-users-flee-slow-loading-sites.html?pagewanted=all&_r=2&
These new requirements are fueling a new class of Reactive software application that is:
Event-Driven—processing messages in parallel, asynchronously, without blocking.
Scalable—on-demand, across cores, nodes, and clusters; scaling predictably and elastically.
Resilient—recovering and repairing itself automatically for seamless business continuity.
Responsive—rich and engaging, providing instant feedback based on user interactions.
if you look across all the big ecosystem of applications that try to solve this, there's really no platform that implements all of the four traits like Typesae. Most of them have problems with the resilience part. They can't possibly be fully resilient without the developer having to bend over backwards to get it there.
But let’s dive into each trait and take a closer took.
Loosely coupled architecture, easier to extend; maintain; evolve
Under heavy load it leads to lower latency and higher throughput
More efficient resource utilization and management
Asynchronous sending of events and non-blocking execution of events (benefit statement goes here)
Concurrent by design
Immutable state
Fully reactive: Push instead of Pull plus on-demand execution
Less non-determinism
Event-driven is the foundation for Scalability
Elasticity – embrace the Cloud
Scale Up or Down dynamically
Topology and scalability is a deployment or runtime decision
More cost-efficient hardware utilization
Less risk; Too little hardware to meet you needs; Too much hardware idling for no good reason
Scale with predictability
Technical Overview
Its loose coupling and level of indirection makes location transparency possible
Not transparent distributed computing – which does not work – but the contrary:
Make the network explicit in the prog model
The network is unreliable
Fully embrace the network
Resilience is to a large extent ignored by the industry
If not completely ignored then bolted on afterwards
In a Reactive Application resilience is not an afterthought
But part of the design, and a first class construct in the programming model
Failure will happen – even if you like it or not
See it as a natural state in the applications lifecycle
and not only react to it but manage it
Delivers an application that that can self-heal
and Avoid cascading failures
Real-time, engaging, rich and collaborative
Businesses can create an open and ongoing dialog with customers by welcoming them through responsive experiences
Makes for more efficient workflow and inspires a feeling of connectedness that equips them to solve problems and accomplish tasks.
Technical Overview
Push instead of Pull; WebSockets, Server-Sent Events
Streaming; Rx/FRP, Iteratees
Reactive JavaScript libraries; Knockout.js, Reactive.js, Meteor