The More the Merrier, Clustering in ColdFusion 
Elishia 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 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
2
Why Cluster? 
High Availability/Failover 
Redundancy 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
3
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) 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
4
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 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
5
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 6
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 7
Demo 
Setting Up a Vertical Cluster 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 8
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) 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
9 
CF 
1 
CF 
2 
CF 
3 
CF 
4 
CF 
5 
Web1 Web2 Web3 Web4 Web5
Instance Manager -> 
Register Remote Instance 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 10 
Must be unique for session affinity 
Weighted round robin 
Default 8985/8987 (in 
jetty.xml)
Demo 
Setting Up a Horizontal ColdFusion Cluster 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 11
Clustering in ColdFusion 
A B C A B C A B C 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
12
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 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
13
Demo 
Distributed Architecture 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 14
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_dircfusionjettyetcjetty.xml: Admin component ports 
 instance_nameruntimeconfserver.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 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
15
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 
 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
16
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 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
17
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 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
18
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
PDFg Clustering and Scalability 
Nimit Sharma 
19
Agenda 
 PDFg Service(CFHTMLTOPDF) 
 PDFg Service Clustering 
 Vertical 
 Horizontal 
 Troubleshooting tips 
 Performance improvements 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
20
PDFg Service 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
21 
 Fully revamped PDF Engine 
 Produces high quality PDFs 
 Re-architected for high performance 
 Cluster Support for Enterprise Edition
PDFg Service 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
22 
 CFHTMLToPDF 
 CFHTMLToPDFItem
PDF generated using CFDocument and CFHtmlToPdf 
CFDocument CFHtmlToPdf 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
23
Components of PDFg Service 
 Service: It is process named HTML2PDFConverter. 
 Service Manager: It manages the lifecycle of PDF generation. 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
24
Request Flow 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
25 
End-Users ColdFusion 
Server 
ColdFusion 
Add-on Services 
Service 
HTML2PDFConverter 
PDF Service 
Manager
PDFg Service Clustering for Scalability 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
26 
 Vertical Scaling 
 Horizontal Scaling
PDFg Service – Vertical Scaling 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
27 
Html2PdfConverter N 
Html2PdfConverter 3 
Html2PdfConverter 2 
Html2PdfConverter 1 
PDF Service Process Pool 
PDF Service process can be increased with load.
PDFg Service – Vertical Scaling 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
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>
Demo 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 29
PDFg Service – Horizontal Scaling 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
Load Balancer 
30 
Html2PdfConverter 2 
Html2PdfConverter 1 
PDF Service Process Pool 
Html2PdfConverter 2 
Html2PdfConverter 1 
PDF Service Process Pool
PDFg Service – Horizontal Scaling 
Login to ColdFusion Administrator, and then navigate to ‘Data & Services’ > PDF Service. 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
31
List PDF Service Managers 
Login to ColdFusion Administrator, and then navigate to ‘Data & Services’ > PDF Service. 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
32
Demo 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 33
Troubleshooting Tips 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
34 
 How to access PDFg service manager remotely 
 How to enable PDFg service logging
Accessing PDFg service manager remotely 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
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>
Logging 
End-Users ColdFusion 
Server 
ColdFusion logs PDF service 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 36 
ColdFusion 
Add-on Services 
Service 
HTML2PDFConverter 
logs PDF Service 
Manager
Enabling PDFg service logging 
<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. 
37 
Configuration file: 
<cf_install_root>/cfusion/jetty/webapps/PDFgServlet/WEB-INF/web.xml 
It creates PDF service log named pdfg_access.log
Performance Improvements 
120 
100 
80 
60 
40 
20 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
38 
0 
10 20 40 50 80 100 
Throughput(Request/Sec) 
Virtual Users 
CFDocument 
CFHtmlToPdf
Configuration used for Performance tests 
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 
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 Sharma 
nimsharm@adobe.com 
@nimsharm 
Elishia Dvorak 
elishia@adobe.com 
@elishdvorak

2014 cf summit_clustering

  • 1.
    The More theMerrier, Clustering in ColdFusion Elishia Dvorak | ColdFusion Solution Consultant & Evangelist Nimit Sharma | Software Engineer, ColdFusion © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
  • 2.
    Agenda  Differentways of clustering in ColdFusion  Vertical  Horizontal  Distributed  Load Balancing  Failover & Session Management © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 2
  • 3.
    Why Cluster? HighAvailability/Failover Redundancy © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 3
  • 4.
    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) © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 4
  • 5.
    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 © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 5
  • 6.
    © 2014 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential. 6
  • 7.
    © 2014 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential. 7
  • 8.
    Demo Setting Upa Vertical Cluster © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 8
  • 9.
    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) © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 9 CF 1 CF 2 CF 3 CF 4 CF 5 Web1 Web2 Web3 Web4 Web5
  • 10.
    Instance Manager -> Register Remote Instance © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 10 Must be unique for session affinity Weighted round robin Default 8985/8987 (in jetty.xml)
  • 11.
    Demo Setting Upa Horizontal ColdFusion Cluster © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 11
  • 12.
    Clustering in ColdFusion A B C A B C A B C © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 12
  • 13.
    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 © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 13
  • 14.
    Demo Distributed Architecture © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 14
  • 15.
    Where is allthis 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_dircfusionjettyetcjetty.xml: Admin component ports  instance_nameruntimeconfserver.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 © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 15
  • 16.
    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  © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 16
  • 17.
    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 © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 17
  • 18.
    Troubleshooting  VerboseConnector 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 © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 18
  • 19.
    © 2014 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential. PDFg Clustering and Scalability Nimit Sharma 19
  • 20.
    Agenda  PDFgService(CFHTMLTOPDF)  PDFg Service Clustering  Vertical  Horizontal  Troubleshooting tips  Performance improvements © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 20
  • 21.
    PDFg Service ©2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 21  Fully revamped PDF Engine  Produces high quality PDFs  Re-architected for high performance  Cluster Support for Enterprise Edition
  • 22.
    PDFg Service ©2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 22  CFHTMLToPDF  CFHTMLToPDFItem
  • 23.
    PDF generated usingCFDocument and CFHtmlToPdf CFDocument CFHtmlToPdf © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 23
  • 24.
    Components of PDFgService  Service: It is process named HTML2PDFConverter.  Service Manager: It manages the lifecycle of PDF generation. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 24
  • 25.
    Request Flow ©2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 25 End-Users ColdFusion Server ColdFusion Add-on Services Service HTML2PDFConverter PDF Service Manager
  • 26.
    PDFg Service Clusteringfor Scalability © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 26  Vertical Scaling  Horizontal Scaling
  • 27.
    PDFg Service –Vertical Scaling © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 27 Html2PdfConverter N Html2PdfConverter 3 Html2PdfConverter 2 Html2PdfConverter 1 PDF Service Process Pool PDF Service process can be increased with load.
  • 28.
    PDFg Service –Vertical Scaling © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 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>
  • 29.
    Demo © 2014Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 29
  • 30.
    PDFg Service –Horizontal Scaling © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Load Balancer 30 Html2PdfConverter 2 Html2PdfConverter 1 PDF Service Process Pool Html2PdfConverter 2 Html2PdfConverter 1 PDF Service Process Pool
  • 31.
    PDFg Service –Horizontal Scaling Login to ColdFusion Administrator, and then navigate to ‘Data & Services’ > PDF Service. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 31
  • 32.
    List PDF ServiceManagers Login to ColdFusion Administrator, and then navigate to ‘Data & Services’ > PDF Service. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 32
  • 33.
    Demo © 2014Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 33
  • 34.
    Troubleshooting Tips ©2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 34  How to access PDFg service manager remotely  How to enable PDFg service logging
  • 35.
    Accessing PDFg servicemanager remotely © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 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>
  • 36.
    Logging End-Users ColdFusion Server ColdFusion logs PDF service © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 36 ColdFusion Add-on Services Service HTML2PDFConverter logs PDF Service Manager
  • 37.
    Enabling PDFg servicelogging <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. 37 Configuration file: <cf_install_root>/cfusion/jetty/webapps/PDFgServlet/WEB-INF/web.xml It creates PDF service log named pdfg_access.log
  • 38.
    Performance Improvements 120 100 80 60 40 20 © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 38 0 10 20 40 50 80 100 Throughput(Request/Sec) Virtual Users CFDocument CFHtmlToPdf
  • 39.
    Configuration used forPerformance tests © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 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
  • 40.
    © 2014 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential. Nimit Sharma nimsharm@adobe.com @nimsharm Elishia Dvorak elishia@adobe.com @elishdvorak