Devoxxuk talk
http://cfp.devoxx.co.uk/2015/talk/AJY-8768/All_Change!_How_the_new_economics_of_Cloud_will_make_you_think_differently_about_Java
How far have you got with learning about Cloud? Got your head around Platform as a Service? Understand what IaaS means? Can spell Docker? Working in a DevOps mode? It's easy to focus on learning new technology but it's time to take a step back and look at what the technical implications are when an application is heading to the cloud. In the world of the cloud the benefits are high but the economics (financial and technical) can be radically different. Learn more about these new realities and how they can change application design, deployment and support The introduction of Cloud technologies and its rapid adoption creates new opportunities and challenges. Whether designer, developer or tester, this talk will help you to start thinking differently about Java and the Cloud
All Change! How the new economics of Cloud will make you think differently about Java
1. @spoole167#AJY-8768
All Change! How the new economics of Cloud will
make you think differently about Java
Steve Poole IBM
@spoole167
noregressions.wordpress.com
All Change! How the new economics of Cloud will make you
think differently about Java
2. @spoole167#AJY-8768
Important Disclaimers
THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.
WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED.
ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED ENVIRONMENT. YOUR OWN TEST RESULTS MAYVARYBASED ON HARDWARE, SOFTWARE OR
INFRASTRUCTURE DIFFERENCES.
ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLYAS A GUIDE.
IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE.
IBMAND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANYOTHER
DOCUMENTATION.
NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:
- CREATING ANY WARRANT OR REPRESENTATION FROMIBM, ITS AFFILIATED COMPANIES OR ITS OR THEIR SUPPLIERS AND/OR LICENSORS
3. @spoole167#AJY-8768
Your Guide for Today’s Journey
Steve Poole
IBM Developer
Making Java Real Since Version 0.9
Open Source Advocate
DevOps Practitioner (whatever that means!)
Driving Change
4. @spoole167#AJY-8768
This talk is intended to make you
Think about how you use compute resource today
Think about how that use may need to change tomorrow
Starting measuring your application profile now
Try out cloud technologies and gather real experience
7. @spoole167#AJY-8768
This talk is about how this sort of measurement:
GB/hr
is already changing your life & the direction of the Java
ecosystem
The ‘Cloud’ has a lot to answer for
9. @spoole167#AJY-8768
What ‘Cloud’ promises
a virtual, dynamic environment which
maximizes use, is infinitely scalable,
always available and needs minimal
upfront investment or commitment
Take your code – host it on someone
else's machine and pay only for the
resource you use for the time you use it
AND be able to do that very quickly and
repeatedly in parallel
10. @spoole167#AJY-8768
Take your code – host it on someone
else's machine and pay only for the
resource you use for the time you use it
AND be able to do that very quickly and
repeatedly in parallel
</>
</>
</>
</>
</>
</>
$10$10
11. @spoole167#AJY-8768
How quickly do you need to get good code into production?
Would you believe < 1hr?
Case Study: A fashion retailer can show measureable increase in sales if a
item similar to that seen in the media can be placed on their on-line store
landing page within 1 hr of it appearing in public.
Each product placement is different so they need a fast, agile, approach that
does not jeopardize their on-line stores availability and quality.
We know how to do this..
12. @spoole167#AJY-8768
Cloud computing is real.
Major vendors are providing substantial
capacity and it’s growing all the time
Businesses see the opportunities here:
Improved value for money, decreased
time-to-market, shorter time to value
“I can now get my ideas into
production in hours,days or weeks. I
can get immediate feedback AND then
I can improve the idea and repeat”
14. @spoole167#AJY-8768
Compute == money
Easier than ever before
a business can buy a CPU
Just for how long they
need it.
No long term capital
investment.
Just as much as they need
$ == GB/hr
24. @spoole167#AJY-8768
(micro) Services– Lean, simple, self-contained
OSOS
serviceservice
DepDep
hwhw
SQLSQL
OSOS
serviceservice
DepDep
hwhw
NOSQLNOSQL
OSOS
serviceservice
DepDep
hwhw
*DB*DB
Responsive Scaling: easy to start another
instance
Resilience / Availability : one instance fails,
there's always another one
Deployment : easier dark launches, canary
testing, smaller images
Quality: Simple services means easier ,
faster more comprehensive testing
Design & Development: simpler, less
complex. means quicker to value
25. @spoole167#AJY-8768
docke
r
docke
r
docke
r
docke
r
Put your service in a container* and its even
simpler
OSOS
serviceservice
DepDep
hwhw
SQLSQL
OSOS
serviceservice
DepDep
hwhw
NOSQLNOSQL
OSOS
serviceservice
DepDep
hwhw
*DB*DB
“Infrastructure As Code” style applications
Gives your more certainly about quality
and behavior, enables scaling and world
peace…
And your Ops teams can help you build
secure base containers – everyone wins
Containers, Services and Cloud – a new
way of working.
What does this all mean for Java?
Docker
VM image
Cloud
Foundry
Droplet
Docker
VM image
Cloud
Foundry
Droplet
26. @spoole167#AJY-8768
Simply
Java applications are going to be running in a
constrained and metered environment
There will be precise limits on how much disk,
CPU, RAM, Bandwidth an application can
use and for how long
Whether your application is large or small,
granular or monolithic. Someone will be
paying for each unit used
That person will want to get the most out of
that investment
https://www.flickr.com/photos/rvoegtli/
27. @spoole167#AJY-8768
Cloud computing: power == money
Money changes everything
With a measureable and direct
relationship between $£€¥ and
CPU/RAM, disk etc the financial
success or failure of a project is even
easier to see
And that means…
Even more focus on value for money.
29. @spoole167#AJY-8768
Where you code runs day-to-day and moment-to-moment
will be driven by economics, legal requirements and how
much risk your business wants to take.
Your code has to scale better, be more efficient,
resilient, secure and work in constrained environments
You will have to design, code, deliver, support and debug
code in new ways
It’s going to be scary
33. @spoole167#AJY-8768
You have less of each than you think (how big is your pipe to the internet?)
You pay for each byte
You need to maximize the value of each one
NO unnecessary baggage
Deployment takes time and uses bandwidth.
OSOS
docke
r
docke
r
serviceservice
DepDep
DBDB
34. @spoole167#AJY-8768
Unnecessary baggage
(you have loads)
Java applications have to get lighter.
Java 9 modularity will help but you have
to consider footprint across the board.
Choose your dependencies wisely
Your choice of OS & distribution is
important.
The aim is ‘carry on only’
Your application isn’t going on a long trip
https://www.flickr.com/photos/armydre2008/
35. @spoole167#AJY-8768
Startup times
How long do you want to wait?
How long do you have to wait?
Do you need to preemptively start instances ‘just in
case’ due to start up time? To bad – that costs
If the unit of deployment and scaling is an instance
of a service it needs to start FAST
BTW – think about this. Everything that happens
at startup – happens every time, all the time.
https://www.flickr.com/photos/91295117@N08/
36. @spoole167#AJY-8768
Java & fast startup time – It’s known for it!
Application developers can reduce service startup
time by deferring optional costs to when its
needed. Maybe even create services with different
behaviors rather than one with optional behavior
But it’s not enough
The JVM needs to revisit all the places where
startup time was traded for throughput and turn
them around.
what about
“ Everything that happens at startup – happens
every time, all the time”
37. @spoole167#AJY-8768
At startup a JVM:
Loads more byte code than you’d ever imagine.
Turns byte code into machine code (JIT)
Doesn’t know what you really want to do so checks everything
you might need is there and gives you a system fit for general
use
Loads and compiles your code (sometime multiple times)
and recompiles and re-optimizes based on hints from your code
usage
https://www.flickr.com/photos/numb3r/
38. @spoole167#AJY-8768
The rub
For container based services – all this start up
effort happens multiple times during
development and testing (let along during
production)
And it’s always the same result.
AND you will pay $ for it every time
We don’t have a good way to capture all this
effort or formalise starting a JVM from a
precanned image. (Shared classes doesn’t
hack it)
Other languages have better / faster startup!
https://www.flickr.com/photos/dno1967b/https://www.flickr.com/photos/quinnanya/
39. @spoole167#AJY-8768
More thoughts
Do we need a JVM anymore? If your container has code that will ONLY run on
one OS/arch do we need hardware abstraction like class files and bytecode?
Linker coming in Java 9 helps reduce footprint and some startup time.
We need more AOT to convert Java into executable code once only
Individual service lifetimes are short so dynamic recompliation is not useful
unless the generated code is shared. How do we share compiled code
cheaper than it costs to generate the code?
Remember – you’ll be paying for all the ‘wasted’ CPU / RAM etc.
41. @spoole167#AJY-8768
Runtime costs
Most cloud providers will charge you for your RAM usage over time: $GB/hr.
(Sometimes the charge is $0) Increasing –Xmx now directly effects cost.
Something businesses can understand
Net effect – you’ll be tuning your application
to fit into specific RAM sizes.
Smaller than you use today.
You will need to be able to measure where the
storage goes. You’ll be picking some components
based on memory usage
increasing the amount of memory for 1 service
increases the bill by the number of concurrent
instances
https://www.flickr.com/photos/erix/
42. @spoole167#AJY-8768
Multiple languages on the JVM.
What’s the benefit of running them
on the JVM vs having a native
service?
They can take more memory, and
take longer to execute.
Cloud applications are increasingly
heterogeneous. Anyway they
share data not objects
it’s the API economy…
Nashorn JavaScript engine
delivered in JDK8
Utilizes new JVM level features for
performance
Avatar.js provides Node.js support
on Nashorn
Results of “Octane” JavaScript
benchmark using Java 8 pre-u20
Node.js is 4.8x faster
Avatar.js is >10x larger
Feb 12th
, 2015: Avatar is “put on hold”
https://blogs.oracle.com/theaquarium/entry/project_avatar_update
43. @spoole167#AJY-8768
The API economy
If your company has data it will eventually be shared
and monetised
Really.
Cloud APIs are one of the fastest growing areas in
our industry.
Sharing data and services though APIs is
enabling new opportunities and solutions
Everyone is getting into the game.
44. @spoole167#AJY-8768
What makes a good cloud api ?
roughly in selection order.
vailability 100% of course with performance SLAs
elievability – Are those published 100% metrics true?
ost – how much and what’s the unit of measure?
iagnosability – can users debug problems without you?
xcitement – is there a vibrant community using the API?
unctionality – what else can the API do?
45. @spoole167#AJY-8768
Resilient applications
Design for short term failure: something fails all the time. Expect data and
service outages regularly
Fail and recover: don’t diagnose problems in running systems. Kill it and
move on
Every IO operation you perform may fail – do as few as possible
Every IO operation may stall – costing you GB/hrs and resources–
timeout everything quickly
Every piece of data you receive may be badly formed – check everything
Retry, compensation, backout strategies– these are your new friends
“Everything in the cloud fails all
the time” : Werner Vogels
46. @spoole167#AJY-8768
Phone:
Mum: Stephen, I can’t log into my
computer
Phone:
Mum: Stephen, I can’t log into my
computer
Me: (sigh) what happensMe: (sigh) what happens
Mum: the screen is blue with
writing on it
Mum: the screen is blue with
writing on it
Me: (sigh) what can you see on
the screen
Me: (sigh) what can you see on
the screen
Mum: I type the password but
nothing happens
Mum: I type the password but
nothing happens
https://www.flickr.com/photos/jeroenbennink/
Me: (sigh) We’ll come over at the
weekend
Me: (sigh) We’ll come over at the
weekend
47. @spoole167#AJY-8768
Remote support for your family?
Fancy having to do that for your own apps?
You will never be able to log into a remote
server.
You will never be able to attach a remote
debugger to a failing app
Ever.
Deal with it.
All problems must be resolved by local
reproduction or logs and dumps
https://www.flickr.com/photos/carbonnyc/
Debugging
48. @spoole167#AJY-8768
Debugging
It gets more challenging.
Failures during deployment
or initial startup can be difficult or
impossible to diagnose.
If your service instance didn’t start there
is is little chance of logs being kept!
Learn to love logs, dumps and traces.
Remote log stores and tools are going
to be your best friend
BTW: they’ll cost too
https://www.flickr.com/photos/hinkelstone/
50. @spoole167#AJY-8768
Hard metrics and limits keeping a failed app around or
having apps on standby can be
costly in multiple ways
Runtime costs and taking up vital
resource allocation
52. @spoole167#AJY-8768
It’s all change
How you design, code, deploy, debug, support etc
will be effected by the metrics and limits
imposed on you.
Financial metrics and limits always change
behavior. It also creates opportunity
The JVM and Java applications have to get leaner
and meaner
You have to learn new techniques and tools
All this in support of:
https://www.flickr.com/photos/beigephotos/
53. @spoole167#AJY-8768
The API economy
Where we are all heading.
It’s a brave new cloud
world
Are you ready?
Time to think and do
get hands-on experience
now
https://www.flickr.com/photos/magnetbox/