Upload
others
View
7
Download
0
Embed Size (px)
Citation preview
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Architecting ColdFusion For Scalability And High Availability
Ryan Stewart
Platform Evangelist
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Introduction
Architecture & Clustering OptionsDesign an architecture and develop applications that scale linearly across multiple servers and handles failures gracefully.
Performance Oriented DevelopmentGetting the most out of a single server by optimizing your application code.
Performance TuningColdFusion server tuning and load testing.
MonitoringTools and approaches for monitoring
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Scalability ≠ High Availability
Scalability - applications and architecture that will allow you to linearly add servers and take on an increasing number of users.
High Availability - When stuff breaks, users don’t notice
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Web server clustering Round Robin DNS, Hardware, Software
ColdFusion Clustering (Application Level) Clustered instances, Connector clustering, session replication
Database Server Clustering Database Specific
Levels of Clustering to Ensure Availability
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Create ColdFusion instances
Cluster the instances
Enable J2EE Sessions
Connect your web server to the cluster
Deploy your application
Test
ColdFusion Clustering – simple example
Single Server Example
connector
CF Instance 1
CF Instance 2
ClusterWeb server
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
ColdFusion J2EE installation is needed
Using the cfusion instance on port 8300 create your instances
ColdFusion Clustering – creating instances
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Create instance on the same server
Register remote instances
ColdFusion Clustering – managing instances
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Cluster the Instances
Enable J2EE Sessions
ColdFusion Clustering – creating cluster
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
After enabling session replication you will need to enable J2EE session variables within the ColdFusion admin.
Uses jsessionid in addition to CFID and CFTOKEN
ColdFusion Clustering – sessions
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
ColdFusion web server connector clustering
JRun Webserver Connector allows a webserver to communicate with JRun, runs as a filter or plugin in the webserver
Cluster by connecting multiple instances of ColdFusion to a single webserver with the JRun Webserver Configuration Tool
Load balancing and Failover built in to the connector
Connector load balancing algorithms(round-robin, weighted round-robin, weighted random)
ColdFusion Clustering – connector clustering
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
JRun web server connector clustering
Use wsconfig to connect your webserver to the cluster
ColdFusion Clustering – connecting the web server
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Test sticky sessions
Test failover
Test session replication
Identify which server is fulfilling your request
ColdFusion Clustering – Testing
<cfif not isdefined("application.jrunInstanceName")><cfobject action="create" type="java" class="jrunx.kernel.JRun" name="jr"> <cfset application.jrunInstanceName = jr.getServerName()>
</cfif>
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Two or more web servers that support one or more domains are grouped together as a cluster of servers
Use Load balancing scheme to manage increases in load using round-robin DNS or a hardware device
Failover is used to protect against web server failures, implemented using a hardware or software solution
Web Server Clustering - Overview
Web Server A
Web Server BWeb Server B
Web ServerClustering
Web ServerClustering
CF Server A
CF Server B
WebContainer
WebContainer
WebContainer
J2EEServer
WebContainer
J2EEServer
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Common hardware options F5 Big IP
Cisco CSS (new ver Cisco ACE)
Advantages Highly scalable
Support probes
Disadvantages Cost
Can be difficult to configure
Links CSS with CF - http://www.adobe.com/devnet/coldfusion/articles/css_multi.html
F5 Big IP - http://www.adobe.com/devnet/coldfusion/j2ee/articles/balancing_j2ee.html
Web Server Clustering - Hardware
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Windows Network Load Balancing (NLB)
HAProxy (Unix only) http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
Speed. It’s really, really fast.
It’s efficient. One of our instances is handling around 700 requests per second and using less than 5% CPU and only around 40MB of RAM on the Xen instance that it’s running on.
It allows us to make configuration changes gracefully, without breaking any existing connections.
Web Server Clustering - Software
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Two server cluster with DNS round robin and CF cluster
DNS Round robin handles distribution of load
ColdFusion is clustered across two servers, session replication can be enabled or disabled depending on needs.
No web server failover but ColdFusion instances can be shutdown for maintenance
Clustering Examples
www1.site.com
Web Server A
Web Server B
WebContainer
WebContainer
WebContainer
CFServer
WebContainer
CFServer
www2.site.com
RoundRobin DNS
www.site.com
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Two server cluster with software load balancing
NLB or software solution handles web server load balancing and failover
ColdFusion does not need to be clustered unless session replication is needed.
http://www.adobe.com/devnet/coldfusion/articles/nlb_failover.html
Clustering Examples
Web Server A
Web Server B
WebContainer
WebContainer
WebContainer
CFServer B
WebContainer
CFServer A
Windows NLBsoftware solution
NLB
Web Server A
Web Server B
WebContainer
WebContainer
WebContainer
CFServer B
WebContainer
CFServer A
HAProxysoftware solution
WebContainer
WebContainerHAProxyServer
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Two server cluster with hardware load balancing
Hardware solution handles web server load balancing and failover
ColdFusion does not need to be clustered unless session replication is needed.
Clustering Examples
Web Server A
Web Server B
WebContainer
WebContainer
WebContainer
CFServer B
WebContainer
CFServer A
Hardware solutionWith CF clustering
WebContainer
WebContainer
CSSOr
BigIP
Web Server A
Web Server B
WebContainer
WebContainer
WebContainer
CFServer B
WebContainer
CFServer A
Hardware solutionWithout CF clustering
WebContainer
WebContainer
CSSOr
BigIP
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
If a failure occurs with a cluster member what do your users experience?
Handling user persistence across the cluster Session replication
Creating your own persistence mechanism
Improving Availability
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Create a robust architecture in a cloud environment with the ability to add on demand servers. Do it without purchasing a single piece of hardware.
Amazon Web services Ec2- Elastic Computing Cloud
S3 - Simple Storage Service
Third party companies make it easier to get started on the cloud RightScale - deploy & scale applications in a turnkey architecture
Stax.net - develop & deploy
Deployment Apache with Tomcat or JBoss
MySQL
Archive ColdFusion Applications as a J2EE Archive
Clustering in the Clouds
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Performance Oriented Development
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Identifying, isolating and fixing bottlenecks during development
Load testing features or specific areas during development
Tuning Process Measuring Performance
Focus on single user baseline performance
Load test for multi user performance
What are the tunable
Application Code
ColdFusion settings
Application server/JVM settings
Web Server/OS Settings
Scalability through Performance Oriented Development
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Single user testing Bottleneck testing and isolation with ColdFusion debugging
GetTickCount, CFTIMER
Load Testing Small test scripts, no wait time
Free tools available (OpenSTA, WebStress, ApacheBench)
Run single user tests within your browser during load tests
Common areas to improve in your code Database queries
External Calls
Caching (content & queries) - CF_Accelerate
Testing During Development
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
ColdFusion Settings Simultaneous thread or active handler threads
Template cache size
Query cache size
Trusted cache
Application Server settings JVM settings
Garbage collection
OS Specific tuning
Tuning it up
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
JRun metrics
JVM Output
Network Monitoring
Disk IO monitoring
CPU monitoring
ColdFusion 8 Monitor
Third party tools Fusion Reactor
See Fusion
Database monitoring Profile in real time and identify queries by execution time and CPU time.
Monitoring Performance
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Performance Monitoring in Production CF8 Monitor
See Fusion
Monitoring Performance
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Monitoring Production Servers ColdFusion probes – Debugging & Logging -> System Probes
Third party monitoring products (Nagios - open source)
Monitoring Servers
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Architecture & Clustering OptionsDesign an architecture and develop applications that scale linearly across multiple servers and handles failures gracefully.
Performance Oriented DevelopmentGetting the most out of a single server by optimizing your application code.
Performance TuningColdFusion server tuning and load testing.
MonitoringTools and approaches for monitoring
Conclusion
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Questions
Questions