Scaling Your Spring Application on the Cloud


Published on

Published in: Technology, Business
  • 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

No notes for slide

Scaling Your Spring Application on the Cloud

  1. 1. Practical Guide for Developing Enterprise Application on the Cloud Nati Shalom CTO GigaSpaces Technologies
  2. 2. About GigaSpaces eXtreme Application Platform (XAP) A middleware platform enabling applications to run a distributed cluster as if it was a single machine 2,000+ Deployments Among Top 50 Cloud Vendors 100+ Direct Customers “GigaSpaces exceeded our “GigaSpaces has allowed “GigaSpaces has saved us to greatly improve the performance requirements and us significant time and scalability and enabled us to build a flexible, cost” performance of our trading cost-effective infrastructure” platform” Phil Ruhlman, Julian Browne, Geoff Buhn, CIO, Gallup Virgin Mobile Options Trading Technology Manager, SIG
  3. 3. Business motivation • IT CAN’T KEEP UP WITH THE DEMANDS OF THE BUSINESS – Capacity planning is too difficult – Time to market – The business wants a quick and dirty way to prototype – Cost saving Source: Forrester March 09
  4. 4. The ideal world
  5. 5. The challenge with existing applications Business tier Web Tier Load Balancer Back-up Back-up Back-up Back-up Data Tier Messaging
  6. 6. Challenges summary • Adding additional resources dynamically • No out-of-the-box infrastructure for J2EE • Dealing with a lack of persistence • Dealing with distributed programming models • Having to think about the whole stack. Not just the code. • Using Memory Data Grids and Caching considerations • Messaging • Understanding configuration management tools • Pricing and licensing Source: Cloud Mailing List
  7. 7. How users deal with the current challenges • Deploy multiple Web servers • Deploy multiple load balancers • Deploy several database servers. • Another way of dealing with databases is to not use them Source Grig Gheorghiu blog: Experiences deploying a large-scale infrastructure in Amazon EC2 •Requires a lot of effort in setting up the environment. •Doesn’t cover all the challenges
  8. 8. Meeting the challenges • Adding additional resources dynamically – Through virtualization of the middleware stack • Dealing with a lack of persistence – Using IMDG as a front end to the database • Dealing with distributed programming models – Use Remoting abstraction to simplify the distributed programming model • Having to think about the whole stack. Not just the code. – Use one common runtim and clustering across the entire stack • Using Memory Data Grids and Caching considerations – Make IMDG pluggable and simple to integrate with • Messaging – Use messaging over IMDG to enable seamless distribution of the messaging • Understanding configuration management tools – Add built-in monitoring and management with the deployment – Automate deployment, scaling, fail-over to avoid minimal processes • No out-of-the-box infrastructure for J2EE – Support JEE as a first class citizen • Pricing and licensing – Elastic pricing (The Amazon model) - pay-per use, reserved instances (subscription, perpetual)
  9. 9. Expected result Web Business Processing Processing Units Units Load Balancer Users DB Virtualize the Entire Application Stack
  10. 10. Solution Guidelines • Avoid radical change, enabling a gradual process • Choose an architecture supporting linear scalability • Minimize vendor lock-in – Enable application portability and freedom of choice of: • cloud provider, web container, programming language, database – Minimize API lock in: • Use of standards • API Abstractions – when standards are not available • Future proof your application - Don’t make decision today, but be ready to make one without major effort - Avoid long-term commitment – choose the right licensing model
  11. 11. Practical Steps Value IMDG as Messaging System over IMDG of Record Remoting Web Tier over IMDG Effort On-demand Partitioned Partitioned Parallel Processing Architecture provisioning vs. vs. client-server virtualized servers virtualized servers static, peak-based vs. central server vs. central server Savings 7 machines 90 machines 6x machines 6x machines Examples (10 peak – 3 avg) (100 peak, 10 avg)  Automatic failover  Self-healing  Fast& Consistent  Map/Reduce  Commodity HW Additional  Basic caching response time.  Async invocation Low latency (in- Benefits  Auto deployment  Commodity db  Location memory) vs. high-end transparency
  12. 12. Step 1: Add Self Healing and Dynamic Scaling • Dynamic scaling is the ability to: – Increase (or decrease) your application’s capacity at will, on the fly, and with no down-time • Without code changes, use a standard JEE web app • Self healing is the ability to: – Automatically recover from failure conditions (AKA failover) and restore the system to its previous state
  13. 13. Step 1: Add Self Healing and Dynamic Scaling • Deploy the web application on to the GigaSpaces SLA driven environment • Integrate with a load balancer to enable dynamic update of cluster state
  14. 14. Step 2: Add Auto Scaling Support • Auto-scaling is the ability to: • Automatically apply dynamic scaling based on SLA rules (CPU/Memory utilization, requests/sec, etc) • Use the GigaSpaces SLA driven environment to monitor the application – Web requests, CPU, memory, any other relevant stats
  15. 15. Step 2: Add Auto Scaling Support • Use simple Java/Groovy code to trigger auto-scaling – Deploy code as a reliable service in the GigaSpaces SLA driven environment – When the SLA is breached (e.g. average number of requests per container crosses 100/Sec): • Instruct the environment to increase the number of instances
  16. 16. Step 2: Add Auto Scaling Support • Calculating average request rate (Groovy): • Scaling up (Groovy):
  17. 17. Step 2: Add Auto Scaling Support
  18. 18. Deploying on the cloud using CCF4 XAP MT Application Provisioning 2)Deploy Application 3)Manage Deployment Configuration 1)Install Provision IaaS Provider (EC2, GoGrid, VMWhere, Citrix,..) Application Repository App A App B
  19. 19. Application Deployment Configuration <cloud-config> <cloud-name>my-app</cloud-name> Amount of machines to <gsc-numof-machines>10</gsc-numof-machines> start initially <gsc-per-machine>1</gsc-per-machine> <alternate-s3-source-dir>myapplicationfiles</..> Application Repository <gigaspaces-version-id>662ga3100ct233</…> <processing-units> <processing-unit> Application To deploy <name>$CPD/myApp.war</name> <deploy-options/> </processing-unit> </processing-units> </cloud-config>
  20. 20. GigaSpaces Cloud Customers • Large UK Telco Company – Deploying discrete stand alone services in the Cloud – More cost effective; easier to outsource; enabled by secure service interface • Large Global Telco Company – Deploying carrier grade VOIP service to the Cloud – New SaaS business model; New revenue stream • Global Media Company – Using the Cloud to process events for innovative new TV programme – Cloud makes concept cost effective • Financial Services Start-up – Using the Cloud for a trading exchange – Cloud lowers barrier to entry and makes proposition possible • Online Gaming Company – Using the Cloud for testing and scaling – Able to test large scale user support early / easy on cloud, hard otherwise
  21. 21. Key Takeaways • Enterprise applications can run on the cloud today: – No need to re-write your application – Preventing lock-in to specific cloud provider – Enabling seamless portability between your local environment to cloud environment • Choose simple applications first – Avoid dealing with complex security issues – Application with Clear path to ROI (Fluctuating load, large scale testing, DR,..)
  22. 22. GigaSpaces XAP 7.0 (EA): GigaSpaces XAP Product Overview: GigaSpaces XAP for Web Applications: Try It Today on the Cloud