Your SlideShare is downloading. ×
Java and windows azure cloud service
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Java and windows azure cloud service


Published on

Java on Windows Azure Cloud Service

Java on Windows Azure Cloud Service

Published in: Education

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Java on Windows Azure Cloud Service 黃忠成
  • 2. Windows Azure OverviewCloud Service Web Role Worker RoleVirtual MachinesWeb SitesVirtual NetworkMobile ServiceMedia Service
  • 3. VM and Cloud ServiceVirtual Machines IaaS Load Balancing by Setting (from Portal) Scale out need more actions OS is maintain by your self Provides Management APICloud Service PaaS Load Balancing by Auto Scale out is simple and automation OS, and software included will patching auto, you don’t need maintain Provides Management API
  • 4. Java On Windows Azure
  • 5. 環境的準備.NET Framework 2.0/3.5JDKWindows Azure SDK 1.8EclipseEclipse Plug-InsTomcat
  • 6. Installing.NET Framework 2.0/3.5Installing JDK 7Installing Eclipse 3.7Install Windows Azure SDK x409Install Tomcat 7
  • 7. Install Eclipse Plug-Ins
  • 8. 讓我們開始吧
  • 9. Creating Dynamic Web Project
  • 10. Add index.jspDemo and Run
  • 11. Add Windows Azure Deployment Project
  • 12. Include JDK and Tomcat
  • 13. Add Deployment WAR files
  • 14. Session, Cache, and Remote Debugger稍後我們會深入討論這個畫面中的設定
  • 15. 整個專案樹會變成這樣
  • 16. Run In Emulator
  • 17. 現在在哪?我們的Web Project會編譯並打包為.WAR當按下Run In Windows Azure Emulator後,會將.WAR及Cloud Service相關設定打包成.csdef,cscfg及.cspkg,並啟動本地端的Windows Azure Computer Emulator來執行.這是一個本地端的Cloud Service 模擬器.
  • 18. Enable Remote Debugger
  • 19. Add Breakpoint and Run Emulator
  • 20. Starting Debug
  • 21. 最終結果
  • 22. Publish to Cloud Service
  • 23. Publish To Cloud Service
  • 24. Publish To Cloud Service
  • 25. Publish To Cloud Service
  • 26. Waiting for Publish
  • 27. Testing in Cloud Service
  • 28. 開發流程 使用本地端的 建立Windows 撰寫你的Web Tomcat來測試 Azure Deployment Application 及除錯 Project Import WAR(從你 在模擬器上測試及 的Web Application 除錯 Project)Remote Debugger 佈署至雲端
  • 29. About Remote DebuggerYou can debug in local and cloud serviceAfter package is deployment, you can create debugconfiguration and starting debug
  • 30. Remote Connect
  • 31. Welcome your Worker Role
  • 32. 管理你的Cloud ServiceRemote Connect
  • 33. SWAP to Production slot
  • 34. SCALE
  • 35. Change Remote Desktop Password
  • 36. Access Database
  • 37. Creating MySQL(ClearDB)
  • 38. Get Connection Information
  • 39. Testing Connecting
  • 40. Add MySQL JDBC Driver
  • 41. Using code
  • 42. Creating SQL Azure Database
  • 43. Connecting with SQL Management Studio
  • 44. Connecting with CodeAdd SQL Server JDBC Driver
  • 45. Get Connection String
  • 46. Connecting with code
  • 47. 存取Storage Services
  • 48. 建立Storage Services Account
  • 49. Add Azure Client Library to Project
  • 50. Use Table Storage Service
  • 51. Add useTable.jspImport Azure Client Library in .jspPrepare connection string
  • 52. About Connection String
  • 53. Creating Entity ClassEntity class must Inherit from TableServiceEntityAdd Properties
  • 54. About Partition key and row key Table use Partition key and row key as Primary Key Partition Key will help data partition Appropriate use of Partition key will increase performance for accessing Table Storage
  • 55. Creating Table and Add Entity
  • 56. RunDemo
  • 57. Is Done???Download Azure Storage Explorer
  • 58. Testing
  • 59. Make thing easy….Creating StorageClient Helper classesCreating TableHelper classes
  • 60. Demo and TryingDemo
  • 61. Using Blob Storage Service
  • 62. Blob StorageBlob Storage can store large data itemBlob Storage is durability and scalableBlob Architecture Account Container Blob IMG001.JPG pictures IMG002.JPG sally movies MOV1.AVI
  • 63. Blob TypesBlock Blob Block Blob 最大支援至200GB Block Blob 可以分區塊上傳,每個Block最大為4MB,直到呼叫Put Block List前,所上 傳的區塊都不會成為檔案的一部份,因此沒有人可以存取未呼叫Pub Block List前 的區塊資料 當上傳檔案小於64MB時,可選擇直接上傳而不分區塊 Block Blob 通常用於儲存影片等須完整後才能提供下載的檔案Page Blob 最佳化亂數存取型,常用於儲存即時性資料,沒有檔案完整性的確認機制 Page Blob於建立時即需指定大小,之後可分區塊寫入(每個區塊大小必須符合512 Byte的倍數, 最大為1TB, 與Block Blob不同,一經上傳完成,該區塊即成為檔案的一 部份,所有人皆可取用 Page Blob 最大支援至1TB Page Blob 通常用於Client Application,例如Silverlight,WPF or WinForm
  • 64. Creating Upload HandlerDemo
  • 65. Create Blobs.jspDemo
  • 66. Using Queue Service
  • 67. Creating Queue.jspDemo
  • 68. Using Storage EmulatorWindows Azure SDK provides Storage ServiceEmulator
  • 69. Testing our Application with Storage Emulator
  • 70. Storage Emulator NotesIt’s Emulator, do not provides full function !!We recommend you testing in real Cloud StorageService
  • 71. Enable CDN for Storage Service
  • 72. Why use CDNCDN will deliver storage content to worldwide CDNServersUser access same CDN endpoint will redirect to nearCDN ServerI.e.: User in East US will connect to East US CDN Server User in East Asia will connect to East Asia CDN Server
  • 73. Enable CDN on Storage Services Back to Previous Portal
  • 74. Enable CDN on Storage Services
  • 75. Enable CDN on Storage Services CDN will take 60 minutes to activate
  • 76. Changing URL of Resource link Just change url from blob storage endpoint to CDN endpoint Like FpcWQ3H1THKOEHyGrjQGA.jpg To 3H1THKOEHyGrjQGA.jpg
  • 77. Using CDN notesAccess static pictures/resources/javascriptsWhen storage is changed, CDN may need 72-hours torefresh statusFor real-time resources, use storage service insteadCDNCDN will provides purged API in feature.
  • 78. Enable Caching
  • 79. Introducing Windows Azure Caching Provides general Caching Services Provides two Cache Services Role-base Caching Shared Caching support memcache protocol Node.js PHP Java
  • 80. About Co-located and Dedicated Co-Located Caching Use same Role memory to caching data You should not use large memory for caching Dedicated Use another Role memory to caching data In general , we will use all memory for caching
  • 81. PreparingDownload spymemcached.jar(2.8.1) tAdd .JAR to Project
  • 82. Configure a Co-Located Caching
  • 83. Testing in EmulatorDemo
  • 84. Configure a Dedicated Caching Add memcache_default Endpoint
  • 85. Configure a Dedicated Caching Import Caching Folder as Components
  • 86. Configure a Dedicated Caching Import Caching Shim Folder as Components
  • 87. Configure a Dedicated Caching Add MemcacheShimInstaller.exe as Component
  • 88. Configure a Dedicated Caching Add web.config in WorkerRole1approot
  • 89. Configure a Dedicated Caching Creating New Worker Role
  • 90. Configure a Dedicate CachingEnable Co-located Caching in DedicateCache Role
  • 91. Test in Emulator
  • 92. Caching Setting
  • 93. About Sessions and Multiple Instances
  • 94. Default SessionsCloud Services will use Round-Robin to accomplishload balanceIn 2 Instances the user first enter the page will direct to Instance A We save some data in session Then user click some button then will direct to instance B Session will not exists in Instance B (lost session)
  • 95. Enable Sticky Session
  • 96. Modify Instance Count
  • 97. Add session operations in index.jsp
  • 98. Test in CloudDemo
  • 99. Manually Upload Package
  • 100. Build Cloud Deployment Package
  • 101. Upload Cloud Deployment Package To Cloud Service Create Cloud Service
  • 102. Add Remote Connect Certification
  • 103. Upload Cloud Deployment Package To Cloud Service Upload Package
  • 104. Optimized Deploy
  • 105. Include JDK and tomcat will increase deployment package size
  • 106. Create JDK Package Not only JRE, full JDK Required.
  • 107. Create Tomcat Package
  • 108. Upload JDK and Tomcat to cloud
  • 109. Creating Empty Deployment Project
  • 110. Export WAR
  • 111. Add BlobDownloader.exe and .cfg, StorageClient.dll to app root
  • 112. Modify BlobDownloader.exe.cfg Change storage account and access key
  • 113. Modify startup.cmd
  • 114. Test in EmulatorDemo
  • 115. The Deployment Package Size
  • 116. Understanding startup.cmdStartup.cmd like autoexec.bat, executing in VM start-upYou can do everything in here Download something Executing any executable file Set Environment VariablesJust remember This startup.cmd must end, so if you need execution tomcat(startup.bat), you need use cmd /c to creating another command line window
  • 117. Understanding run.cmdWhen startup.cmd is end, run.cmd will be executingIn samples, here will use utilwhileproc.cmd java.exe This command will keep detecting java is running or not If java.exe is not in running status(not in process explorer) Fabric Controller will mark this VM is down Switch to another VM
  • 118. The Deploy Processing VM Deploy Run startup.cmdStarting packages Run run.cmd
  • 119. So….Anything can be done in command line will also canbe done in Worker RoleSo You can use Play Framework You can use other Web Server, like apache or Jboss you can use Apache Lucene as Search Engine
  • 120. Caching Service as Session
  • 121. Sticky Session的問題當握有Session的VM/Role出現問題導致當機時, 該機器上的Session將完全消失 也就是說這種Session處理方式是不具容錯性的使用Caching Service來儲存Session的優點 Session儲存於外部機器 儲存Session的機器本身也是一個Cloud Service,所以具 備容錯及Replication能力
  • 122. 怎麼做?建立Dedicated Caching下載Tomcat Session Manager在Web Application專案中加入spymemcached.jar的引用
  • 123. 建立context.xml
  • 124. 引入Tomcat Session Manager至 Deployment Project 修改Startup.cmd
  • 125. TestingDemo
  • 126. Move Non-Web Application to Cloud Service
  • 127. 轉移Desktop Application至Cloud Service
  • 128. 怎麼做?建立Windows Azure Deployment Project輸出.JAR至Windows Azure Deployment Project的approot目錄下開啟必要的port(如果需要的話)
  • 129. 修改startup.cmd
  • 130. Web <-> Background Agent
  • 131. 一個較為複雜的分散式架構 位於機器A的服務 接收需求, 並分配需求User 到後端的Services Service A Web Application 位於機器B的服務 Service B 在這種架構下, Service A及B屬於內部 網路, 使用者無法直接連到
  • 132. 怎麼做?建立Service建立Web Application建立Deployment Project建立另一個Worker Role
  • 133. 怎麼做?輸出Service的.JAR至ServerRole的approot目錄下修改ServerRole的startup.cmd添加必要的port(internal)
  • 134. 怎麼做?Web Application如何連接到Service??
  • 135. TestingDemo
  • 136. Without EclipseUse Other IDE
  • 137. PrepareInstall Ant Azure Start Kit for Java orEclipseWithJavaMake sure Antbin and java environment variables isset.
  • 138. Creating .WAR (NetBeans 7)
  • 139. Extract Start Kit for Java
  • 140. Copy .WARCopy .war from dist folder (NetBeans 7)
  • 141. Include JDK and Tomcat Zip files
  • 142. Copy Sample startup.cmdDelete approotstartup.cmd, rename startupApacheTomcat7.txt tostartup.cmd
  • 143. Modify startup.cmdMake sure all name is correct
  • 144. BuildUse Ant to build project In deploy project folder ant -buildfile package.xml
  • 145. Test in EmulatorExecutionDeployProjectEmulatorToolsRunInEmulator.cmd
  • 146. Prepare for Cloud PackageModify package.xml in DeployProject root
  • 147. Change packageTypeant -buildfile package.xml
  • 148. Upload Package to CloudCreating Cloud ServiceUpload Sample Certification The password is Password1
  • 149. Upload Package to Cloud
  • 150. Optimized againWar Hot Deploy
  • 151. Understanding run.cmdWhat’s whileproc.cmd ?Writing own wardetecting.exeChanging startup.cmdChanging run.cmdDeploy and testingTry hot deploy
  • 152. ResourcesDevelop Center Caching us/library/windowsazure/gg278356.aspxMy Blog
  • 153. Samples JDK and Tomcat is not included