SlideShare a Scribd company logo
Developing Cloud Computing Applications with Java Shlomo Swidler CTO, MyDrifts.com [email_address]
Developing Cloud Computing Applications with Java Overview of Cloud Computing Amazon’s Cloud Platform Google’s Cloud Platform Application Development Challenges Posed by the Cloud… … and Java Solutions 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
About Me CTO & co-Founder  Music marketing on social networks Patent-pending targeting technology Java, MySQL, auto-scaling & cloud-based Active in the Cloud Computing community Open Cloud Computing Interface Working Group (an Open Grid Forum initiative) participant Contributor to Open Source cloud & Java projects 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Cloud Computing Is… A style of computing in which dynamically scalable and often virtualized resources are provided as a service over the Internet. Users need not have knowledge of, expertise in, or control over the technology infrastructure in the “cloud” that supports them. – Wikipedia  22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Cloud Computing Is… A style of  computing  in which dynamically scalable and often virtualized  resources  are provided  as a service  over the Internet. Users need not have knowledge of, expertise in, or control over the technology infrastructure in the “cloud” that supports them. – Wikipedia  22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Cloud Computing Is… 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Cloud Computing Is… 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Cloud Computing Is… Computing Resources As a Service Pay-as-you-go or Subscription 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Infrastructure Platform Software Processor LAMP Stack Email Memory JVM CRM System Storage Python VM ERP System Network MapReduce SCM System
Advantages of Cloud Computing From a Developer’s Perspective: Pay-as-you-go “utility computing” Saves time Saves $$$ On-demand resource allocation & release Scalability More on this later 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Risks of Cloud Computing Security Who else has access to “your” resources ? Recovery How easy is it ? Provider lock-in 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Amazon’s Cloud Platform: Amazon Web Services Infrastructure-as-a-Service Processors & Memory Elastic Compute Cloud  “EC2” Storage Simple Storage Service  “S3” Elastic Block Store  “EBS” SimpleDB  database 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Network Content Delivery Network  CloudFront Messaging Simple Queue Service  “SQS”
Amazon Dashboard ElasticFox Firefox plugin 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Developing on Amazon’s Cloud Standard stuff: Language Libraries Communications Web Servers Application Servers Databases Challenges: Scaling 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Suitable for existing applications
Google’s Cloud Platform: Google App Engine 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Platform-as-a-Service Language Python Java Storage JDO or JPA or Datastore APIs User Accounts Email Image Transformation Memcached Cron jobs
Google Dashboard Google Administration Console 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Developing on Google’s Cloud Easy stuff: Scaling Challenges: Language Libraries Communications Data Storage 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Suitable for new, lighter-weight applications
Application Development Challenges Posed by the Cloud Deploying to the Cloud Designing for Scalability Web Tier Application Tier Database Tier 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Application Development Challenges Posed by the Cloud Deploying to the Cloud Designing for Scalability Web Tier Application Tier Database Tier 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Deploying to the Cloud IaaS platforms Mostly the same as traditional deployment PaaS & SaaS platforms Custom procedures Custom configurations Custom tools Google App Engine: Eclipse plug-in 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Deploying an Application to Google App Engine 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Designing the Application Tier for Scalability 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Designing the Application Tier for Scalability Make sure your Storage Tier is optimized Optimize database queries Use in-memory caching Parallelize operations Use concurrent threads Use the Service Pools design pattern 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Parallelize with Concurrent Threads Motivation Allow long-running tasks to proceed without impacting performance Java offers the  java.util.concurrent  package Executor  interface Future<T>  interface 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
java.util.concurrent  Example: In-Memory Cache Existing implementations such as memcached Cache shared by all application instances Access is via the network Application requests an  Object  from the cache Time until response is received can vary True of any network operation Don’t let application code wait… 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
java.util.concurrent  Example: In-Memory Cache String userId =  &quot;visitor01&quot; ; String memcachedKey =  &quot;userId:&quot;  + userId +  &quot;.lastLoginDate&quot; ; Future<Date> lastLoginDateGetter = MemcachedClient. get( memcachedKey, Date. class ); // perform the rest of the request handling code here // then, at the end, get the user's last login date Date lastLoginDate =  null ; try  { lastLoginDate = lastLoginDateGetter.get(50, TimeUnit. MILLISECONDS); }  catch  (InterruptedException e) { // someone interrupted the FutureTask }  catch  (ExecutionException e) { // the FutureTask threw an exception }  catch  (TimeoutException e) { // the FutureTask didn't complete within the 50ms time limit lastLoginDateGetter.cancel( false ); } // return lastLoginDate to the presentation layer 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
java.util.concurrent  Example: In-Memory Cache import  java.util.concurrent.Callable; import  java.util.concurrent.Executor; import  java.util.concurrent.Executors; import  java.util.concurrent.Future; import  java.util.concurrent.FutureTask; public class  MemcachedClient { private static  Executor  executor  =  Executors .newFixedThreadPool (1); public static  <T> Future<T> get(String objectKey, Class<T> type) { final  String objectKeyFinal = objectKey; FutureTask<T> getFromCacheOperation =  new  FutureTask<T>( new  Callable<T>() { public  T call() { Object networkResponse =  requestObjectOverNetwork (objectKeyFinal);  return  (T) networkResponse; } } ); executor . execute(getFromCacheOperation); return  getFromCacheOperation; } private static  Object requestObjectOverNetwork(String objectKey) { // network stuff goes in here } } 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Parallelize with Service Pools Motivation Allow services to scale according to demand Scale up and down 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Request Queue Response Queue Storage
Java Service Pool for Amazon Web Services: Lifeguard Open source Apache License Version 2.0 http://code.google.com/p/lifeguard/ 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Request Queue Response Queue Storage
Lifeguard Framework Framework provides: Message handling File handling Scaling logic 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Request  SQS  Queue Response  SQS  Queue EC2  Instances Ingestor Listener S3  Storage Pool Mgr Config
Lifeguard Framework You provide: Ingestor Service Pool Manager Configuration 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Request  SQS  Queue Response  SQS  Queue EC2  Instances Ingestor Listener S3  Storage Pool Mgr Config
public class  ResizeImageIngestor  extends  IngestorBase { private static final  String  ResizeImageWorkflowXML  = &quot;<Workflow>&quot;  + &quot;<Service>&quot;  + &quot;<Name>ResizeImage</Name>&quot;  + &quot;<WorkQueue>ResizeImage-input</WorkQueue>&quot;  + &quot;</Service>&quot;  + &quot;</Workflow>&quot; ; public  ResizeImageIngestor() { super ( ResizeImageIngestorWorkflowXML ); } public void  ingest(File imageFile) {  super .ingest(Collections. singletonList (imageFile)); } } 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Ingestor Implement the Ingestor S3  Storage
public class  ResizeImageService  extends  AbstractBaseService { private static final  String  ServiceConfigXML  = &quot;<ServiceConfig>&quot;  + &quot;<ServiceName>ResizeImage</ServiceName>&quot;  + &quot;<WorkQueue>ResizeImage-input</WorkQueue>&quot;  + &quot;</ServiceConfig>&quot; ; public ResizeImageService() { super( ServiceConfigXML ); } public  List<File>  executeService(File imageFile) {  Image origImage =  new  Image(imageFile); File resizedImageFile = resizeImageToFile(origImage); return  Collections. singletonList (resizedImageFile); } } 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Implement the Service S3  Storage
<ServicePool> <ServiceName> ResizeImage </ServiceName> <VMImage> ami-39ba5df0 </VMImage> <WorkQueue> ResizeImage-input </WorkQueue> <RampUpInterval> 1 </RampUpInterval> <RampUpDelay> 360 </RampUpDelay> <RampDownInterval> 1 </RampDownInterval> <RampDownDelay> 480 </RampDownDelay> <MinSize> 0 </MinSize> <MaxSize> 20 </MaxSize> <QueueSizeFactor> 20000 </QueueSizeFactor> </ServicePool> This configuration defines the SLA for this service That’s all there is to implement The framework does all the rest 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Configure the Pool Manager Pool Mgr Config
Service Pool Pool of service instances dynamically scales with load 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler Request  SQS  Queue Response  SQS  Queue EC2  Instances Ingestor Listener S3  Storage Pool Mgr Config
Service Pool Pool of service instances dynamically scales with load 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Service Pool Multiple service pools scale independently 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler etc.
Service Pool Workloads can follow different workflows Specify the Ingestor’s XML accordingly 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Developing Cloud Computing Applications with Java Q&A 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler
Developing Cloud Computing Applications with Java Shlomo Swidler [email_address] Thank you! 22 June 2009 Developing Cloud Computing Applications with Java  by Shlomo Swidler

More Related Content

PPTX
Cloud Connect - OCCI & CloudAudit Standards Update
PDF
Autopilot : Securing Cloud Native Storage
PPTX
Keystone Updates - Kilo Edition
PDF
Devoxx 2015 - Building the Internet of Things with Eclipse IoT
PDF
Cloud standards interoperability: status update on OCCI and CDMI implementations
PDF
Opentelemetry - From frontend to backend
PDF
Openstack Workshop (Networking/Storage)
PDF
IoT gateway dream team - Eclipse Kura and Apache Camel
Cloud Connect - OCCI & CloudAudit Standards Update
Autopilot : Securing Cloud Native Storage
Keystone Updates - Kilo Edition
Devoxx 2015 - Building the Internet of Things with Eclipse IoT
Cloud standards interoperability: status update on OCCI and CDMI implementations
Opentelemetry - From frontend to backend
Openstack Workshop (Networking/Storage)
IoT gateway dream team - Eclipse Kura and Apache Camel

What's hot (20)

PDF
OpenNebula Conf 2014 | Practical experiences with OpenNebula for cloudifying ...
PDF
PDF
Introductions & CloudStack news - Giles Sirett
PPTX
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
PPTX
Cinder Updates - Liberty Edition
PPTX
OpenStack: Changing the Face of Service Delivery
PDF
Open stack architecture overview-meetup-6-6_2013
PDF
Securing Your Deployment Pipeline With Docker
PDF
rOCCI – Providing Interoperability through OCCI 1.1 Support for OpenNebula
PPTX
Dockerizing apps for the Deployment Platform of the Month with OSGi - David B...
PPTX
Cloud Networking - Greg Blomquist, Scott Drennan, Lokesh Jain - ManageIQ Desi...
PDF
Openstack Pakistan intro
PPTX
Neutron Updates - Liberty Edition
PDF
Introduction and Overview of OpenStack for IaaS
PDF
CSEUG introduction
PDF
NFVO based on ManageIQ - OPNFV Summit 2016 Demo
PPTX
All Things Open SDN, NFV and Open Daylight
PDF
The service mesh management plane
PDF
State of the Stack v4 - OpenStack in All It's Glory
PPTX
Modern vSphere Monitoring and Dashboard using InfluxDB, Telegraf and Grafana
OpenNebula Conf 2014 | Practical experiences with OpenNebula for cloudifying ...
Introductions & CloudStack news - Giles Sirett
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
Cinder Updates - Liberty Edition
OpenStack: Changing the Face of Service Delivery
Open stack architecture overview-meetup-6-6_2013
Securing Your Deployment Pipeline With Docker
rOCCI – Providing Interoperability through OCCI 1.1 Support for OpenNebula
Dockerizing apps for the Deployment Platform of the Month with OSGi - David B...
Cloud Networking - Greg Blomquist, Scott Drennan, Lokesh Jain - ManageIQ Desi...
Openstack Pakistan intro
Neutron Updates - Liberty Edition
Introduction and Overview of OpenStack for IaaS
CSEUG introduction
NFVO based on ManageIQ - OPNFV Summit 2016 Demo
All Things Open SDN, NFV and Open Daylight
The service mesh management plane
State of the Stack v4 - OpenStack in All It's Glory
Modern vSphere Monitoring and Dashboard using InfluxDB, Telegraf and Grafana
Ad

Viewers also liked (20)

PDF
The case for social business small
PDF
Proyectos de casas - Servicio de Arquitectura
PDF
PDF
CONAPREF 2016
PPTX
pantalla de internet exploer
PDF
Les économies d'énergie au quotidien (conférence du 15 novembre 2012)
PDF
Sin garantias
PDF
Family office elite magazine Spring 15
PDF
Solicitud Beca Fundación Mapfre
PDF
Hsp70 and Hsp90
PDF
Capacidad de degradación xenobióticas por microorganismos aislados de
PPS
Caminos
PDF
Second-life codigo SL
DOCX
Universidad pedagógica nacional tarea juank
PDF
question and answers for IIT JEE
PDF
"La emoción en el proceso creativo"
PDF
Ficheroasperger 131029134514-phpapp01-131111064300-phpapp01
PDF
Evolución en el marketing, de la emoción a la inteligencia
PDF
Using Goals, Goal Metrics and Rollup Queries in Microsoft Dynamics CRM 2011
PDF
Master Restauro
The case for social business small
Proyectos de casas - Servicio de Arquitectura
CONAPREF 2016
pantalla de internet exploer
Les économies d'énergie au quotidien (conférence du 15 novembre 2012)
Sin garantias
Family office elite magazine Spring 15
Solicitud Beca Fundación Mapfre
Hsp70 and Hsp90
Capacidad de degradación xenobióticas por microorganismos aislados de
Caminos
Second-life codigo SL
Universidad pedagógica nacional tarea juank
question and answers for IIT JEE
"La emoción en el proceso creativo"
Ficheroasperger 131029134514-phpapp01-131111064300-phpapp01
Evolución en el marketing, de la emoción a la inteligencia
Using Goals, Goal Metrics and Rollup Queries in Microsoft Dynamics CRM 2011
Master Restauro
Ad

Similar to Java Tech Day 2009 - Developing Cloud Computing Applications With Java (20)

PPT
Application Architecture For The Cloud
PDF
Deploying Java Applicationson Ec2
PDF
Cloudy in Indonesia: Java and Cloud
PPT
Cloud State of the Union for Java Developers
PDF
Java in the Cloud : PaaS Platforms in Comparison
PDF
Java in the Cloud : PaaS Platforms in Comparison
PDF
PaaS with Java
PPTX
Hello Cloud
PDF
"Portrait of the developer as The Artist" Lockheed Architect Workshop
PPTX
Application design for the cloud using AWS
PDF
Cloud Foundry and Ubuntu - 2012
PDF
Spring in the Cloud
PPTX
JavaOne 2016 "Java, Microservices, Cloud and Containers"
PDF
Java in the Age of Containers and Serverless
PDF
Java Web Programming Using Cloud Platform: Module 10
PDF
Java in the age of containers - JUG Frankfurt/M
PPTX
Designing for the Cloud Tutorial - QCon SF 2009
PDF
Interop 2011 - Scaling Platform As A Service
PDF
Evolution of PaaS
PDF
SD Forum Java SIG - Running Java Applications On Amazon EC2
Application Architecture For The Cloud
Deploying Java Applicationson Ec2
Cloudy in Indonesia: Java and Cloud
Cloud State of the Union for Java Developers
Java in the Cloud : PaaS Platforms in Comparison
Java in the Cloud : PaaS Platforms in Comparison
PaaS with Java
Hello Cloud
"Portrait of the developer as The Artist" Lockheed Architect Workshop
Application design for the cloud using AWS
Cloud Foundry and Ubuntu - 2012
Spring in the Cloud
JavaOne 2016 "Java, Microservices, Cloud and Containers"
Java in the Age of Containers and Serverless
Java Web Programming Using Cloud Platform: Module 10
Java in the age of containers - JUG Frankfurt/M
Designing for the Cloud Tutorial - QCon SF 2009
Interop 2011 - Scaling Platform As A Service
Evolution of PaaS
SD Forum Java SIG - Running Java Applications On Amazon EC2

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Electronic commerce courselecture one. Pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation theory and applications.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
A Presentation on Artificial Intelligence
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Advanced methodologies resolving dimensionality complications for autism neur...
Electronic commerce courselecture one. Pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation_ Review paper, used for researhc scholars
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine learning based COVID-19 study performance prediction
Cloud computing and distributed systems.
Encapsulation theory and applications.pdf
Programs and apps: productivity, graphics, security and other tools
Review of recent advances in non-invasive hemoglobin estimation
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity
A Presentation on Artificial Intelligence
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

Java Tech Day 2009 - Developing Cloud Computing Applications With Java

  • 1. Developing Cloud Computing Applications with Java Shlomo Swidler CTO, MyDrifts.com [email_address]
  • 2. Developing Cloud Computing Applications with Java Overview of Cloud Computing Amazon’s Cloud Platform Google’s Cloud Platform Application Development Challenges Posed by the Cloud… … and Java Solutions 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 3. About Me CTO & co-Founder Music marketing on social networks Patent-pending targeting technology Java, MySQL, auto-scaling & cloud-based Active in the Cloud Computing community Open Cloud Computing Interface Working Group (an Open Grid Forum initiative) participant Contributor to Open Source cloud & Java projects 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 4. Cloud Computing Is… A style of computing in which dynamically scalable and often virtualized resources are provided as a service over the Internet. Users need not have knowledge of, expertise in, or control over the technology infrastructure in the “cloud” that supports them. – Wikipedia 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 5. Cloud Computing Is… A style of computing in which dynamically scalable and often virtualized resources are provided as a service over the Internet. Users need not have knowledge of, expertise in, or control over the technology infrastructure in the “cloud” that supports them. – Wikipedia 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 6. Cloud Computing Is… 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 7. Cloud Computing Is… 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 8. Cloud Computing Is… Computing Resources As a Service Pay-as-you-go or Subscription 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Infrastructure Platform Software Processor LAMP Stack Email Memory JVM CRM System Storage Python VM ERP System Network MapReduce SCM System
  • 9. Advantages of Cloud Computing From a Developer’s Perspective: Pay-as-you-go “utility computing” Saves time Saves $$$ On-demand resource allocation & release Scalability More on this later 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 10. Risks of Cloud Computing Security Who else has access to “your” resources ? Recovery How easy is it ? Provider lock-in 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 11. Amazon’s Cloud Platform: Amazon Web Services Infrastructure-as-a-Service Processors & Memory Elastic Compute Cloud “EC2” Storage Simple Storage Service “S3” Elastic Block Store “EBS” SimpleDB database 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Network Content Delivery Network CloudFront Messaging Simple Queue Service “SQS”
  • 12. Amazon Dashboard ElasticFox Firefox plugin 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 13. Developing on Amazon’s Cloud Standard stuff: Language Libraries Communications Web Servers Application Servers Databases Challenges: Scaling 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Suitable for existing applications
  • 14. Google’s Cloud Platform: Google App Engine 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Platform-as-a-Service Language Python Java Storage JDO or JPA or Datastore APIs User Accounts Email Image Transformation Memcached Cron jobs
  • 15. Google Dashboard Google Administration Console 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 16. Developing on Google’s Cloud Easy stuff: Scaling Challenges: Language Libraries Communications Data Storage 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Suitable for new, lighter-weight applications
  • 17. Application Development Challenges Posed by the Cloud Deploying to the Cloud Designing for Scalability Web Tier Application Tier Database Tier 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 18. Application Development Challenges Posed by the Cloud Deploying to the Cloud Designing for Scalability Web Tier Application Tier Database Tier 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 19. Deploying to the Cloud IaaS platforms Mostly the same as traditional deployment PaaS & SaaS platforms Custom procedures Custom configurations Custom tools Google App Engine: Eclipse plug-in 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 20. Deploying an Application to Google App Engine 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 21. Designing the Application Tier for Scalability 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 22. Designing the Application Tier for Scalability Make sure your Storage Tier is optimized Optimize database queries Use in-memory caching Parallelize operations Use concurrent threads Use the Service Pools design pattern 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 23. Parallelize with Concurrent Threads Motivation Allow long-running tasks to proceed without impacting performance Java offers the java.util.concurrent package Executor interface Future<T> interface 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 24. java.util.concurrent Example: In-Memory Cache Existing implementations such as memcached Cache shared by all application instances Access is via the network Application requests an Object from the cache Time until response is received can vary True of any network operation Don’t let application code wait… 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 25. java.util.concurrent Example: In-Memory Cache String userId = &quot;visitor01&quot; ; String memcachedKey = &quot;userId:&quot; + userId + &quot;.lastLoginDate&quot; ; Future<Date> lastLoginDateGetter = MemcachedClient. get( memcachedKey, Date. class ); // perform the rest of the request handling code here // then, at the end, get the user's last login date Date lastLoginDate = null ; try { lastLoginDate = lastLoginDateGetter.get(50, TimeUnit. MILLISECONDS); } catch (InterruptedException e) { // someone interrupted the FutureTask } catch (ExecutionException e) { // the FutureTask threw an exception } catch (TimeoutException e) { // the FutureTask didn't complete within the 50ms time limit lastLoginDateGetter.cancel( false ); } // return lastLoginDate to the presentation layer 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 26. java.util.concurrent Example: In-Memory Cache import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.FutureTask; public class MemcachedClient { private static Executor executor = Executors .newFixedThreadPool (1); public static <T> Future<T> get(String objectKey, Class<T> type) { final String objectKeyFinal = objectKey; FutureTask<T> getFromCacheOperation = new FutureTask<T>( new Callable<T>() { public T call() { Object networkResponse = requestObjectOverNetwork (objectKeyFinal); return (T) networkResponse; } } ); executor . execute(getFromCacheOperation); return getFromCacheOperation; } private static Object requestObjectOverNetwork(String objectKey) { // network stuff goes in here } } 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 27. Parallelize with Service Pools Motivation Allow services to scale according to demand Scale up and down 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Request Queue Response Queue Storage
  • 28. Java Service Pool for Amazon Web Services: Lifeguard Open source Apache License Version 2.0 http://code.google.com/p/lifeguard/ 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Request Queue Response Queue Storage
  • 29. Lifeguard Framework Framework provides: Message handling File handling Scaling logic 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Request SQS Queue Response SQS Queue EC2 Instances Ingestor Listener S3  Storage Pool Mgr Config
  • 30. Lifeguard Framework You provide: Ingestor Service Pool Manager Configuration 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Request SQS Queue Response SQS Queue EC2 Instances Ingestor Listener S3  Storage Pool Mgr Config
  • 31. public class ResizeImageIngestor extends IngestorBase { private static final String ResizeImageWorkflowXML = &quot;<Workflow>&quot; + &quot;<Service>&quot; + &quot;<Name>ResizeImage</Name>&quot; + &quot;<WorkQueue>ResizeImage-input</WorkQueue>&quot; + &quot;</Service>&quot; + &quot;</Workflow>&quot; ; public ResizeImageIngestor() { super ( ResizeImageIngestorWorkflowXML ); } public void ingest(File imageFile) { super .ingest(Collections. singletonList (imageFile)); } } 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Ingestor Implement the Ingestor S3  Storage
  • 32. public class ResizeImageService extends AbstractBaseService { private static final String ServiceConfigXML = &quot;<ServiceConfig>&quot; + &quot;<ServiceName>ResizeImage</ServiceName>&quot; + &quot;<WorkQueue>ResizeImage-input</WorkQueue>&quot; + &quot;</ServiceConfig>&quot; ; public ResizeImageService() { super( ServiceConfigXML ); } public List<File> executeService(File imageFile) { Image origImage = new Image(imageFile); File resizedImageFile = resizeImageToFile(origImage); return Collections. singletonList (resizedImageFile); } } 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Implement the Service S3  Storage
  • 33. <ServicePool> <ServiceName> ResizeImage </ServiceName> <VMImage> ami-39ba5df0 </VMImage> <WorkQueue> ResizeImage-input </WorkQueue> <RampUpInterval> 1 </RampUpInterval> <RampUpDelay> 360 </RampUpDelay> <RampDownInterval> 1 </RampDownInterval> <RampDownDelay> 480 </RampDownDelay> <MinSize> 0 </MinSize> <MaxSize> 20 </MaxSize> <QueueSizeFactor> 20000 </QueueSizeFactor> </ServicePool> This configuration defines the SLA for this service That’s all there is to implement The framework does all the rest 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Configure the Pool Manager Pool Mgr Config
  • 34. Service Pool Pool of service instances dynamically scales with load 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Request SQS Queue Response SQS Queue EC2 Instances Ingestor Listener S3  Storage Pool Mgr Config
  • 35. Service Pool Pool of service instances dynamically scales with load 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 36. Service Pool Multiple service pools scale independently 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler etc.
  • 37. Service Pool Workloads can follow different workflows Specify the Ingestor’s XML accordingly 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 38. Developing Cloud Computing Applications with Java Q&A 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler
  • 39. Developing Cloud Computing Applications with Java Shlomo Swidler [email_address] Thank you! 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler