1. Cloudy in Indonesia – Java and Cloud
Eberhard Wolff
Architecture and Technology Manager
adesso AG
Twitter: @ewolff
Blog: http://ewolff.com
2. About me
► Eberhard Wolff
► Architecture & Technology Manager at adesso
► adesso is a leading IT consultancy in Germany
► We are hiring
► Speaker
► Author (i.e. first German Spring book)
► Blog: http://ewolff.com
► Twitter: @ewolff
► eberhard.wolff@adesso.de
3. Agenda
A Few Words About Cloud
Java and IaaS
PaaS – Platform as a Service
Google App Engine
CloudBees
Amazon Beanstalk
5. Infrastructure Platform Software
as a Service as a Service as a Service
> Virtual Servers > Virtual Application Server > Software or Service
that you use
> Similar to Virtualization > Handles Scale-Out
> Components that you
> Manage Everything > Mostly Managed by add/integrate into your
Yourself Provider app
6. Cloud might be...
• Private /internal “on premise”
– In your data center
– Useful in particular for larger organizations
• Public “off premise”
– Hosted and Operated by a third Party
– Ideal for Startups etc
• Even smaller enterprises can create private clouds
• Based on virtualization
7. Cloud at the Core is a Business Model
► Customer pays only for what he uses
> Per CPU hour or cycles, per GB of storage, per MB of network bandwidth
> Per user and year
> Not for having stand-by capacity
► Flexibility: More capacity is available on demand
> Instantly available
> Customer uses GUI or API to expand capacity
> Cloud provider is responsible for having capacity ready
► Makes IT just another service
8. Why Cloud?
► Compelling Economics
> Lower CapEx
> Cheaper handling of peak loads
> Better resource utilization
> Simple to achieve benefits – direct ROI
> Chances are your data center is not as efficient as Amazon’s, Microsoft’s or
Googles’s
9. Why Cloud?
► Flexibility and better productivity for development
> Self service portal
> Much easier to set up environments
> Feasible to have production-like environments quickly
and cheaply available
> …or environment for load tests
> Indirect: Better productivity leads to cost saving / better
time to market
10. Why Cloud?
► Better Service
> Higher Availability
> Better Reliability
> Redundancy across multiple data centers
> Lower latency because of local data centers
12. So, let me get started
► Get an account at an IaaS provider
► …or virtualize your data center and create a self service portal
► Install your (Java EE) environment
► Install your (Java) application
► Done
► Wow, that was easy!
13. That is not enough
► How do you deal with peaks? Need more app server instances
► The server instances must be shut down after the peak
► …otherwise you would pay for them
► Traditional middleware does not allow for that
► Elastic scaling
► RBMS prefer scale up (larger server)
► In the cloud it is easier to scale out (more server)
► That is why Amazon and Google use NoSQL / key-value stores
► Map / Reduce for analyzing large data sets
14. Cloud Influences the Programming Model
► Some Jave EE technologies are not a good fit
> Non-JMS messaging technologies
– AMQP / RabbitMQ
– Amazon Simple Queue Service (SQS)
– Amazon Simple Notification Service (SNS)
> Two Phase Commit / JTA leads to long locking / strong coupling
> What do you do about Map / Reduce?
> What do you do about NoSQL?
► You might be better off with a different programming model
> Spring can handle non-Java-EE environments (e.g. Tomcat)
> Projects for NoSQL, AMQP …
15. And what about Java EE 7?
► Java EE 7 is supposed to be about Cloud
> Multi-Tenant systems
> Probably new roles like PaaS Administrator
> Cloud services
► I am currently not aware of Cloud offerings that support Java EE out of the box
► I.e. beyond manual installation on an IaaS or provided images
► In particular no PaaS
16. More Flexibility Needed
► And remember: You pay the resources you consume
► You need to use more or less resources based on load
► You need to be able to shut down servers if load is low
► You need to be able to start new servers if load is high
17. What you will eventually come up with
► A tool to take an Application
App
► …and create a VM with all needed infrastructure etc
► Dynamically i.e. scale up and down
► Need tools to
> Install software
> Manage infrastructure
> Configure infrastructure
> Set up user etc
> Puppet, Chef etc.
► Like a factory for VMs
► Works on Private Cloud, Public Cloud or your VM VM
local machine
► Vagrant
18. So…
► Very flexible
► Works for any IaaS and any software to be installed
► Works for complex environments with many infrastructure pieces
> Install a database server, some Tomcats, a load balancer and a cache server
> Fine tune all the parameters
► Can deploy different parts of the application to special nodes
► But often developers just want a platform to run applications on
► No fine tuning
► Also: Developers need other non-Java-EE services
21. PaaS
► Platform as a service (PaaS) is the delivery of a computing platform and solution
stack as a service.
22. PaaS: Advantages and Disadvantages
Advantages
• More useful than IaaS: You would need to install a server anyway
• Automatic scaling
– Resources automatically added
• Can offer additional service
• Tuned for Cloud
• Technical e.g. data store, messaging, GUI elements
• …but IaaS does the same (Amazon)
Disadvantages
• Less flexible
• Pre-defined programming model
• Defines environment
• Programming model might be different
• Hard to port existing code
• Need to learn
24. Google App Engine
Infrastructure offered by Google
Supports Java and Python
Infrastructure completely hidden
GAE sandbox more restrictive than normal JVM sandbox
So GAE can handle your application better
Java classes white list
• i.e. some Java classes must not be used
• no Thread
• no file system
• parts of System class (e.g. gc(), exit()…)
• Reflection and ClassLoader work
25. Google App Engine: Storage
Relational database only in App Engine for Business
Based on BigTable
• Google's storage technology
• High replication or simple master / slave
• Key/value i.e. objects stored under some key
• No joins
• Simple / simplistic (?)
• Scalable
• Example of NoSQL
Max. 1 MB per entity (and other limitations)
26. Google App Engine: Storage APIs
API: Low level com.google.appengine.api.datastore
• Not compatible to JDBC or the like
• Queries, transactions, entities etc.
• Should only be used by framework
API: JDO (Java Data Objects)
• Standard for O/R Mapper and OODBMS
• Unsupported: Joins, JDOQL grouping and aggregates, polymorphic queries
API: JPA (Java Persistence API)
• Well established standard for O/R Mappers
• Unsupported: Many-to-many relationships; join, aggregate and polymorphic
queries, some inheritance mappings
Problem: JPA / JDO based on RDBMS, but this is key/value
So maybe use the low level API instead?
JPA and JDO actually implemented by Data Nucleus library
• Byte code must be enhanced in an additional compile step
27. Google App Engine: Additional services
Memcache
• Implements JCache (JSR 107)
• Fast access to data in memory
URL Fetch based on java.net.URL to read data via HTTP
EMail support using JavaMail
XMPP instant messages (proprietary API)
Image Manipulation (proprietary API)
Authentication / Authorization based on Google accounts (proprietary API)
Task queuing (proprietary API, experimental)
Blob store (proprietary API, experimental) for data >1MB
Channel (to talk to JavaScript in the browser)
Numerous other services available (not tied to App Engine)
Google Predict, Google BigQuery, AdSense, Search, …
28. Google App Engine for Business
► Centralized administration.
► 99.9% uptime SLA
► Premium developer support available.
► Sign on for users from your Google Apps domain
► Announced
> SSL on your company’s domain for secure communications
> Access to advanced Google services
> Relational database
29. Google App Engine
Documentation + SDK + Eclipse Plug In available
SDK contains environment for local tests
http://code.google.com/appengine/
30. Google App Engine
► Pioneer: Very early in the market
► Very restrictive environment
> Limited sandbox
> Focus on NoSQL while typical Java applications use RDBMS
> Limit on start up time of application etc
> Limit on response time (30 seconds)
> No control or access to operating system
> Not even the web server
► So specialized frameworks have been created (Gaelyk for Groovy)
► Benefits?
32. Amazon Web Services
► Collection of Cloud Offerings (mostly IaaS)
► Elastic Compute Cloud (EC2)
► Elastic Map Reduce
► Auto Scaling
► SimpleDB : Big Table like NoSQL database
► Simple Queue Service (SQS)
► Simple Notification Service (SNS)
► Simple Email Service (SES)
► Virtual Private Cloud (VPC)
► Simple Storage Service (S3)
► Elastic Block Storage (EBS)
► Third party offerings like https://mongohq.com/ for MongoDB and
https://cloudant.com/ for CouchDB
33. Amazon BeanStalk
► Based on the Amazon EC2 infrastructure
► …and Auto Scaling and S3
► Add Linux, OpenJDK, Tomcat
► Currently in beta
► …and only in US-East
► Eclipse Plug In available
► Supports version handling of applications
► Supports elastic scaling depending on load indicators
► Simple Monitoring built in
► Detailed control over the environment (Tomcat parameters, used AMIs, log in to
machine etc.)
34. Amazon BeanStalk
► Access to Tomcat logs etc.
► Access to the OS
► Fine tuning of Tomcat parameters possible
► Easy, yet powerful
► Videos to get started
► Demo application based on Spring
> Uses also S3 (storage) and Simple Notification Service (SNS)
► Add Relational Database Service (RDS) for enterprise scale MySQL
► …and all the other Amazon Web Services (AWS)
35. Amazon BeanStalk
► Much like your average Enterprise Java environment
► =Tomcat + RDBMS
► Cloud features like elastic scaling available
► Can easily add other AWS elements
► Runs on a proven environment
► But: 1 server = 1 virtual machine
► GAE can run multiple applications on one machine
► More cost efficient (?)
37. CloudBees: DEV@Cloud
► In fact two services: DEV@Cloud and RUN@Cloud
► DEV@Cloud: Developer services
► Continuous Integration (Jenkins)
> Good application of the Cloud: Peaks and high load only during working hours
> Standardized and universally applicable service
> Some Essentials Plug Ins in free version
> More in Base / Pro / Enterprise pay version
> Also more parallel build in pay version
> …and faster build machines
► Maven repository
> Snapshot / Release
> Builds can be automatically deployed
► Potentially other services
38. CloudBees: RUN@Cloud
► Tomcat on EC2
► Easily deploy a WAR
> either by web interface
> or command line utility (bees SDK)
► Little control
> Only 256MB heap
> Single instance or multiple instance
> No elastic scaling
> Potentially cheaper: Can you multiple application on one machine
► Simple monitoring (web / command line)
► MySQL database
> Very simple (i.e. just one server, but backup included)
> Could use Amazon RDS instead
39. Java in the Cloud: Conclusion
Feasible to run Java applications in the cloud
IaaS
Maximum control
Automatic installation needed
Also works on private cloud / virtualized environment
Google App Engine
Very limited sandbox
Advantage?
Amazon Beanstalk
Standard Enterprise Java Stack
Lots of additional Amazon Web Services (Relational Database Service)
CloudBees
DEV@Cloud: Developer-only features (Jenkins)
RUN@Cloud: simple but probably more price efficient
40. Wir suchen Sie als
Software-Architekt (m/w)
Projektleiter (m/w)
Senior Software Engineer (m/w)
jobs@adesso.de
www.AAAjobs.de