Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

33
www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson

Transcript of Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

Page 1: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

www.cfunited.com

Performance Tuning ColdFusion

Before the JVM

Performance Tuning ColdFusion

Before the JVM

Chris Peterson

Page 2: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

2www.cfunited.com

Chris PetersonChris PetersonChris PetersonChris Peterson

A. Started ColdFusion development with version 4.5 express

B. Background in SQL and network administration

C. Started working full time for Alagad in January 2009

Page 3: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

3www.cfunited.com

ObjectiveObjectiveObjectiveObjective

Discuss a holistic approach to identifying performance issues with ColdFusion applications, using a variety of tools and server observation.

Page 4: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

4www.cfunited.com

Don’t waste time JVM tuning a lemonDon’t waste time JVM tuning a lemonDon’t waste time JVM tuning a lemonDon’t waste time JVM tuning a lemon

Page 5: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

5www.cfunited.com

Identify the dominant consumerIdentify the dominant consumerIdentify the dominant consumerIdentify the dominant consumer

A. Listen to what your server is trying to tell you.

B. Enable slow page logging.

C. Obtain and Analyze a heap dump.

D. Review memory utilization with VisualVM and the VisualGC plug-in.

E. Investigate method calls with HPJmeter

F. Capture a SQL trace during peak production site load.

Page 6: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

6www.cfunited.com

Listen to what your server is trying to tell youListen to what your server is trying to tell youListen to what your server is trying to tell youListen to what your server is trying to tell you

Page 7: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

7www.cfunited.com

Reading the CPU graphReading the CPU graphReading the CPU graphReading the CPU graph

A. Green line = Total CPU utilization

B. Red line = Kernel / System usage

C. Green – Red = Application CPU usage

D. High kernel usage is often indicative of an I/O issue.

E. Waiting on I/O means your application code is not executing.

Page 8: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

8www.cfunited.com

Enable slow page loggingEnable slow page loggingEnable slow page loggingEnable slow page logging

A. Enable slow page logging

B. Process the server.log file with findslow.cfm (at www.cfcode.net) to get a report on the most-often used slow templates.

Page 9: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

9www.cfunited.com

Obtain and analyze a heap dumpObtain and analyze a heap dumpObtain and analyze a heap dumpObtain and analyze a heap dump

A. Obtain a heap dump –XX:+HeapDumpOnOutOfMemoryError VisualVM (Applications -> Heap Dump)

B. Review the heap dump in Netbeans or VisualVM

Page 10: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

10www.cfunited.com

VisualVM heap dumpVisualVM heap dumpVisualVM heap dumpVisualVM heap dump

Page 11: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

11www.cfunited.com

VisualVM Heap Dump (continued)VisualVM Heap Dump (continued)VisualVM Heap Dump (continued)VisualVM Heap Dump (continued)

Page 12: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

12www.cfunited.com

VisualVM and VisualGCVisualVM and VisualGCVisualVM and VisualGCVisualVM and VisualGC

A. Increase in ‘heap size after full GC’ each time is indicative of a memory leak.

Page 13: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

13www.cfunited.com

VisualGC outputVisualGC outputVisualGC outputVisualGC output

Page 14: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

14www.cfunited.com

Review methods with HPJmeterReview methods with HPJmeterReview methods with HPJmeterReview methods with HPJmeter

A. Capture method invocation data -Xrunhprof:cpu=times,cutoff=0 View metrics -> Method Call Count View metrics -> Call Graph Tree (CPU)

B. Identify lingering objects (memory leaks) -Xrunhprof:heap=all,cutoff=0 View metrics -> Residual Objects (Count)

Page 15: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

15www.cfunited.com

Example of HPJmeter method count listExample of HPJmeter method count listExample of HPJmeter method count listExample of HPJmeter method count list

Page 16: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

16www.cfunited.com

HPJmeter Residual Objects (count)HPJmeter Residual Objects (count)HPJmeter Residual Objects (count)HPJmeter Residual Objects (count)

Page 17: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

17www.cfunited.com

Example of HPJmeter Call Graph TreeExample of HPJmeter Call Graph TreeExample of HPJmeter Call Graph TreeExample of HPJmeter Call Graph Tree

Page 18: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

18www.cfunited.com

Its not always about the codeIts not always about the codeIts not always about the codeIts not always about the code

A. Network latency

B. Overloaded disk resources

C. Poorly configured database

D. Web server configuration

Page 19: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

19www.cfunited.com

Identify Network IssuesIdentify Network IssuesIdentify Network IssuesIdentify Network Issues

A. Identify overloaded nic with task manager.

B. Identify host issues with ping or pathping.

C. Identify network connections with netstat –a, or using Free Extended Task Manager.

D. More detailed investigation can be done with managed routers, or tools like WireShark (formerly Ethereal) to capture and analyze all network traffic.

Page 20: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

20www.cfunited.com

Wireshark – packet listingWireshark – packet listingWireshark – packet listingWireshark – packet listing

Page 21: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

21www.cfunited.com

Wireshark – packet detailWireshark – packet detailWireshark – packet detailWireshark – packet detail

Page 22: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

22www.cfunited.com

Ports Open – Free Extended Task ManagerPorts Open – Free Extended Task ManagerPorts Open – Free Extended Task ManagerPorts Open – Free Extended Task Manager

Page 23: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

23www.cfunited.com

Identify Overloaded Disk ResourcesIdentify Overloaded Disk ResourcesIdentify Overloaded Disk ResourcesIdentify Overloaded Disk Resources

Page 24: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

24www.cfunited.com

Identify a poorly configured databaseIdentify a poorly configured databaseIdentify a poorly configured databaseIdentify a poorly configured database

A. Capture a .trc file using SQL profiler with the ‘tuning’ profile selected

B. Run your .trc file through the database tuning advisor (available on SQL Standard or higher) and quickly locate database slow-downs, and even implement recommended fixes.

Page 25: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

25www.cfunited.com

Configure your SQL captureConfigure your SQL captureConfigure your SQL captureConfigure your SQL capture

Page 26: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

26www.cfunited.com

SQL trace in progressSQL trace in progressSQL trace in progressSQL trace in progress

Page 27: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

27www.cfunited.com

Starting the tuning advisorStarting the tuning advisorStarting the tuning advisorStarting the tuning advisor

Page 28: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

28www.cfunited.com

Tuning advisor in progressTuning advisor in progressTuning advisor in progressTuning advisor in progress

Page 29: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

29www.cfunited.com

Database Tuning Advisor resultsDatabase Tuning Advisor resultsDatabase Tuning Advisor resultsDatabase Tuning Advisor results

Page 30: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

30www.cfunited.com

In the end, it’s really all about user perceptionIn the end, it’s really all about user perceptionIn the end, it’s really all about user perceptionIn the end, it’s really all about user perception

A. Enable gzip compression of static site assets.

B. Combine CSS and JS files for faster loading.

C. Enable expiration tags for images, CSS, and javascript files for a future date.

D. Use a tool like ySlow to identify user-side issues. http://developer.yahoo.com/yslow/

E. Testing with tools like Jmeter can help you get a better user perspective on site performance. http://jakarta.apache.org/jmeter/

Page 31: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

31www.cfunited.com

ReviewReviewReviewReview

A. Your Coldfusion server does not work in a vacuum.

B. Identify your dominant consumer first, and address each until acceptable performance is achieved.

C. Its not always about the code.

D. User perception is the final word in web site performance measurement.

Page 32: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

32www.cfunited.com

LinksLinksLinksLinks

A. VisualVM - https://visualvm.dev.java.net/download.html(visualGC available in the plugin center)

B. Netbeans - http://www.netbeans.org/downloads/index.html

C. HPJmeter – http://www.hp.com/java

D. Free Extended Task Manager - http://www.extensoft.com/

Page 33: Www.cfunited.com Performance Tuning ColdFusion Before the JVM Chris Peterson.

33www.cfunited.com

Questions?Questions?Questions?Questions?

A. Chris Peterson, Server Engineer

B. Alagad, Inc.

C. http://www.alagad.com/

D. [email protected]

E. (888) Alagad4 ext 369

F. Override11 (twitter)