Skip to main content
November 24, 2009
Question

How to improve CFC performance

  • November 24, 2009
  • 5 replies
  • 2094 views

Hi All,

The database queries I had at the top of the page were moved into a CFC and now it is taking noticeable amount of time in displaying the data. How do I improve the performance of the CFC so that it does not take more amount of time for displaying the data.

I'm on CF 9 Standard version and the methods in the CFC return queries to the page that invoke the component.

Please help. Thanks.

- Milind

This topic has been closed for replies.

5 replies

Inspiring
November 27, 2009

Just a long shot from prior experience:

Does  "dbqueries." happen to be a mapping set in CF administrator? I have seen a few times, random, that when its' a mapping, it is a bit slower rather than letting it parse the file/folder path of the webroot. I never could figure it out, but once I had this issue, 2-4 sec difference by having the CF mapping.

November 27, 2009

No "dbqueries" is not mapped. Its a physical directory under "<cfroot>\CustomTags\".

BKBK
Community Expert
Community Expert
November 27, 2009

Does this perform any better?

<cfset qryRunDetails = createobject("component", "dbqueries.iriqueries").getRunDetails(trim(url.pid),trim(url.rid),trim(url.cru))>

BKBK
Community Expert
Community Expert
November 25, 2009

Milind,

Did you turn debugging on? Coldfusion's debugging apparatus parses and records some administration about all the files involved in a request, from the Application.cfc events fired, through to the objects instantiated and methods invoked.

In general, with debugging on, the CFC will contribute much more to the debugger's consumption than an ordinary CFM page. To compare like with like, switch debugging off before doing any comparison. You may likely find there is nothing wrong with your CFC's performance.

November 27, 2009

No. The debugging is not turned on.

BKBK
Community Expert
Community Expert
November 27, 2009
No. The debugging is not turned on.

Then turn it on in the Coldfusion Administration. It will display the processes involved in a request and their execution times.

Inspiring
November 25, 2009

This thread might be relevent.

http://forums.adobe.com/thread/529289?tstart=0

Also, to see where the delay is occurring, cfdumping a gettickcount() right before your cfinvoke tag and at various places in the cfc may provide some useful information.

Inspiring
November 24, 2009

Why did you move the queries?  Is it so they are available to other pages, or did you do it for philisophical reasons?

November 24, 2009

Yes, I moved them to a CFC so that the same queries can be made available to other pages. But, I was surprised to see the performance taking a hit.

Thanks.

- Milind

Inspiring
November 24, 2009

CFCs do come with a bit of a performance price.  How big a hit are you seeing?

Inspiring
November 24, 2009

Can you show us some "before" and "after" code?

--

Adam

November 24, 2009

Adam,

Its the same queries that I had on the page are now in a CFC. Do you still need the SQLs? There is absolutely no change in the queries.

Thanks.

- Milind

Inspiring
November 24, 2009

Well if the SQL is identical then no need to post it.  But everything else in the CFC and the calling code would help.

--

Adam