کامپیوتر و IT و اینترنتعلوم مهندسی

Developing Cloud Computing Applications with Java

صفحه 1:
۲ 5۱۱۵۲۱۲۵ حه» . 10-5 ظا 813,۵07 ‎shlomo.swidler@gmail.co‏

صفحه 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 1۱ ees oe

صفحه 3:
ecm ME ava Technology Day 5: About Me | تا رت رها ‎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 Se eee eects

صفحه 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 eee ee ‏کح‎ 0

صفحه 5:
Cloud Computing Is... ار ۱۱۱۲۰ لك فت انا ‎scalable and often virtualized + ces are‏ ‎provided 3 54 over the Internet. Users‏ ‎need not have knowledge of, expertise in, or‏ ‎control over the technology infrastructure in‏ ‎the “cloud” that supports them.‏ - Wikipedia لا ‎١‏ طاناا يها دمل لعب ‎Deere et‏

صفحه 6:
ااا الس مد ‎Cloud Computing ls...‏ Cerone teeter

صفحه 7:
ااا الس مد ‎Cloud Computing Is...‏ « Infrastructure as a Service — laaS « Platform as a Service — Paas « Software as a Service - Saas eee en et et

صفحه 8:
ام ا الس مد ‎Cloud Computing Is...‏ Computing Resources Infrastructure Platform ‏تست‎ ‎Processor ‏يتا >اع 568 هالاها‎ Memory (۷/۷۳ CRM System Storage Python VM SNe) Network MapReduce SCM System ودره ۳ ول ‎oe ceri‏ 227 ومد As a Service Pay-as-you-go or Subscription Se eee eects

صفحه 9:
Advantages of Cloud Computing From a Developer’s Perspective: Pay-as-you-go “utility computing” 0 ‏ترا‎ ‎0 On-demand resource allocation & release Scalability “ More on this later 0 ere (ere er

صفحه 10:
Risks of Cloud Computing Security Who else has access to “your” resources ? Recovery ۲ ۲۱۵۸ ‏7و 5و6‎ Provider lock-in ce coe en Ok gt 90

صفحه 11:
Amazon’s Cloud Platform: Amazon Web Services Processors & Memory Network “Elastic Compute Cloud Content Delivery “EC2” Network CloudFront ‎Messaging‏ تست ‎Simple Storage Service 0‏ ‎“S3” 2205‏ ‎| Elastic Block Store “EBS” | SimpleDB database ‏3 ميق وا وا مرول ‎Se eee‏ ‎

صفحه 12:
‎Java Technology Day —‏ كن ‎ ‎ElasticFox Firefox plugin

صفحه 13:
Developing on | NC Mid Standard stuff: Challenges: Language Scaling Libraries Communications ‏واع لمع 5 ماعلالا‎ Application Servers Databases mee for ee applications 1۱ ees te

صفحه 14:
Google’s Cloud Platform: Google App Engine Platform-as-a-Service ۷: Language User Accounts ۲ ‏اتهمع ما‎ 1 ‏ووز‎ ‎Image Transformation Storage 7 ‏م,منوهاده »و ۲۴۸۵و وه‎ ۰ ۵۵ ‏واطم‎ عطوز ۲۵۳ | eee ete et et ۳

صفحه 15:
Ee 0 Java Technology Day Google Dashboard ‏هل‎ Google Administration Console

صفحه 16:
Developing on Google’s Cloud ‏ك0‎ ۴۵5 ۰ Challenges: Scaling Language Libraries Communications Data Storage mae for new, lighter-weight applications SO eet ets

صفحه 17:
Application Development Challenges Posed by the Cloud Deploying to the Cloud Designing for Scalability eon ie Application Tier ‏ات۱۰‎

صفحه 18:
Application Development Challenges Posed by the Cloud Deploying to the Cloud 9 Designing for Scalability ” ome Application Tier ات۱۰

صفحه 19:
ا ی ‎Deploying to the Cloud‏ laaS platforms Mostly the same as traditional deployment PaaS & SaaS platforms Custom procedures Custom configurations تور ۹۲۵ “Google App Engine: Eclipse plug-in eee en et et

صفحه 20:
4: ۵ Java Technology Day — Deploy

صفحه 21:
‎Java Technology Day =:‏ ی ‎ ‏0 لعدة صا نوا.. مرعل جلقدا متجع تفي ‎see‏

صفحه 22:
الس مد ‎Designing the Application‏ ‎Tier for Scalability‏ ‎Me) Lena 4-1)‏ ات ات۸۰۱۱ عناد عاقالا ‎Optimize database queries‏ ‎Use in-memory caching‏ ‎Parallelize operations Use concurrent threads “Use the Service Pools design pattern ‎eee eer et or 62

صفحه 23:
Parallelize with Concurrent Threads ارهز Allow long-running tasks to proceed without impacting performance Java offers the java.util.concurrent ‏حتاف‎ ‎“ Executor interface ورین ات نا eee en et et ‏مه‎

صفحه 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... Se eee eects 000 0 0000

صفحه 25:
با به ‎Bee een x‏ ‎Eee gee eee eee rar 0‏ ‎mercy 2 o‏ ا ا الل لل ‎te‏ ‎perform the rest of the request handling code here f=‏ 77 چم 2 ‎eee recs =‏ عمو رقم 6ه عه 0] ان ا 0 2 ‎ce & ey 50 1-2 yee ‏اه‎ ‎” as 62 2 ‎pee enero 0 nes ere eerste 2 0 (Timeoutexception e) { ‏رو أ‎ eer eae eee rune seme crs - Sere reece ae) © ‏6ه‎ ‎7 23 rr: ‎000 ene eee ner ‎eM ree re ‏فد ل‎

صفحه 26:
Poe ee ‏زماهمااه‎ ‎1 ‎0 cers ics ۱ tants ۵۲ 5 0 7 000 ay a|dwexy eer ees ance) ها هه عم ز0ن : 0 00 = objectKey; 0 FutureTaskeT> getFroacachedperation = FutureTaskeT>( (iy ee iene ‏ل‎ ee Cees) 0 4 7 ۱ ant 00 لواو 1 5ه لت 0 tee ere

صفحه 27:
Parallelize with Service Pools لواسك ات سانا ‎Allow services to scale according to demand‏ ‎“Scale up and down‏ سا 9 Response Queue 0 ‏مما‎ eee tt er

صفحه 28:
Java Service Pool for Amazon Web Services: Open source 0 2.0 “ http://code.google.com/p/lifeguard/ ۱ a 9 ‏م‎ Response Queue 7۷7 " i [1 a koe Eo Onis

صفحه 29:
ام ‎ava Technology‏ ی ‎Lifeguard Framework‏ Framework provides: Message handling File handling Scaling logic Request SQS Queue Ingestor 3 011۳ ار رس <_ < ~~ per le a ۳ ۷ 5 1 en ل

صفحه 30:
Lifeguard Framework You provide: Ingestor ‏عءألااع5‎ ‎Pool Manager Configuration 2000 Request SQS Queue ‎ao}‏ رس ‎ ‎<_ < ‎Bai : ~~ per le 1 ۰ ae ‎10 eet ‏ا‎ ‎ ‎0

صفحه 31:
Pees eer a RS CSE aa ص0۳ ‎eres‏ ‎‘lane>Resizelnage</Nane>" +‏ ‎pies ete ete nes‏ هر و 0000 ac g 0111000 0 ere One 1 eee eee ree إلنا013|01ا313 31/3 10353610 ل اا ال سس

صفحه 32:
١ |۱۳ ‏معط‎ ‎۳ ‏و‎ ‎| ee eae es Bere ire eetscer str en aes 00 Precast creases 0 0 reenter 5 | | ctr cry 0 te إللا13|0نا3ناح لاد © دقاعت eee ‏ا‎ ee a 88

صفحه 33:
۳ ee ore eres ee eres 0 tem crs pee eae eee sneaaies See et ete <RanpDownInterval>1</RanpDownInterval> ee ens pore wares pee ere Sree erro er ties rene This configuration defines the SLA for this service That's all there is to implement The framework does all the rest os ete ere ee ۱ sJaHeue| |OOg 9y} SunHyuoD

صفحه 34:
Service Pool Pool of service instances dynamically scales with load Request SQS Queue ری ۳ 2 ] ‎ro‏ > os ~~ per le 1 F | 9 ‏عل‎ ل ا ‎ete‏ ار رس ٠

صفحه 35:
Service Pool Pool of service instances dynamically scales with load هه سح

صفحه 36:
Service Pool Multiple service pools scale independently ۲ ۳۳ 6

صفحه 37:
Service Pool Workloads can follow different workflows | Specify the Ingestor’s XML accordingly Ea ‎at‏ ال ‎

صفحه 38:
‎aha 3‏ ای ‎Developing Cloud‏ ‎Computing Applications with‏ ‎Java‏ ‎Q&A ‏ال 1

صفحه 39:
‎aha 3‏ ای ‎Developing Cloud‏ ‎Computing Applications with‏ ‎Java‏ ‏تست سرت ‎shlomo.swidler@gmail.com‏ ‎Thank you! ‏وس بو ‎

Developing Cloud Computing Applications Shlomo Swidler MyDrifts.com withCTO,Java shlomo.swidler@gmail.co m 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 2 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 3 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 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… 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…   Computing Resources Infrastructure Platform Software Processor LAMP Stack Email Memory JVM CRM System Storage Python VM ERP System Network MapReduce SCM System As a Service  22 June 2009 Pay-as-you-go or Subscription Developing Cloud Computing Applications with Java by Shlomo Swidler 8 Advantages of Cloud Computing  From a Developer’s Perspective:  Pay-as-you-go “utility computing” Saves time  Saves $$$   On-demand resource allocation & release  Scalability  22 June 2009 More on this later Developing Cloud Computing Applications with Java by Shlomo Swidler 9 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 10 Amazon’s Cloud Platform: Amazon Web Services Infrastructure-as-a-Service  Processors & Memory    Elastic Compute Cloud “EC2”  Storage    22 June 2009 Simple Storage Service “S3” Elastic Block Store “EBS” SimpleDB database Developing Cloud Computing Applications with Java Network  Content Delivery Network CloudFront Messaging  Simple Queue Service “SQS” by Shlomo Swidler 11 Amazon Dashboard ElasticFox Firefox plugin 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 12 Developing on Amazon’s Cloud Standard stuff: Challenges:  Language  Scaling  Libraries  Communications  Web Servers  Application Servers  Databases  Suitable for existing applications 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 13 Google’s Cloud Platform: Google App Engine Platform-as-a-Service  Language Python  Java   Storage  22 June 2009  User Accounts  Email  Image Transformation  Memcached JDO or JPA or Datastore APIs  Developing Cloud Computing Applications with Java Cron jobs by Shlomo Swidler 14 Google Dashboard Google Administration Console 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 15 Developing on Google’s Cloud Easy stuff: Challenges:  Scaling  Language  Libraries  Communications  Data Storage  Suitable for new, lighter-weight applications 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 16 Application Development Challenges Posed by the Cloud  Deploying to the Cloud  Designing for Scalability Web Tier  Application Tier   22 June 2009 Database Tier Developing Cloud Computing Applications with Java by Shlomo Swidler 17 Application Development Challenges Posed by the Cloud  Deploying to the Cloud  Designing for Scalability Web Tier  Application Tier   22 June 2009 Database Tier Developing Cloud Computing Applications with Java by Shlomo Swidler 18 Deploying to the Cloud  IaaS platforms  Mostly the same as traditional deployment  PaaS & SaaS platforms  Custom procedures Custom configurations  Custom tools   22 June 2009 Google App Engine: Eclipse plug-in Developing Cloud Computing Applications with Java by Shlomo Swidler 19 Deploying an Application to Google App Engine 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 20 Designing the Application Tier for Scalability 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 21 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 22 Parallelize with Concurrent Threads  Motivation  Allow long-running tasks to proceed without impacting performance  Java offers the java.util.concurrent package 22 June 2009  Executor interface  Future<T> interface Developing Cloud Computing Applications with Java by Shlomo Swidler 23 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 24 // 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 String memcachedKey = "userId:" + userId + ".lastLoginDate"; Future<Date> lastLoginDateGetter = MemcachedClient.get(memcachedKey, Date.class); Example: In-Memory Cache String userId = "visitor01"; 25 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 } java.util.concurrent java.util.concurrent.Callable; java.util.concurrent.Executor; java.util.concurrent.Executors; java.util.concurrent.Future; java.util.concurrent.FutureTask; Example: In-Memory Cache import import import import import } 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 26 Parallelize with Service Pools  Motivation Allow services to scale according to demand  Scale up and down  Request Queue Response Queue Storage 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 27  Java Service Pool for Amazon Web Services: Open source Apache License Version 2.0 Lifeguard  http://code.google.com/p/lifeguard/ Request Queue Response Queue Storage 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 28 Lifeguard Framework  Framework provides: Message handling  File handling  Scaling logic  Listener Response SQS Queue S3 Storage 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler EC2 Instances Ingestor Request SQS Queue Pool Mgr Config 29 Lifeguard Framework  You provide: Ingestor  Service  Pool Manager Configuration  Listener Response SQS Queue S3 Storage 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler EC2 Instances Ingestor Request SQS Queue Pool Mgr Config 30 private static final String ResizeImageWorkflowXML = "<Workflow>" + "<Service>" + "<Name>ResizeImage</Name>" + "<WorkQueue>ResizeImage-input</WorkQueue>" + "</Service>" + "</Workflow>"; public ResizeImageIngestor() { super(ResizeImageIngestorWorkflowXML); } public void ingest(File imageFile) { super.ingest(Collections.singletonList(imageFile)); } } Ingestor S3 Storage 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Implement the Ingestor public class ResizeImageIngestor extends IngestorBase { 31 public ResizeImageService() { super(ServiceConfigXML); } public List<File> executeService(File imageFile) { Image origImage = new Image(imageFile); File resizedImageFile = resizeImageToFile(origImage); return Collections.singletonList(resizedImageFile); } } S3 Storage 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler Implement the Service public class ResizeImageService extends AbstractBaseService { private static final String ServiceConfigXML = "<ServiceConfig>" + "<ServiceName>ResizeImage</ServiceName>" + "<WorkQueue>ResizeImage-input</WorkQueue>" + "</ServiceConfig>"; 32 <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 Pool Mgr Config Configure the Pool Manager <ServicePool> 33 Service Pool  Pool of service instances dynamically scales with load Listener Response SQS Queue S3 Storage 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler EC2 Instances Ingestor Request SQS Queue 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 35 Service Pool  Multiple service pools scale independently etc. 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 36 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 37 Developing Cloud Computing Applications with Java Q&A 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 38 Developing Cloud Computing Applications with Java Shlomo Swidler shlomo.swidler@gmail.com Thank you! 22 June 2009 Developing Cloud Computing Applications with Java by Shlomo Swidler 39

51,000 تومان