2014 cf summit_clustering
DESCRIPTION
ColdFusion ClusteringTRANSCRIPT
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The More the Merrier, Clustering in ColdFusionElishia Dvorak | ColdFusion Solution Consultant & Evangelist
Nimit Sharma | Software Engineer, ColdFusion
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Agenda
Different ways of clustering in ColdFusion Vertical Horizontal Distributed
Load Balancing
Failover & Session Management
2
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Why Cluster?
High Availability/Failover
Redundancy
3
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Clustering in ColdFusion
JEE Clustering Mechanism in Tomcat Peer to peer at the instance level
Will not provide failover for your web server Will need HWLB or use of built-in failover for web server
ie. IIS failover via Microsoft Network Load Balancing (NLB)
4
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Types of Clustering
Vertical Cluster “Scale Up”
Multiple instances on same box Increased efficiency Greatest utilization of hardware resources Manageability Most cost-effective Protection against software failover
(localized redundancy) Implications for hardware failure
5
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 6
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 7
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 8
DemoSetting Up a Vertical Cluster
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Types of Clustering
Horizontal Cluster “Scale Out” Clustered across different physical or virtual servers
Protects against hardware failures Not most cost-effective solution Effective management of workloads
May be most effective if you have an application that can run efficiently on limited hardware The most common solution typically involves a hybrid vertical + horizontal solution (scale up
then out)
9
CF1
CF2
CF3
CF4
CF5
Web1
Web2
Web3
Web4
Web5
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 10
Instance Manager ->Register Remote Instance
Default 8985/8987 (in jetty.xml)
Must be unique for session affinity
Weighted round robin
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 11
DemoSetting Up a Horizontal ColdFusion Cluster
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Clustering in ColdFusion
12
A A AB B BC C C
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Distributed Architecture
Web server resides on a separate server than ColdFusion Security Scalability Redundant & Independent
Three-Tier Architecture Tier 1: Web Server Tier 2: Application Server (ColdFusion) Tier 3: Data
13
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 14
DemoDistributed Architecture
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Where is all this stored?
Web Server Configuration Utility: CF_Install_Dir/cfusion/runtime/bin Connector Config: CF_Install_Dir/config/
cluster.xml: Stores info about the cluster, including multicast port Instances.xml: Stores info about the instances and where they are located In /config/wsconfig/n/ - config files for connector, logs
Isapi_redirect.properties workers.properties
\CF_Install_dir\cfusion\jetty\etc\jetty.xml: Admin component ports \instance_name\runtime\conf\server.xml: stores port/connector info for server
instances AJP Port Connector Port for Built-In Web Server Web root for Built-In Web Server, context path
15
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Consideration for architecture
Code Maintenance
Maintaining multiple copies of the shared assets
Requires replication mechanism to keep shared assets up to date
Always possibility of something getting out of sync
Using NAS (Network Attached Storage) device
Centrally located
Still need failover mechanism
Possibility of latency
16
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Load Balancing & Failover
Load balancer For distribution of load and failover across web server level Allows proxy based distribution of traffic across multiple servers Hardware or Software Based Example: F5 Big-IP
ColdFusion Offers Load balancing via round robin (at instance level) Failover (at instance level) - Requires session replication, or alternative to maintain session at failover
Session Management Options: Server Affinity / Sticky Sessions (J2EE sessions must be enabled) Session Replication (J2EE sessions must be enabled) Distributed Caching Client Variables
17
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Troubleshooting
Verbose Connector Logging Isapi_redirect.properties Set log_level= debug
Log files Isapi_redirect.log
Ensure ports are open between machines: Check OS Firewalls, External Firewalls, If AWS need to open TCP ports AJP Port for communicating with cluster members (remote) – by default 801X HTTP port, for testing using internal web server would be port 850X
18
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PDFg Clustering and Scalability
Nimit Sharma
19
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Agenda
PDFg Service(CFHTMLTOPDF) PDFg Service Clustering
Vertical Horizontal
Troubleshooting tips Performance improvements
20
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PDFg Service
21
Fully revamped PDF Engine Produces high quality PDFs Re-architected for high performance Cluster Support for Enterprise Edition
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PDFg Service
22
CFHTMLToPDF CFHTMLToPDFItem
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PDF generated using CFDocument and CFHtmlToPdf
23
CFDocument CFHtmlToPdf
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Components of PDFg Service
24
Service: It is process named HTML2PDFConverter.
Service Manager: It manages the lifecycle of PDF generation.
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Request Flow
25
End-Users ColdFusion Server
ColdFusion Add-on
Services
ServiceHTML2PDFConverter
PDF Service Manager
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PDFg Service Clustering for Scalability
26
Vertical Scaling
Horizontal Scaling
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PDFg Service – Vertical Scaling
27
Html2PdfConverter N
Html2PdfConverter 3
Html2PdfConverter 2
Html2PdfConverter 1
PDF Service Process Pool
PDF Service process can be increased with
load.
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PDFg Service – Vertical Scaling
28
Configuration File <cf_install_root>/cfusion/jetty/webapps/PDFgServlet/WEB-INF/web.xml
<context-param><description> Minimum PDFg process running in Process pool </description>
<param-name>minService</param-name>
<param-value>1</param-value></context-param>
<context-param> <description> Maximum PDFg process running in Process pool </description>
<param-name>maxService</param-name>
<param-value>2</param-value> </context-param>
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 29
Demo
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PDFg Service – Horizontal Scaling
30
Load Balancer
Html2PdfConverter 2
Html2PdfConverter 1
PDF Service Process Pool
Html2PdfConverter 2
Html2PdfConverter 1
PDF Service Process Pool
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PDFg Service – Horizontal Scaling
31
Login to ColdFusion Administrator, and then navigate to ‘Data & Services’ > PDF Service.
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
List PDF Service Managers
32
Login to ColdFusion Administrator, and then navigate to ‘Data & Services’ > PDF Service.
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 33
Demo
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Troubleshooting Tips
34
How to access PDFg service manager remotely
How to enable PDFg service logging
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Accessing PDFg service manager remotely
35
Configuration File:
<cf_install_root>/cfusion/jetty/etc/jetty.xml
<Call name="addConnector"><Arg> <New class="org.mortbay.jetty.bio.SocketConnector">
<Set name="Host">127.0.0.1</Set> <Set name="port"> <SystemProperty name="jetty.port" default="8987"/></Set> <Set name="maxIdleTime">50000</Set> <Set name="lowResourceMaxIdleTime">1500</Set>
</New> </Arg> </Call>
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 36
Logging
End-Users ColdFusion Server
ColdFusion Add-on
Services
ServiceHTML2PDFConverter
ColdFusion logs
PDF service logsPDF Service
Manager
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Enabling PDFg service logging
37
Configuration file:
<cf_install_root>/cfusion/jetty/webapps/PDFgServlet/WEB-INF/web.xml
It creates PDF service log named pdfg_access.log
<context-param> <description>EnableLogging logs complete details about PDFg service and conversion request life cycle.</description>
<param-name>enableLogging</param-name>
<param-value>true</param-value> </context-param>
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Performance Improvements
38
10 20 40 50 80 1000
20
40
60
80
100
120
CFDocumentCFHtmlToPdf
Virtual Users
Th
rou
gh
pu
t(R
eq
ue
st/S
ec)
104%
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Configuration used for Performance tests
39
Server details:
OS: Windows Server 2012 R2 Processors: Xeon with 16 cores RAM: 32 GB
PDF Service Configuration details:
minService: 8 maxService: 12
CFDocument:
No option available to scale
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Nimit [email protected]@nimsharm
Elishia [email protected]@elishdvorak