Deciding What to Do Next


After you have a good grasp of your site's current performance, you can start looking for bottlenecks and performance issues. Every ColdFusion site is unique in one way or another, so it's hard to generalize about specific symptoms and their relationships to performance problems. One site may have a custom integration routine that downloads Web orders to an order processing system. Another site may have integrated ColdFusion with an Open Market transaction server. Many sites need to interface with a legacy mainframe database or with third-party applications. If you've examined all the non-ColdFusion bottleneck possibilities and still need to improve your ColdFusion server's performance, you have two options: optimizing the code, or adding more servers.

Some Issues to Consider When Looking for Performance Problems

A typical ColdFusion-driven site is fairly complex. Many factors, such as databases and network layout, contribute to performance. Given the possible number of these factors, your bottleneck is likely to lie outside ColdFusion or to indirectly depend on ColdFusion.

A good step, if you are experiencing performance problems, is to examine closely which pages users were requesting at the time of the problem. Look at what ColdFusion capabilities does the page or component use. If it makes database calls but doesn't do anything else, pay close attention to the performance of your query using the ColdFusion debug information. Check the performance of your database server and review your JDBC settings. User Perfmon too analyze performance metrics to see if your database is actually taking a long time to respond etc.

If the page is mostly CFML code, start by looking at the number of milliseconds the page takes to process with no traffic. Then eliminate sections of CFML and see what the effect is on total processing time. You might find that a particular piece of code is very resource intensive.

Let's look at a list of possible bottleneck points on a typical ColdFusion-based site. You should examine all the likely possibilities before you consider scaling.

Typical Bottlenecks

You should consider several possible sources of bottlenecks:

  • Application Errors. Resolving application errors can contribute to improved system performance. Some errors may result in threads running continuously, consuming server resources and eventually crashing the server.

  • Web-Server Bandwidth. Check to see how much bandwidth your network provider allocates for your site. If you have substantial traffic, a bottleneck might be caused if the provider institutes a cap on bandwidth (called bandwidth throttling), or if the networking equipment in place poses physical limitations on bandwidth.

  • Web-Server Performance. Preset limits to simultaneous HTTP requests can create a bottleneck.

  • Other Processes Running on the Same Server. Each additional process uses critical CPU and memory, even if it is just a small amount. These tiny amounts can accumulate quickly and impact performance. Conduct an audit of your server: If you are running Windows, use the Task Manager to determine how many processes are running and how they are affecting your resources. If you are running Unix operating systems, run the appropriate command to view open processes (for example, ps ax on Linux).

  • Hard Drive Speed. This is not just for <cffile>; ColdFusion must pull templates off the disk if they're not in cache. Don't forget your application.cfm files and <cfinclude> files. Even if you are caching templates, ColdFusion still checks the file on disk to see whether it has been modified, unless you specifically tell ColdFusion to trust cache files.

  • Network Latency. If you're communicating with other machines on the local network, latency generally shouldn't be an issue. However, if you are communicating with machines on remote networks, or if communications travel through switches or routersespecially at varying speedscheck the response time of each machine with which you are communicating. You can do this with a simple ping command to get the response time of a particular machine or by using the traceroute command (tracert on Windows) to determine whether any slow hops exist between you and the target machine.

  • Database Server Performance. You can run ColdFusion on a four-processor workhorse, but what does it matter if ColdFusion has to wait for your database, which is running on an old P200? Develop a .cfm page or create a custom probe that monitors database server performance to determine whether servers are nonresponsive. (See "Setting Up a System Probe to Verify External Connectivity," earlier in this chapter.)

  • Time It Takes to Run a Query. Review all database queries and consider table locking, record locking, and deadlock issues. Stored procedures are better than queries embedded in CFML.

  • Lack of JVM Tuning. Perform load tests using different JVM configuration attributes based on your specific JVM's configuration options. Tools such as Visual GC will allow you to more easily identify what garbage collection options to use.

  • JDBC Configuration. Perform load tests to analyze and improve database connection pooling. Tune your maximum simultaneous connections and cached queries settings.

  • CFX Tag Performance. Write a page using GetTickCount() to measure the execution time of a specific CFX tag. This tool helps you establish the execution time of each CFX tag you use and figure out whether one tag is a bottleneck.

  • CORBA Object Performance, Java Applet Performance. You can also write a custom probe or a .cfm page that tracks the performance of these components.

  • <cfmail>, <cfftp>, <cfhttp>. The performance of other servers (SMTP, FTP, HTTP, and such) may affect the performance of your Web site. The Internet latency to get there and back may be a bottleneck. Create a system probe to determine whether one of these servers is timing out, or you can write a .cfm page to report each server's response times.

  • Virtual Memory Settings. Although Microsoft recommends that the paging file be equal to the amount of RAM plus 12 MB for Windows machines, set the paging file equal to twice the amount of RAM to cover intense database operations. In Windows 2000, you can see your virtual memory settings by selecting the System option Control Panel, selecting the Advanced Tab, and then clicking Performance Options. In Windows NT, you can also select System from the Control Panel; however, Virtual Memory is located under the Performance tab. For Unix machines, ensure that you have sufficient swap space.

While this list is seemingly long it is nowhere near comprehensive. Understanding all the bottle necks in your application is crucial to understanding what you actually need to monitor so that you can actually figure out what is wrong with your application. At the same time you may be able to confirm through monitoring that you do not have enough bandwidth, your CPU is too slow, your hard drives are responding too slow, etc. There are issues that cannot be solved by better coding, selecting a few options, or making some minor changes. Many of the most important bottlenecks in a ColdFusion application end up being physical limitations of hardware, your network, etc and at that point you need to look to methods of scaling your application to overcome these bottlenecks.

For more about how to do this, look at chapter 3, "Scaling with ColdFusion," and chapter 4, "Scaling with J2EE."




Advanced Macromedia ColdFusion MX 7 Application Development
Advanced Macromedia ColdFusion MX 7 Application Development
ISBN: 0321292693
EAN: 2147483647
Year: 2006
Pages: 240
Authors: Ben Forta, et al

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net