开发者

How do you properly benchmark ColdFusion execution times?

开发者 https://www.devze.com 2023-02-21 07:11 出处:网络
1) What settings in the ColdFusion Administrator should be turned off/on? 2) What ColdFusion code should you use to properly benc开发者_如何学JAVAhmark execution time like getTickCount()?

1) What settings in the ColdFusion Administrator should be turned off/on?

2) What ColdFusion code should you use to properly benc开发者_如何学JAVAhmark execution time like getTickCount()?

3) What system information should you provide also like CF Engine, Version, Standard/Enterprise, DB, etc?


What we do is:

  • In Application.cfc's onRequestStart() -> set tick count value, add to REQUEST scope.
  • In Application.cfc's onRequestEnd() -> set tick count value, subtract first value from it to get total processing time in ms
  • We then have a set threshold (say 200ms) and if that threshold is reached we'll log a record in a database table
  • Typically we'll log the URL query string, the script name, the server name, etc.

This can give very useful information over time on how particular pages are performing. This can also be easily graphed so you can see if a page suddenly started taking 5000ms where before it was taking 300ms, and then you can check SVN to see what change did it :)

Hope that helps!


1) In CF administrator, in Debug Settings, you can turn on Enable Request Debugging Output, which outputs runtime and other debugging information at the bottom of every page. This can be useful if you want to see queries as well. If you want to use timers to you must select Timer Information in the Debug Settings(got hung on that for a hot minute).

2) You can use timers to have custom benchmarks of execution times. There are four types, inline, outside,comment or debug, each corresponding to where the output will be. In inline, it will create a little box around your code(if its a .cfm) and print the total runtime. The others will print in the bottom output that you turned on in CF admin.

3) I don't really know what you should provide. Wish I could help more. In my opinion the more information the better, so that what I would say :P


with respect to @mbseid's answer, request debugging adds a significant amount of processing time to any request, especially if you use CFCs. I would recommend you turn request debugging off and use getTickCount() at the top and bottom of the page and then take the difference to get the time to render that page. This will give you a much closer reflection of how the code will perform in production.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号