Upload
baruch-sadogursky
View
3.490
Download
4
Tags:
Embed Size (px)
DESCRIPTION
"Java For The Cloud" session at AlphaCSP's JavaEdge 2008 seminar
Citation preview
Clouds Over Java
© flickr.com/photos/thirnbeck
2
Agenda
• Introduction – The Missing Link
• Solutions Overview
• Drawbacks
• Resources and Links
• Demo!
3
Back to 1880
• You have built new
electric device
• You’ll probably will
have to build electric
generation system for
it…
5
Back to November 22, 2007
6
Back to November 22, 2007
• JavaEdge 2007 “Breaking The
Clustering Limits” session
• Data and computational grids overview
• Terracotta demo
• Easy – one computer!
7
Your Application In The Wild
• So, you wrote your grid application
• Now you want to deploy it on TWO(!)
machines transparently
• You buy two machines to get fail-over
and some availability
8
“Main Server” “Fail Over”
Your Application In The Wild
• Life’s good – your friends and family play with your application during the weekend
• Your application is kind of slow in those times
• You buy and dropin another box
• It’s easy forgrid application
9
“Main Server” “Fail Over” “Peak Hours”
Your Application In The Wild
• You start to sale – SLA, concerned
customers, responsibility –
“production” peak times
• You can’t afford any slowdown!
• You buy a real grid
10
“Main Server” “Fail Over” “Peak Hours”“Peak Days”
Your Application In The Wild
• Money comes in only to make more
money, it’s time to crazy
advertisement campaign!
• This creates a true hype
• You buy more
machines…
11
“Main Server” “Fail Over” “Peak Hours”“Peak Days” “New Ad Campaign Hype”
Your Application In The Wild
…Two weeks after people start
complaining…
12
Your Application In The Wild
• There are additional costs:
• Network with appropriate bandwidth
• Professional services
• Space
• Etc.
13
Your Application In The Wild
Congratulations, you just built your
own electric plant
14
Your Application In The Wild
• What happens when:
• There is no ad campaign?
• It’s not the peak days?
• It’s not the peak times?
• There is an economic crisis?
• In other words – most of the time?
• The whole bombastic setup is idle
15
Your Application In The Wild
• IDLE == WASTING MONEY
• The setup is idle most of the time
• It wasts A LOT of money
• It’s not only building
your own electric
generation system,
it’s using 10% of
its capacity!
16
Lo
ad
Time
Loss/Loss Situation
Actual Load HW Allocation
Prediction Problem
17
Service
loss
Money
loss
Things “as a Service”
• When you buy a new TV you connect it to electricity service
• That’s instead of buildingor buying or even rent a generator
• When you buy a new mobilephone you connect it to cellular service
• That’s instead of creating yourown communications network
18
Advantages “as a Service”
• Low entry barriers
• How much do you pay to get a SIM?
• No capital expenditure
• You pay only per use
• Massive scalability
• You can turn on all you electric devices, probably it won’t drain the provider’s electricity resources
• Self service
• Yeah, you can turn the TV set on by yourself, big boy
19
Computing as a Service
• Rent computational resources & IT
related capabilities over the Internet
(“The Cloud”)
• Only what you need
• Exactly when you need
• Pay per use
• That’s “Cloud Computing”
20
Cloud Computing
• Pay for what you use
• Use only what you need
• Get it via web UI and/or API
• Self Service
• Built on storage and computing
virtualization technologies
21
Cloud Computing
• Offers SLA
• Available world-wide
• All the customers throughout the world
get the same response time
• Gartner:“Cloud computing heralds an
evolution of business that is no less
influential than e-business”
22
Lo
ad
Time
React Fast & Pay Per Use
Actual Load HW Allocation Cloud Allocation
Prediction Problem
23
Gartner’s 2009 Strategic Technologies
1. Virtualization (#5 previously)
2. Cloud Computing (new)
3. Servers – Beyond Blades (#8 previously)
4. Web-oriented architectures (new)
5. Enterprise mashups (#6 previously)
6. Specialized Systems (new)
7. Social Software & Social Networking (#10 previously)
8. Unified Communications (#2 previously)
9. Business Intelligence (new)
10. Green IT (#1 previously)
24
•Cloud computing is perfect for
crisis times
• No upfront
investments
• Time-To-Market
• Cost effective
• Fail cheap
25
“Crisis, crisis!” Slide
Agenda
• Introduction – The Missing Link
• Solutions Overview
• Drawbacks
• Resources and Links
• Demo!
26
Main Types
• Infrastructure as a Service
• Get your own instance with root access
• Amazon
• GoGrid
• AppNexus
• FlexiScale
• Microsoft Azure (not yet)
• Etc
28
Main Types
• Platform as a Service
• Deploy your application on providers’ platform
• Google Application Platform
• Sun’s Network.com & Project Caroline
• Microsoft Azure
• Force.com
• Etc
29
What to run on IaaS?
• Clustering techniques:
• HTTP Session replication
• Tomcat, Jetty, etc.
• Shared/Clustered Database
• Install clustered DB
• Use service
30
Clustering Tools
• Java MapReduce implementation
• Distributed application server
• Java Spaces implementation
• Network Attached Memory
• Demo is on its way!
• Etc
31
AWS – Amazon Web Services
• Collection of remote computing services
• Launched on July 2002
• Simple idea – rent its idle servers
• Implementation – Xen virtualization
• SLA
• Interfaces:
• SOAP and REST
33
Amazon S3 – Simple Storage Service
• Flat hierarchy (named buckets)
• ∞ number of 5 GB files
• CloudFront – content delivery service
• US, EU, Asia
• Price - $0.150 First 50 TB / month
• Interfaces:
• Web – S3Browse, S3Fox addon
• Java – JetS3t, Typica
34
Amazon SimpleDB (Public Beta)
• Query-oriented storage
• Limited to 1 TB
• Price
• $0.17 per GB-month
• Java interface – SimpleJPA
• Not really relational
35
Amazon SQS – Simple Queue Service
• ∞ number of queues
• ∞ number of text messages
• 8 kb each
• Price - $0.01 per 10,000 Requests
• Java interface - Typica
36
Amazon EC2 – Elastic Compute Cloud
• Boot Amazon Machine Image (AMI) on number of virtual instances
• Large number of preconfigured AMIs
• Linux and Windows
• Various machine types
• From 1.7GB RAM single-core to 15 GB RAM and 20 cores
• Availability zones
• US & EU
37
Amazon EC2 – Elastic Compute Cloud
• Elastic Block Store – storage cache
• Price - $0.10/hour for 1.7 GB RAM, 1
core, 160 GB HD
• Java Interface – Typica
• Management – CLI, IntelliJ and
ElasicFox addon
• Custom images support – AMI
(proprietary format)
38
Working With Typica
• Describe Images
39
• Open Connection
• Launch Instances
1 Jec2 ec2 = new Jec2(awsAccessKeyId, secretAccessKey);
1 List<String> params = new ArrayList<String>();
2 List<ImageDescription> images = ec2.describeImages(params);
3 log.info("Available Images");
4 for (ImageDescription img : images) {
5 if ("available".equals(img.getImageState())) {
6 log.info(describeImageAsString());
7 }
8 }
1 LaunchConfiguration config = new LaunchConfiguration(imageDescription.getImageId());
2 config.setKeyName(keyName);
3 config.setInstanceType(InstanceType.DEFAULT);
4 config.setSecurityGroup(asList("default"));
5 ReservationDescription reservationDescription = ec2.runInstances(config);
ElasticFox
40
Amazon EC2 – Elastic Compute Cloud
• More to come:
• Load balancing
• Auto scaling
• Done already in Java by LifeGuard
• Cloud monitoring
• Management console
• The demo is on its way!
41
Compare!
Name OS JAPI Web UIOffline
Storage
Load
Balance
Custom
ImagesPrice
EC2 P P P
$0.10/hour for 1.7 GB
RAM, 1 core, 160 GB
HD
GoGrid P P P Oas AEC2, free inbound
traffic
AppNexus O O P P P$0.22/hour for 2.83GHz
server
FlexiScale SOAP P P P P£0.15/hour for 1.5GB
Ram, 1 Core
MS Azure O ? ? ? ?
42
Google App Engine
• Allows to run customer’s application on Google infrastructure
• Only Python is currently supported
• “Sandbox” version
• Other languages are on their way
• Free!
• 500 MB, 3 applications per user, bandwidth and queries limits
• Costs afterwards
44
Compare!
45
Compare!
Provider NameSupported Languages
Price Comments
Google App Engine Python Free
Network.com Any $1/hour not anymore
CarolineJava BC, Python,
Perl ? closed beta
Force.com Apex$25/month/us
erCRM
MS Azure .NET ? closed beta
More To Come
• Yahoo Cloud Infrastructure
• Working on internal, thinking about
external
• Hadoop
• Dell Cloud Computing
• HP Adaptive Infrastructure as a
Service
46
Agenda
• Introduction – The Missing Link
• Solutions Overview
• Drawbacks
• Resources and Links
• Demo!
47
Drawbacks
• Price
• Get a used desktop & put it under your table
• Price predictability
• A lot of charges
• EC2 – 7 types of charges per server
• Security
• Your content is somewhere out there
49
Drawbacks
• Physical location
• You are in Israel, your customers are
in Israel, but they are served from US
• Another point of failure
• S3 Beta downtimes of hours on
February and July
• Not in your control
50
Drawbacks - Terms of Use
• Service termination
• Amazon – “for any reason”, “at any time” & “for no reason” too
• Content screening and filtering
• Google – “pre-screen, review, flag, filter, modify, refuse, or remove any or all Content from the Service“
• Amazon – prohibit “discriminatory based on race, sex, religion, nationality, disability, sexual orientation, or age”
51
Agenda
• Introduction – The Missing Link
• Solutions Overview
• Drawbacks
• Resources and Links
• Demo!
52
Resources &Links
• AlphaCSP –Your Java Experts!
• www.alphacsp.com
• This presentation
• www.javaedge.net
• The Cloud Portal
• http://cloudcomputing.qrimp.com
• Elastic Servers on Demand
• AMI Factory
• www.elasticserver.com
54
The Demo Blog
55
The Demo Resources &Links
• The demo blog
• javaedge2008-cloud-demo.blogspot.com
• Typica – Amazon WS Java API
• code.google.com/p/typica
• Lifeguard – Amazon EC2 Java pool
• code.google.com/p/lifeguard
• Programming Amazon Web Services Book (published in March 2008)
• On Amazon.
56
Agenda
• Introduction – The Missing Link
• Solutions Overview
• Resources and links
• Demo!
57
Terracotta Architecture
59
© terracotta.org
Shared Queue Example
60