Latest News

Monday, 30 April 2012

5 Things all Java developer should know when developing for the cloud

The last couple of years, "Cloud Computing" replaced Web 2.0 as the new buzzword. You can read, hear and see everywhere the cloud is coming. To most developer, this is still the same old sh*t. If you have experience in developing distributed system then you should be fine, you say. Well not entirely true, the IT department wants to deploy on cheap cloud and therefore some restrictions now applies. I will list 5 things that I think all developers should know when working with cloud Platform as a Service provider such as Amazon Beanstalk or Google App Engine. This list also applies to IaaS architecture. Some of the points might be obvious to the more experienced, nevertheless, they need to be mentioned.

  • Static objects
We all know the difference between instance variable (non-static) and class variable (static variable). We use static to tell the JVM that they should only be one instance of this variable (singleton). If the static variable is declared with the "final" keyword, this will not cause a problem in a distributed environment as the value will never change. The problem is when we expect the value of the variable to change. As in a cluster environment, GAE and Beanstalk run your application in multiple JVM. If a the value of your static variable has changed in JVM, it will not be propagated to the cluster therefore leading to inconsistencies. I recommend that you avoid static variable unless that set as "final" and their values are hard-coded so there is no way to change their values are runtime.

  • Caching Objects
This one is related to performance in order to avoid expensive operations such as running database queries and others. Sometimes we need to cache objects in memory and therefore we implement our own caching strategy through the use of simple HashMap or some other caching solutions available outthere. Caching has many benefits but implementing a caching strategy should be approached with care. This is because caching has the same problem as static objects. Your cache will be in the local JVM therefore not it will not be visible in the cluster. There are some solutions, for example, GAE uses Memcached and Beanstalk can make use of Amazon ElastiCache which is compliant with Memcached. When developing for a PaaS environment, make sure to not implement your own caching system but look for one that is supported by the vendor. I know this can lead to vendor lock-ins.

  • Server-side Session
Something we do take for granted in single environment is storing application session data on the server. Based on experiences, mainly using GAE, I encountered multiple issues with session management. Since then, Google has fixed alot of the issues with the way GAE handle sessions for Java application. To minimize writing session to a datastore, we store application state in memory. Most application are written without any vendor approach in mind; so we use JEE as-is. This approach would work in you deploy in any self hosted clustered environment but Google PaaS. Google implements their own session management which is off by default therefore you need to enable it in appengine-web.xml and make sure that all your objects implements the java.io.Serializable interface. 
Note: Note, session data is always written synchronously to memcache. If a request tries to read the session data when memcache is not available (or the session data has been flushed), it will fail over to the datastore, which may not yet have the most recent session data. This means that asynchronous session persistence may cause your application to see stale session data. However, for most applications the latency benefit far outweighs the risk.

  • Event-driven Execution
This is more about running a process at a given time such as Scheduling task. Again, in a managed environment, it is straightforward to implement a timer or scheduler service. But this is a clustered environment which is not managed by yourself and their stack his different to yours. I personally use Quartz Scheduler when working in a single server environment. In a clustered environment such as Beanstalk or GAE, it is difficult to know which instance will be triggered and execute the task only once. The folks at Google have provided another solution with their own implementation of Cron for Java which can be used. At the time of writing, Amazon Beanstalk didn't have a solution yet. Therefore, consider before-hand when designing your system, which approach to take in order to create scheduled tasks for your application.

  • JRE white list
I believe this related to GAE J only. Google App Engine for Java doesn't allow the use for all available API in Java, especially if they do require access to the file system. The fact that there is a such a restriction impose by the Google has led us to look elsewhere for some of our projects. The cost of re-developing our application to please them is much higher than deploying them elsewhere. Also, another downside of GAE J is doesn't fully support JEE servlet specification. You cannot implement custom security for your application through your web.xml therefore pushing you to use Google own security mechanism. I would recommedn using GAE J when developing a greenfield project which can be built with these restrictions here  and here in mind. If you want to be locked-in using GAE J for your application, then I recommend it as a cost efficient way to testing your application otherwise, look somewhere else.

I hope this was helpful and if there's mistake, feel free to get back to me and I make any corrections. Also, I am sure that I am missing some other points, add them to the comments sections.

P.S. here is a nice comparison from IBM

Cheers and Happy Coding.



  • Blogger Comments
  • Facebook Comments

624 comments :

  1. Hi Armel, Have you tried Heroku? I'd love to hear your feedback.

    -James

    ReplyDelete
    Replies
    1. Hi James, I haven't used Heroku yet. Funny enough I was looking at yesterday to try to understand what it brings to the table. I am also considering Cloud Foundry as alternative to GAE and Beanstalk. I will let you know once I tried it.

      Delete
  2. For point #1 to #4, those are things you have to take care of when you develop applications which are going to be deployed in a cluster. They apply to cloud application development, but they are not new to cloud. If you do want to cache data, you need some sort of messaging system to synchronize data across multiple servers.

    ReplyDelete
    Replies
    1. Hi Jun, you're right. Those need to be taken care of in clustered environment. The point here is that you do not really have the freedom to use whichever framework you want as it might not be supported by the cloud vendor therefore leading to vendor locking. Some vendors do not support caching and only recently implementing a caching mechanism such as Amazon ElastiCache.

      Delete
  3. Thanks for the nice intro into the Cloud. I'll just comment on using JEE which is not official (though common): http://www.java.com/en/about/javanaming.jsp "Please say Java"

    ReplyDelete
  4. Programming in cloud..a good start for me..

    ReplyDelete
  5. Good Article ...

    ReplyDelete
  6. I have very minimal knowledge on Cloud. With this article I learnt new things on Cloud in Java Perceptive. Good one. Thanks.

    ReplyDelete
  7. I am new to the combination of cloud and java but as per my development experience cloud have bright future with java EE 5 and 6 as it consist EAR which makes cloud apps provisioning easy.

    ReplyDelete
  8. Thanks for sharing useful information. I always make sure to bookmark pages like this because you know it will be useful in the future too. thanks again.
    cloud backup

    ReplyDelete
  9. I'm the same way I do my best to remain neutral. It's hard if you communicate with the person the other person dislikes then you fall out of favor with them! I simple can't dislike a person just because someone else does I just can't.
    child custody investigation

    ReplyDelete
  10. I really believe you will do much better in the future I appreciate everything you have added to my knowledge base. Admiring the time and effort you put into your blog and detailed information you offer!
    contacts

    ReplyDelete
  11. Thanks for sharing information for Java Developers . These are the best guidelines.

    ReplyDelete
  12. Hello everyone, Are you into trading or just wish to give it a try, please becareful on the platform you choose to invest on and the manager you choose to manage your account because that’s where failure starts from be wise. After reading so much comment i had to give trading tips a try, I have to come to the conclusion that binary options pays massively but the masses has refused to show us the right way to earn That’s why I have to give trading tips the accolades because they have been so helpful to traders . For a free masterclass strategy kindly contact (paytondyian699@gmail.com) for a free masterclass strategy. He'll give you a free tutors on how you can earn and recover your losses in trading for free..

    ReplyDelete
  13. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work.
    คาสิโนออนไลน์UFABET
    เว็บพนันออนไลน์ufacasino
    คาสิโนออนไลน์ที่ดีที่สุด

    ReplyDelete
  14. This is very Amazing and Very Informative Artical we get alot of Informations from this artical we really appreciate your team work keep it up and keep posting such a informative articles.
    SLOT UFABET
    เกมสล็อตออนไลน์บนมือถือUFABET

    ReplyDelete
  15. I read this article. I think You put a lot of effort to create this article. I appreciate your work. อีเบท . eBETGaming . รีวิวเว็บพนันeBET

    ReplyDelete
  16. I went to this website, and I believe that you have a plenty of excellent information, I have saved your site to my bookmarks.
    เกมสล็อตออนไลน์บนมือถือUFABET
    เดิมพันสล็อตออนไลน์

    ReplyDelete
  17. This is very Amazing and Very Informative Artical we get alot of Informations from this artical we really appreciate your team work keep it up and keep posting such a informative articles
    Venus Casino
    Casino Venus
    วีนัส คาสิโน

    ReplyDelete
  18. I read this article. I think You put a lot of effort to create this article. I appreciate your work. venus casino online . เดิมพันออนไลน์Venus Casino . แนะนำเว็บVenus Casino

    ReplyDelete
  19. We help them as much as we can. If they need assistance with research, writing, grammar, formatting or proofreading, we provide our assistance to help them build their career. eBETGaming. รีวิวเว็บพนันeBET. วิธีเดิมพันeBET Casino

    ReplyDelete
  20. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also แทงเสือมังกรออนไลน์.

    ReplyDelete
  21. I read this article. I think You put a lot of effort to create this article. I appreciate your work.. คาสิโนเซ็กซี่บาคาร่า .

    ReplyDelete
  22. I conceive you have noted some very interesting points, regards for the post. เว็บพนันออนไลน์SAGAMING .

    ReplyDelete
  23. I will bookmark your site and take the feeds additionally เล่นAE Casinoบนมือถือ

    ReplyDelete
  24. This is very Amazing and Very Informative Artical we get alot of Informations from this artical we really appreciate your team work keep it up and keep posting such a informative articles
    Venus Casino
    รีวิวเว็บVenus Casino

    ReplyDelete
  25. This is very Amazing and Very Informative Artical we get alot of Informations from this artical we really appreciate your team work keep it up and keep posting such a informative articles. eBETGaming.

    ReplyDelete

  26. I read this article. I think You put a lot of effort to create this article. I appreciate your work . คาสิโนวีนัส .

    ReplyDelete
  27. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. Sexy Baccarat

    ReplyDelete
  28. I conceive you have noted some very interesting points, regards for the post. แนะนำเว็บVenus Casino.

    ReplyDelete
  29. I went to this website, and I believe that you have a plenty of excellent information, I have saved your site to my bookmarks. ทางเข้าGold Diamond Gaming.

    ReplyDelete
  30. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also. เดิมพันออนไลน์Venus Casino

    ReplyDelete
  31. I read this article. I think You put a lot of effort to create this article. I appreciate your work. ไพ่เสือมังกร

    ReplyDelete
  32. Photos available on your site even though producing attention rapidly some quantity submits.
    คาสิโน AE Sexy

    ReplyDelete
  33. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also
    เว็บไซต์เล่นยูฟ่าสล็อตออนไลน์บนมือถือ
    UFA SLOT

    ReplyDelete
  34. I conceive you have noted some very interesting points, regards for the post.
    คาสิโนยูฟ่าเบท

    ReplyDelete
  35. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. โกลด์ไดมอนด์เกมมิ่ง

    ReplyDelete
  36. I conceive you have noted some very interesting points, regards for the post.
    แทงเสือมังกรออนไลน์

    ReplyDelete
  37. This is very Amazing and Very Informative Artical we get alot of Informations from this artical we really appreciate your team work keep it up and keep posting such a informative. 138BET. สมัครเว็บพนัน138BET. ทางเข้าเว็บพนัน138BET.

    ReplyDelete
  38. I will bookmark your site and take the feeds additionally
    สมัครสมาชิกSexy Baccarat

    ReplyDelete
  39. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. เดิมพันออนไลน์Venus Casino

    ReplyDelete
  40. I went to this website, and I believe that you have a plenty of excellent information, I have saved your site to my bookmarks.
    SA Gamingออนไลน์
    เว็บไซต์SA Gaming

    ReplyDelete
  41. I read this article. I think You put a lot of effort to create this article. I appreciate your work. SA GAMING

    ReplyDelete
  42. We help them as much as we can. If they need assistance with research, writing, grammar, formatting or proofreading, we provide our assistance to help them build their career.
    เว็บไซต์เล่นยูฟ่าสล็อตออนไลน์บนมือถือ
    เดิมพันสล็อตUFABET

    ReplyDelete
  43. We help them as much as we can. If they need assistance with research, writing, grammar, formatting or proofreading, we provide our assistance to help them build their career. เล่นเสือมังกรบนมือถือ.

    ReplyDelete
  44. I read this article. I think You put a lot of effort to create this article. I appreciate your work. เว็บพนันออนไลน์SA GAMING

    ReplyDelete
  45. I will bookmark your site and take the feeds additionally คาสิโนขั้นต่ำ10บาท .

    ReplyDelete
  46. Photos available on your site even though producing attention rapidly some quantity submits. คาสิโนขั้นต่ำ10บาท เว็บคาสิโนออนไลน์

    ReplyDelete
  47. This is very Amazing and Very Informative Artical we get alot of Informations from this artical we really appreciate your team work keep it up and keep posting such a informative articles. sa sexy gaming. SAsexy.

    ReplyDelete
  48. I read this article. I think You put a lot of effort to create this article. I appreciate your work. ทางเข้าsagaming . สมัครสมาชิกsagaming .

    ReplyDelete
  49. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work.
    เดิมพันAEขั้นต่ำ10บาท.
    AE Casinoฝาก-ถอนออโต้.
    AE Casinoเดิมพันไม่มีขั้นต่ำ.

    ReplyDelete
  50. I went to this website, and I believe that you have a plenty of excellent information, I have saved your site to my bookmarks.
    ทางเข้าเว็บพนัน138BET.
    138BETTHAILAND.
    138BET.

    ReplyDelete
  51. Wohh just what I was looking for, regards for posting. ยูฟ่าเบท . เว็บพนันufabet .

    ReplyDelete
  52. I read this article. I think You put a lot of effort to create this article. I appreciate your work. เล่นยูฟ่าเบท ทางเข้ายูฟ่าเบท

    ReplyDelete
  53. Wohh just what I was looking for, regards for posting. Ufabet . ยูฟ่าเบท .

    ReplyDelete
  54. Photos available on your site even though producing attention rapidly some quantity submits. กำถั่ว Fantan

    ReplyDelete
  55. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also UFA GAME UFA CASINO

    ReplyDelete
  56. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. ufaslot . สล็อตออนไลน์ยูฟ่าเบท

    ReplyDelete
  57. This comment has been removed by the author.

    ReplyDelete
  58. I conceive you have noted some very interesting points, regards for the post. เว็บพนันออนไลน์ufaslot . เล่นufaslotบนมือถือ .

    ReplyDelete
  59. I conceive you have noted some very interesting points, regards for the post. เดิมพันufaslot . รีวิวเว็บยูฟ่าสล็อต .

    ReplyDelete
  60. I unquestionably esteeming each and every piece of it and I have you bookmarked to look at new แทงบอลออนไลน์UFABET

    ReplyDelete
  61. I read this article. I think You put a lot of effort to create this article. I appreciate your work.วิธีเล่นufaslot.สมัครสมาชิกยูฟ่าสล็อต

    ReplyDelete
  62. I read this article. I think You put a lot of effort to create this article. I appreciate your work. สมัครสมาชิกบาคาร่าUFABET .

    ReplyDelete
  63. I read this article. I think You put a lot of effort to create this article. I appreciate your work. UFA SLOT ยูฟ่าสล็อต

    ReplyDelete
  64. I read this article. I think You put a lot of effort to create this article. I appreciate your work. Roulette online เดิมพันรูเล็ตขั้นต่ำ10บาท

    ReplyDelete
  65. I value the article.Thanks Again. Much obliged. 1XBET.

    ReplyDelete
  66. This is very Amazing and Very Informative Artical we get alot of Informations from this artical we really appreciate your team work keep it up and keep posting such a informative articles. แนะนำเว็บแทงบอล.

    ReplyDelete
  67. Photos available on your site even though producing attention rapidly some quantity submits. เกมยิงปลา . เกมยิงปลาแตกง่าย

    ReplyDelete
  68. I read this article. I think You put a lot of effort to create this article. I appreciate your work. เดิมพันคาสิโนยูฟ่าเบท คาสิโนยูฟ่าเบท2021

    ReplyDelete
  69. I conceive you have noted some very interesting points, regards for the post. Joker Gaming .

    ReplyDelete
  70. We provide best services to all class of clients. สมัครufabetเว็บตรง

    ReplyDelete
  71. I conceive you have noted some very interesting points, regards for the post. วิธีสมัครสมาชิกufabet .

    ReplyDelete
  72. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also ยูฟ่าเบทขั้นต่ำ10บาท

    ReplyDelete
  73. I read this article. I think You put a lot of effort to create this article. I appreciate your work. Ufabet.

    ReplyDelete
  74. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for fre
    รีวิวufa1919

    ReplyDelete
  75. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained!
    รีวิว-ufa-slot

    ReplyDelete
  76. I conceive you have noted some very interesting points, regards for the post.แทงบอลufabetเว็บไหนดี?

    ReplyDelete
  77. Photos available on your site even though producing attention rapidly some quantity submits. เกมคาสิโนสด1XBET.

    ReplyDelete
  78. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also Sexy Baccarat

    ReplyDelete
  79. I read this article. I think You put a lot of effort to create this article. I appreciate your work.
    เดิมพันคาสิโนSexy.
    sexybaccarat365s.com.

    ReplyDelete
  80. I conceive you have noted some very interesting points, regards for the post. คาสิโนออนไลน์ยูฟ่าเบท

    ReplyDelete
  81. I will bookmark your site and take the feeds additionally.แนะนำเว็บยูฟ่าเบท

    ReplyDelete
  82. I will bookmark your site and take the feeds additionally. UFABET.

    ReplyDelete
  83. I will bookmark your site and take the feeds additionally แทงบอลUFABET

    ReplyDelete
  84. I conceive you have noted some very interesting points, regards for the post. ยูฟ่าเบท.

    ReplyDelete
  85. Photos available on your site even though producing attention rapidly some quantity submits. UFABET

    ReplyDelete
  86. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also. แนะนำเว็บยูฟ่าเบท.

    ReplyDelete
  87. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also Kingmaker

    ReplyDelete
  88. Wohh just what I was looking for, regards for posting.
    ไฮโลKingmaker

    ReplyDelete
  89. I conceive you have noted some very interesting points, regards for the post. คาสิโนคิงเมคเกอร์.

    ReplyDelete
  90. I read this article. I think You put a lot of effort to create this article. I appreciate your work. แทงบอลได้เงินจริง

    ReplyDelete
  91. I conceive you have noted some very interesting points, regards for the post.
    ป๊อกเด้งฝากไม่มีขั้นต่ำ

    ReplyDelete
  92. Photos available on your site even though producing attention rapidly some quantity submits. เดิมพันกีฬาออนไลน์.

    ReplyDelete
  93. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. เล่นสล็อตบนมือถือ

    ReplyDelete
  94. Wohh just what I was looking for, regards for posting. คาสิโนขั้นต่ำ10บาท

    ReplyDelete
  95. Photos available on your site even though producing attention rapidly some quantity submits. Casino UFABET.

    ReplyDelete
  96. I value the article.Thanks Again. Much obliged. Sexy Baccarat

    ReplyDelete
  97. Wohh just what I was looking for, regards for posting.Sexy Baccarat

    ReplyDelete
  98. Photos available on your site even though producing attention rapidly some quantity submits.สมัครเล่นยูฟ่าเบท

    ReplyDelete
  99. I unquestionably esteeming each and every piece of it and I have you bookmarked to look at new stuff you post. สมัครสมาชิกUFABET

    ReplyDelete
  100. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also. แทงบาคาร่าเว็บUFABET . บาคาร่าออนไลน์ .

    ReplyDelete
  101. I conceive you have noted some very interesting points, regards for the post. รูเล็ตออนไลน์

    ReplyDelete
  102. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also. แทงหวยยูฟ่าเบท .

    ReplyDelete
  103. This is very Amazing and Very Informative Artical we get alot of Informations from this artical we really appreciate your team work keep it up and keep posting such a informative articles. ทางเข้าUFABET

    ReplyDelete
  104. Wohh just what I was looking for, regards for posting. แทงบาคาร่า

    ReplyDelete
  105. I read this article. I think You put a lot of effort to create this article. I appreciate your work. เล่นคาสิโนสดบาคาร่า.

    ReplyDelete
  106. I conceive you have noted some very interesting points, regards for the post.พีจีสล็อต

    ReplyDelete
  107. Photos available on your site even though producing attention rapidly some quantity submits. แทงไฮโลฝากถอนAUTO

    ReplyDelete
  108. We provide best services to all class of clients. UFABET

    ReplyDelete
  109. Wohh just what I was looking for, regards for posting. Red Tigerบนมือถือ

    ReplyDelete
  110. Wohh just what I was looking for, regards for posting.casino Red Tiger

    ReplyDelete
  111. Can be gonna always be again steadily to investigate cross-check brand-new blogposts. https://www.5g999.co/baccarat

    ReplyDelete
  112. I conceive you have noted some very interesting points, regards for the post.เล่นเสือมังกรออนไลน์

    ReplyDelete
  113. This is a great web site, Good sparkling user interface and, very informative blogs. thanks. You may check our website also. บาคาร่ายูฟ่าเบท .

    ReplyDelete
  114. I read this article. I think You put a lot of effort to create this article. I appreciate your work.
    Spade gaming Slot Online

    ReplyDelete
  115. I will bookmark your site and take the feeds additionallyเว็บแทงหวย

    ReplyDelete
  116. Photos available on your site even though producing attention rapidly some quantity submits.
    เว็บแทงหวย

    ReplyDelete
  117. I value the article.Thanks Again. Much obliged. แทงหวยออนไลน์

    ReplyDelete
  118. I read this article. I think You put a lot of effort to create this article. I appreciate your work.
    แทงไฮโลเว็บไหนดี

    ReplyDelete
  119. I will bookmark your site and take the feeds additionally.แทงไฮโลฝากถอนAUTO

    ReplyDelete
  120. I conceive you have noted some very interesting points, regards for the post. UFAslot (ยูฟ่าสล็อต)

    ReplyDelete
  121. I conceive you have noted some very interesting points, regards for the post. ทางเข้าแทงไฮโลออนไลน์

    ReplyDelete
  122. I read this article. I think You put a lot of effort to create this article. I appreciate your work.เดิมพันไฮโลออนไลน์

    ReplyDelete
  123. I conceive you have noted some very interesting points, regards for the post. เกมคาสิโนยูฟ่าเบท

    ReplyDelete
  124. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. รูเล็ต

    ReplyDelete
  125. I will bookmark your site and take the feeds additionally.Roulette online

    ReplyDelete

Item Reviewed: 5 Things all Java developer should know when developing for the cloud Description: Rating: 5 Reviewed By: Unknown
Scroll to Top