Comparing Elasticity of Reactive Frameworks – James Ward – Users Want



Comparing Elasticity of Reactive Frameworks – James Ward – Users Want

1 4


comparing-elasticity-reactive-frameworks


On Github jamesward / comparing-elasticity-reactive-frameworks

Comparing Elasticity of Reactive Frameworks

James Ward

@_JamesWard

Users Want

  • In-Sync Data
  • Real-time Collaboration
  • Instant Feedback
  • To Not Wait

Users Want Reactive Apps

www.ReactiveManifesto.org

Elastic

The system stays responsive under varying workload. Reactive Systems can react to changes in the input rate by increasing or decreasing the resources allocated to service these inputs. This implies designs that have no contention points or central bottlenecks, resulting in the ability to shard or replicate components and distribute inputs among them. Reactive Systems support predictive, as well as Reactive, scaling algorithms by providing relevant live performance measures. They achieve elasticity in a cost-effective way on commodity hardware and software platforms.

Elastic

Resource Contention is a conflict over access to a shared resource
  • Message-Driven / Async
  • Reactive All The Way Down
  • Idle Threads = Contention Point
  • Shared / Distributed state = Contention Point

Reactive Streams

www.reactive-streams.org

Back Pressure

  • Stream-oriented
  • Sensible behavior on resource contention
  • Avoids unnecessary buffering
  • Iteratees, Rx, Reactive Streams

Reactive Requests & Reactive Composition

Example Use Case

Reactive composition of stateless nano-services Request a random number that is around 5 Make that many requests to a random word service Return the random string of gibberish

The Old Way

Play + Scala

RatPack + RxJava

Akka HTTP

NodeJS + Express + Q

Load Testing

Legacy - 1000 Concurrent for 1 Minute

Requests / SecAverage Response Time (ms)1 Dyno2 Dynos4 Dynos8 Dynos07501,5002,2503,000
Average Response Time (ms)

Play - 1000 Concurrent for 1 Minute

Requests / SecAverage Response Time (ms)1 Dyno2 Dynos4 Dynos8 Dynos07501,5002,2503,000
Average Response Time (ms)

RatPack - 1000 Concurrent for 1 Minute

Requests / SecAverage Response Time (ms)1 Dyno2 Dynos4 Dynos8 Dynos01,5003,0004,5006,000
Average Response Time (ms)

NodeJS - 100 Concurrent for 1 Minute

Requests / SecAverage Response Time (ms)1 Dyno2 Dynos4 Dynos8 Dynos05001,0001,5002,000
Average Response Time (ms)

Conclusions

  • Stateless apps scale horizontally
  • Reactive Composition is pretty easy
  • Reactive all the way down is optimal
  • Do your own load tests