Ratpack the story so far
-
Upload
phill-barber -
Category
Software
-
view
323 -
download
3
Transcript of Ratpack the story so far
Agenda● What is Ratpack?
● Why did we decide to use it?
● A look at the code.
● Mistakes you can make.
● Issues we currently face.
● Retrospective.
What is ratpack?● A high performance Java web framework.
● Asynchronous and non-blocking model.
● Aims to make asynchronous programming on the JVM easier.
● Built on Java 8 and Netty.
● Currently at version 1.1.1
What is ratpack? (continued)Assuming your application is I/O bound, it offers the following
benefits:
● High throughput
● Low CPU usage
● Lower Memory usage (due to less threads)
All of these benefits are due to its threading model and using
non blocking I/O
What is ratpack? (continued)This efficiency comes with the cost of increased complexity.
● Steep learning curve.
● Easy to get wrong.
● Hard to debug.
Ratpack misconceptions● Asynchronicity is internal only!
○ It’s just a web server.
○ It takes time to respond to http requests.
● Doesn’t improve latency.
○ If a downstream call takes 500ms, ratpack will take > 500ms to respond.
● If you are using Ratpack - it doesn’t mean your system will
necessarily perform any better.
○ You can make it perform worse!
Ratpack vs Dropwizard - Load profiles
Three load profiles were given to each application as detailed
below:
1. 5 minute duration, 100 JMeter Threads
2. 5 minute duration, 200 JMeter Threads
3. 5 minute duration, 300 JMeter Threads
Why did we decide to use it?● We will be I/O bound.
● We will be at high load.
● Ratpack vs Dropwizard Performance Test revealed
encouraging stats.
● We had a sense of optimism that we’d pick up the async
challenges.
A look at the code - Overview● Runnable Jar.
● main() method starts the server.
○ Simple and easy to start for testing.
● URIs mapped to Handlers.
● Execution model deals with Promises.
● We decided to use Rx Java in “service” layer and use
Observables.
Annoying mistakes● Messing up Threads
○ Using Cassandra thread to call Cassandra.
○ Happened to us whilst implementing ListenableFuture
Issues (continued)● Ratpack http client does not use a connection pool.
● AppDynamics integration still ongoing.
IssuesPerformance related issue: At load, 1 in 1000 requests would not get a response.
● Hard to debug
● Thread dumps revealed that (big surprise) nothing was blocking. Where do you
go from here?
Now Resolved
● Was actually an issue related to secretly running in Development mode. InteliJ
IDEA
○ Issue #909
Retro / Assorted notes...● It was harder than we expected.
● It took longer than expected to get up to speed.
● Rx bought us flexibility but introduced an extra learning curve.
● Cost vs Reward analysis is difficult but would have been a benefit.
● Monitoring our CPU and Memory usage is key to realising the benefit.
● Confidence is improving day by day… BUT…
● Still not proven - We’re not live yet!
Thanks!Questions?
More info: http://phillbarber.blogspot.co.uk/Code: https://github.com/phillbarber/ratpack-demo