Building Modular Cloud Applications in Java - Lessons Learned


Published on

Over the past couple of years we have been building large scale Java applications and deployed them in the cloud. While dealing with typical cloud issues such as auto scaling, failover, and incremental deployments we meanwhile had to refactor them for significant functional changes.

Being able to deal with change and dynamics are important reasons for companies to resort to the cloud for application development. Short time to market and rapidly changing requirements can lead to experimental software design however. Dealing with constant change in a codebase is non-trivial. In order to facilitate much change a modular codebase is of great importance.

In this talk we will show you what we have learned on how to create modular Java applications and how to deploy them in the cloud using an Open Source approach without locking into one of the PaaS providers. We will discuss OSGi, scalable web application architecture, and Apache ACE for deployment and provisioning.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Building Modular Cloud Applications in Java - Lessons Learned

  1. 1. Building ModularCloud Applicationsin JavaLessons Learned
  2. 2. Bert ErtmanFellow at Luminis in the NetherlandsJUG Leader for NLJUG and a Java ChampionPaul BakkerArchitect at Luminis Technologies@BertErtman@pbakker a presentation for
  3. 3. The casePulseOnEducational systemfocussed on personalizedlearningUsed in high schools inthe NetherlandsExpand to other countriesin the near future
  4. 4. Re: Cloud ApplicationsSome characteristics:Application as a service over the internetImpact on some non-trivial non-functionalsAvailabilityScalabilityExtensibility
  5. 5. ObservationsExtremely agileArchitecture (and code base) shouldbe able to cope with change
  6. 6. The case for modularityModularity is theultimate agile tool!Small, disposable, componentsPrevents code rot on thearchitectural levelIsolate problems, focus work
  7. 7. Prevent(tight)couplingWhat we learned about OO design in university :Promotecohesioncouplingcohesion
  8. 8. Whatdoweneed?designconsequencesHigh-levelenterprise APIsArchitecturalfocus onmodularityRuntimedynamicmoduleframeworkRight now,OSGi is theonly optionlet’s notreinvent thewheel
  9. 9. OSGi is the de-factostandard modulesystem for JavaOSGi != modularityWhat about Jigsaw?
  10. 10. OSGi is the de-factostandard modulesystem for JavaOSGi != modularityWhat about Jigsaw?remember!Modularity isan architecturalprinciple
  11. 11. OSGi is the de-factostandard modulesystem for JavaOSGi != modularityWhat about Jigsaw?remember!Modularity isan architecturalprincipleModularitydoes not comefor free with aframework
  12. 12. demo
  13. 13. Profiles RestProfiles APIProfilesServiceMongoDBProgress RestProgress APIProgressServiceMongoDBCurriculumAPICurriculumServiceMongoDB... Rest... API...Servicemodularityin action...
  14. 14. Back to the cloud...
  15. 15. HTML 5 + JavaScriptRESTful servicesOSGi servicesMongoApache FelixS3Typical architectureRequirements:Modern web appUI mostly offloaded toclients or devicesDocument driveninteractionIntegration via RESTAPIWeb scale data storeMulti-tenantElasticity
  16. 16. HTML 5 + JavaScriptRESTful servicesOSGi servicesMongoApache FelixAmdatuS3Typical architectureLet’s Add AMDATUto our stackArchitectural focuson modularityRuntime dynamicservicesHigh level API
  17. 17. AuthBlob storesMongoDBMulti-tenancyOpenSocialSearchRemote ServicesRESTTemplateWeb...Components
  18. 18. What aboutdeployment?
  19. 19. PaaS Offerings out there:Not good:Proprietary platformVendor lock-inWhite list / black listOS LimitationsNo support for modularruntime
  20. 20. Solution: roll our own PaaSModular PaaS:IaaS imageOSGi runtimeDeployment/provisioningPaaS Building blocksPro:freedomCon:no vendor supportAmazon EC2Apache FelixApache ACEAmdatu
  21. 21. DeploymentLoadLoad BalancerPulseOn nodePulseOn nodePulseOn nodeSchool AMongoMongoMongoLoadLoad BalancerPulseOn nodePulseOn nodePulseOn nodeSchool BMongoMongoMongo
  22. 22. Availability zones
  23. 23. Horizontal scaling requires stateless nodesHTML5 clients need less server side stateAny state should go to some kind of storeHorizontal scalability
  24. 24. Auto scalingConsiderable higher loads during school hoursEnoughcapacityWithout payingfor idle serversat night...
  25. 25. Load Balancer small nodeCluster per schoolAlways use a load balancer because we don’t wantdowntime during scaling
  26. 26. Early morning...Load Balancer small node
  27. 27. Early morning...Load Balancer small nodelarge nodelarge node
  28. 28. End of the day...Load Balancer small nodelarge nodelarge node
  29. 29. End of the day...Load Balancer small node
  30. 30. But how do we installour software on a node?
  31. 31. Some numbers190bundlesin a deployment120PulseOnbundles
  32. 32. Provisioning servers
  33. 33. Provisioning serversNodeAWS Auto Scaling1. StartLoad BalancerApache ACE2. register3. register4. provisiondeploymentpackage
  34. 34. ./as-­‐create-­‐launch-­‐config  demo            -­‐-­‐image-­‐id  ami-­‐0ee8e07a            -­‐-­‐instance-­‐type  m1.small            -­‐-­‐region  eu-­‐west-­‐1            -­‐-­‐group  sg-­‐ce1420ba            -­‐-­‐user-­‐data-­‐file  userdata.txt./as-­‐create-­‐auto-­‐scaling-­‐group  demo          -­‐-­‐launch-­‐configuration  demo          -­‐-­‐min-­‐size  1          -­‐-­‐max-­‐size  1          -­‐-­‐availability-­‐zones  eu-­‐west-­‐1a          -­‐-­‐load-­‐balancers  demo          -­‐-­‐tag  "k=Name,v=demo,p=true"
  35. 35. Or by UI configuration...
  36. 36. Provisioning serversNodes are completely disposableAutomated cluster recoveryNodes do not require maintenanceNo “big” container
  37. 37. Developer Tools
  38. 38. Educational system focussed onpersonalized learningUsed in high schools in theNetherlandsExpand to other countries in thenear futureDevelopment tool stackIDE with fast turn aroundsVersion ControlContinuous Integration ServerIssue trackerWIKIwhat do we need?
  39. 39. Continuous integrationAll BndTools projects supportheadless buildsBuild on git pushMeasure test coverage(both unit and integration tests)
  40. 40. Wrap up
  41. 41. what have we learned?Modularity is the ultimate agile toolModularity is no longer difficult(BndTools / Amdatu)Stateless architecture is the onlyscalable wayCloud deployments made easy with aprovisioning server
  42. 42. Shameless self-promotion...Our bookBuilding Modular CloudApplications in JavaPublished by O’ReillyDue: end of summer this yearunderconstruction
  43. 43. Want to try this yourself?Tomorrow: 10 AM - 12.30Hands-on Lab:Building Modular Cloud Applications in JavaVenue: Hotel Wyspiańskiul.Westerplatte 1531-033 Kraków
  44. 44. Cloud provisioning OSGi plugin’s us OSGi services
  45. 45. TakkGrazieThankyouObrigadoMahaloDankeDank UMerciGracias