scaling your spring application on the cloud
DESCRIPTION
TRANSCRIPT
Practical Guide for Developing Enterprise Application on the Cloud
Nati Shalom
CTO
GigaSpaces Technologies
About GigaSpaces eXtreme Application Platform (XAP)
2,000+ Deployments2,000+ Deployments 100+ Direct Customers100+ Direct CustomersAmong Top 50 Cloud VendorsAmong Top 50 Cloud Vendors
2
“GigaSpaces exceeded our performance requirements and enabled us to build a flexible, cost-effective infrastructure”
“GigaSpaces has allowed us to greatly improve the scalability and performance of our trading platform”
“GigaSpaces has saved us significant time and cost”
Phil Ruhlman, CIO, Gallup
Julian Browne, Virgin Mobile
Geoff Buhn, Options Trading Technology Manager, SIG
2
A middleware platform enabling applications to run a distributed cluster as if it was a single machine
A middleware platform enabling applications to run a distributed cluster as if it was a single machine
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
The ideal world
The challenge with existing applications
Business tier
Back-upBack-up
Back-upBack-up
Load Balancer
Web Tier
Messaging
Data Tier
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
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
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)
Expected result
Users
Load Balancer
Web Processing Units
BusinessProcessing Units
DBDBDBDB
Virtualize the Entire Application Stack
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
Practical Steps
Val
ue
Effort
Web TierWeb Tier Remoting over IMDGRemoting over IMDG
Messaging over IMDG
Messaging over IMDG
IMDG as System
of Record
IMDG as System
of Record
ArchitectureOn-demand provisioning vs. static, peak-based
Parallel Processing vs. client-server
Partitioned virtualized servers vs. central server
Partitioned virtualized servers vs. central server
Savings
Examples
7 machines
(10 peak – 3 avg)
90 machines
(100 peak, 10 avg)6x machines 6x machines
Additional
Benefits
Self-healing
Basic caching
Auto deployment
Automatic failover
Map/Reduce
Async invocation
Location
transparency
Commodity HW
Low latency (in-
memory)
Fast& Consistent
response time.
Commodity db
vs. high-end
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
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
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
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
Step 2: Add Auto Scaling Support
• Calculating average request rate (Groovy):
• Scaling up (Groovy):
Step 2: Add Auto Scaling Support
Deploying on the cloud using CCF4 XAP
ApplicationRepositoryApplicationRepository
MT Application ProvisioningMT Application Provisioning
IaaS Provider (EC2, GoGrid, VMWhere, Citrix,..)
App AApp A App BApp B
Application Deployment Configuration
Application Deployment Configuration
2)Deploy2)Deploy
1)Install1)InstallProvisionProvision
3)Manage3)Manage
Application Deployment Configuration
<cloud-config>
<cloud-name>my-app</cloud-name>
<gsc-numof-machines>10</gsc-numof-machines>
<gsc-per-machine>1</gsc-per-machine>
<alternate-s3-source-dir>myapplicationfiles</..>
<gigaspaces-version-id>662ga3100ct233</…>
<processing-units>
<processing-unit>
<name>$CPD/myApp.war</name>
<deploy-options/>
</processing-unit>
</processing-units>
</cloud-config>
Amount of machines to start initially
Amount of machines to start initially
Application To deploy
Application To deploy
Application RepositoryApplication Repository
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
• 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,..)
Key Takeaways
GigaSpaces XAP 7.0 (EA):GigaSpaces XAP 7.0 (EA):http://
www.gigaspaces.com/wiki/display/RN/GigaSpaces+7.0.0+Early+Acces
GigaSpaces XAP Product Overview:GigaSpaces XAP Product Overview:http://www.gigaspaces.com/wiki/display/XAP7/Concepts http://www.gigaspaces.com/wiki/display/XAP7/Concepts
GigaSpaces XAP for Web Applications: GigaSpaces XAP for Web Applications: http://www.gigaspaces.com/wiki/display/XAP66/Scaling+Your+Web+Applicationhttp://www.gigaspaces.com/wiki/display/XAP66/Scaling+Your+Web+Application
Try It Today on the Cloud Try It Today on the Cloud http://www.gigaspaces.com/mycloud http://www.gigaspaces.com/mycloud
http://www.gigaspaces.com/mycloud-stg http://www.gigaspaces.com/mycloud-stg