ColdFusion Performance Tuning Keen Haynes Certified ColdFusion Developer.

Slides:



Advertisements
Similar presentations
Advanced Troubleshooting with Debug Diagnostics on IIS 6
Advertisements

Chapter 9. Performance Management Enterprise wide endeavor Research and ascertain all performance problems – not just DBMS Five factors influence DB performance.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Adam Jorgensen Pragmatic Works Performance Optimization in SQL Server Analysis Services 2008.
QA practitioners viewpoint
Oracle Architecture. Instances and Databases (1/2)
Computer Monitoring System for EE Faculty By Yaroslav Ross And Denis Zakrevsky Supervisor: Viktor Kulikov.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Chapter 14 Chapter 14: Server Monitoring and Optimization.
DT211/3 Internet Application Development
1 - Oracle Server Architecture Overview
Memory Management 2010.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
©Company confidential 1 Performance Testing for TM & D – An Overview.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
NovaBACKUP 10 xSP Technical Training By: Nathan Fouarge
© 2011 IBM Corporation 11 April 2011 IDS Architecture.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
Benjamin Lavalley, Sr. Product Marketing Manager Kaseya 2 Upgrade Review.
The Art of Debugging Shlomy Gantz 02/13/01MDCFUG.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
Copyright ®xSpring Pte Ltd, All rights reserved Versions DateVersionDescriptionAuthor May First version. Modified from Enterprise edition.NBL.
Software Architecture for ColdFusion Developers Unit 4: Application Events and Global Variables.
What’s New in CF 8 Admin MDCFUG 8/14/2007 Ajay Sathuluri Sr. Web and Database Engineer TeraTech Inc.
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Strength. Strategy. Stability.. Progress Performance Monitoring and Tuning Dan Foreman Progress Expert BravePoint BravePoint
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Oracle9i Performance Tuning Chapter 1 Performance Tuning Overview.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
1 Maryland ColdFusion User Group Session Management December 2001 Michael Schuler
Oracle 10g Database Administrator: Implementation and Administration Chapter 2 Tools and Architecture.
Installing, Configuring And Troubleshooting Coldfusion Mark A Kruger CFG Ryan Stille CF Webtools.
Learningcomputer.com SQL Server 2008 – Profiling and Monitoring Tools.
Module 13 Implementing Business Continuity. Module Overview Protecting and Recovering Content Working with Backup and Restore for Disaster Recovery Implementing.
Module 10 Administering and Configuring SharePoint Search.
1 IT420: Database Management and Organization Session Control Managing Multi-user Databases 24 March 2006 Adina Crăiniceanu
Improving Database Performance Derrick Rapley
Locking In CFML. Locking in CFML - Why - How - What - When } to lock? Understand Locking.
By Shanna Epstein IS 257 September 16, Cnet.com Provides information, tools, and advice to help customers decide what to buy and how to get the.
“Load Testing Early and Often” By Donald Doane Presentation to the Rockville MDCFUG.
CF Pest Control By Shlomy Gantz President, BlueBrick Inc. Presented by Sandra Clark
ESRI User Conference 2004 ArcSDE. Some Nuggets Setup Performance Distribution Geodatabase History.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
CF Performance Tuning Matt Liotta President & CEO Montara Software, Inc.
Using Derrick Rapley Maryland CFUG January 8, 2002.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
1 Copyright © 2005, Oracle. All rights reserved. Following a Tuning Methodology.
Advance Caching Techniques Keen Haynes MKAD SCCFUG Winter 2002 Conference.
Locking In CFML. Locking in CFML - Why - How - What - When } to lock? Understand Locking.
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
Copyright Sammamish Software Services All rights reserved. 1 Prog 140  SQL Server Performance Monitoring and Tuning.
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
Cool CF Debugging Shlomy Gantz 07/29/01CF_ODYSSEY.
Java Autonomous Artificial Intelligence By : Abhishek Singh
SQL Server Monitoring Overview
Database Performance Tuning and Query Optimization
Introduction of Week 3 Assignment Discussion
ColdFusion Performance Troubleshooting and Tuning
Nate Nelson I*LEVEL, Inc.
Troubleshooting Techniques(*)
Chapter 11 Database Performance Tuning and Query Optimization
Using wait stats to determine why my server is slow
Presentation transcript:

ColdFusion Performance Tuning Keen Haynes Certified ColdFusion Developer

Overview  Application Environments  Testing Techniques  Tuning Techniques  Coding Tips  Variable Locking  Databases and Queries  Thread Processing  Debugging

Application Environment  Goals Provide separate, autonomous areas for Development, Testing/Staging and Production Provide the Developer Community with an environment that maximizes  Productivity  Effectiveness

Application Environment, cont. Provide a Testing/Staging environment that facilitates  Automated application staging  Testing  Load/Scalability testing  Production readiness (data migration, etc) Provide a Production environment that is  Scalable  Manageable  Makes efficient use of resources  Designed for High-Availability and end-user responsiveness

Testing Techniques  Perform “Critical Path” or “Strategic Strike” Analysis  Stress User vs. Real User  Build a “Real-World” load generator test script  Load Test & Perform Bottleneck Analysis  Do Manual Timings in a browser (no load vs under load)  Perform Endurance Testing  Examine log files during testing

Testing Techniques, cont.  Principle elements involved in template response time: Total Execution Time (i.e. 203ms) Query Time (i.e. 156ms) Processing/Response Time: Total - Query (i.e. 46ms)

Tuning Techniques  Establish your max user base line  Manually walk through test and capture explode bench marking – identify bottlenecks  Test with new general CF admin settings  Test with changes to simultaneous request settings changes – normally the biggest bang for your buck.

Managing Performance, cont.  Query Time: Can be significantly reduced by proper DB Design, Configuration, Tuning and Administration Use a professional Database Administrator (DBA) Ensure/verify updated/proper version of ODBC (i.e. MDAC v 2.6) and/or DB client libraries on CF Server In CF Server, try “Maintain DB Connections” (Very) generally, queries taking longer than > 150ms execution time w/no load MUST be examined closely

Coding Tips  Use CF built-in functions wherever possible  Avoid complex logic inside CFQUERY (build outside)  Fully scope variables  Lock all Session, Application, and Server variable access  MDAC update ComCheck  Overuse of #

Coding Tips  Carefully load test and analyze CFX calls response times C++, Java  Be careful using CFHTTP, CFFTP  Scalability of CFFILE  CFMAIL in mass mailings  Avoid redundant queries and looping queries  Use Stored Procedures where appropriate  Avoid redundant code Use of CFINCLUDE versus Custom Tags  Blank space

Coding Tips  Caching strategies Queries  Administrator  CACHEDWITHIN  Selection of content Templates  Administrator  CFCACHE  SUPERCACHE

Variable Locking  Server, Application, and Session vars must be locked using !  Or random memory corruption occurs.  Consider Client and Request scopes  Symptoms: PCode errors, Unknown Exception errors  Use “Full Checking” in Dev and Staging environments

Variable Locking Levels: Exclusive, ReadOnly  Exclusive: does not allow any operations on a given variable scope until the current process within the lock is complete.  ReadOnly: allows multiple reads within the scope but no write access.  If an Exclusive lock is processed at the same time as a ReadOnly lock, the ReadOnly lock will wait for the Exclusive lock to finish before proceeding.

Variable Locking Locking methods  As a general rule of practice locking should be done in the code using CFLOCK.  ReadOnly locking can be applied globally to SERVER, APPLICATION, and SESSION variables using the "Automatic Read Locking" option on the Locking page of the ColdFusion Administrator.  There is no method to write-lock variables globally in the CF Administrator when using multi-threaded sessions. One could single-thread sessions using the "Single Threaded Sessions" option, thereby eliminating the need for locking SESSION variables, but this results in severe performance degradation and is not recommended for scalable applications.

Variable Locking CFLOCK Syntax  Typical usage   [process] 

Variable Locking NAME Locks  May be used in place of locking by scope.  The NAME argument is used in place of the SCOPE argument. Nesting Locks  As a general rule of thumb, nested locks should be avoided as they can result in deadlocks. Please refer to the CFML Language Reference Documentation if nested locks are considered absolutely necessary. Avoid use of locks in queries

Database Issues  Use latest stable release  Look for PCode errors including “SQL” or “Query”  Queries that never return; apparent CF Server hang  Troubleshoot by setting max DB connections to 1

SQL  Ensure appropriate indexes are available for all common queries  Clustered Indexes in SQL Server  Avoid calling queries in loops  Use joins instead of looping around queries if possible

Query Caching  Appropriate for queries with few permutations  Limits to number and size of queries  No easy way to “flush” cached queries  Caching for only one minute at 10 queries per second reduces load on the database (for that query) by 600x

Query Caching  Example: Cache statecodes query for 10 minutes: SELECT * FROM States ORDER BY StateCode

 A.cfm page is requested by a web browser  The.cfm request passed to the CF Web server stub  The stub sends the request to the ColdFusion Application Server for processing. Thread Processing

Thread Processing (cont)  A listener thread receives the request, sends it to one of the waiting active simultaneous threads to process the request. If all of simultaneous threads are busy, the listener thread places the request on a waiting list. When one of the simultaneous request slots becomes available, listener thread sends the waiting request to the active slot.

Thread Processing (cont)  The ColdFusion server Processes all of the CFML tags in the page Converts the results to HTML and sends them back to the web server to be sent to the browser.

Thread Processing (cont)  The thread is put back into the active pool to be reused. Much less resource intensive than the thread create/destroy scenario.

3rd Party Calls  If 3rd party call never returns a result set or error message, thread will continue to wait and will NOT timeout If many.cfm page requests with blocking third party requests  Simultaneous Request limit will be reached  ColdFusion server will appear to hang BUT: ColdFusion is not failing to process, it simply is waiting for a response from a third party resource call.

ColdFusion Debugging  Performance or stability problems more often than not are caused by processing of a third party request Pinpointing these third party problems can be difficult The following steps should be taken to help determine the source of the issue

ColdFusion Debugging  STEP 1 Examine logs

ColdFusion Debugging  STEP 2 Verify the source of the unresponsiveness of the ColdFusion server  Try opening up ColdFusion Administrator or other simple.CFM page  If this fails, try to open a.html or.html page  If web server returns the.html page, the web server is functioning properly, go to Step 2  If.html page does not return, web server is causing the problem, stop and restart the web server  If after stopping and starting the web server ColdFusion pages still do not return, go to step 2.

ColdFusion Debugging  STEP 3 Open up the NT Performance Monitor or run cfstat and add the CF "Queued Requests", and "Running Requests" counters, along with %CPU usage for the CFSERVER instance.  If third party request is suspected, at time of the hang: %CPU usage will be approx. zero, Running Requests will be approx. at Simultaneous Request limit and Queued Requests should be rising

ColdFusion Debugging  STEP 4 - At the time of the unresponsive period, try running a query through MSQuery using SQLPlus or ISQL. These do not connect to the database through ODBC and will verify the ODBC connection to the database Run the same SQL statement that you believe is causing the problem SQL Profiler Deadlocking

ColdFusion Debugging  STEP 5 - Turn on "logging of slow pages" in the debugger section. At the very least it will list the templates that are active for n seconds. This will give your users a place to start looking for long running queries

ColdFusion Debugging  STEP 6 - Non-functioning, or slow functioning CFX tags, or CFML code called in your ColdFusion templates can also be the cause of ColdFusion performance/stability issues. Determining that a CFX tag or piece of CFML code is causing the problem is not an easy task Use the CF function GetTickCount() around CFX tag call (or any suspected piece of slow performing code)

ColdFusion Debugging  Example: (code to be timed here...) Time to Complete: #totalTime#

ColdFusion Debugging  Versions: Be certain all patch revisions are current  OS  Kernal  C++  DB  WWW  CFAS

ColdFusion Debugging  Poorly written SQL statements Full table scans (not, like)  No database indexing  No use of stored procedures  Deadlocking

ColdFusion Debugging  CFMAIL as mass-mailer  CFX tags that lose thread control  CFHTTP - incorrect URLs  No CFLOCK around client, application variables  Poorly written logic  Liberal use of CFLOCATION  Disk I/O

ColdFusion Debugging  Logs Overuse (CFAS) Fill disk (DB, WWW, CFAS)  Client variable storage in registry  Debug settings on IP specific  Third party application servers sharing box  Extraneous services ScreenSaver, etc.