RE: query caching (was: RE: CFC performance difficulties)

2003-06-29 Thread Dave Watts
> Is there any documentation on how to handle cached queries 
> across a load balanced environment?

No, not to my knowledge.

> I've noticed some oddities on ours, and was wondering if we 
> were missing something obvious.

Could you be more specific? Are you referring to caching queries using the
CACHEDWITHIN/CACHEDAFTER attributes of CFQUERY? Or are you referring to
caching queries as variables in memory? There's no built-in mechanism for
doing either across a load-balanced cluster.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Host with the leader in ColdFusion hosting. 
Voted #1 ColdFusion host by CF Developers. 
Offering shared and dedicated hosting options. 
www.cfxhosting.com/default.cfm?redirect=10481

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



CFC performance difficulties

2003-06-27 Thread Mike Pacella
Thanks for the feedback, Brian & Sean.  I think it'd be best to just deal with the 
query objects as opposed to creating these massive structures of CFCs (since Cold 
Fusion query objects are one of the most powerful facets of the language).  If I need 
to deal w/ one particular object, then it sounds like object instantantion might be a 
possibility.  That will work just fine.

Thanks again !  Mike
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: CFC performance difficulties

2003-06-27 Thread Calvin Ward
Is there any documentation on how to handle cached queries across a load
balanced environment?

I've noticed some oddities on ours, and was wondering if we were missing
something obvious.

- Calvin

- Original Message - 
From: "Sean A Corfield" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, June 26, 2003 6:54 PM
Subject: Re: CFC performance difficulties


> On Thursday, Jun 26, 2003, at 12:12 US/Pacific, Mike Pacella wrote:
> > Thanks for the reply Sean.  My one question is that I've been doing
> > Java for about 2 years and this is primarily the methodology we, as a
> > company subscribed to.In situations where we had objects that
> > would need to be looked up frequently, we'd create Hashtables whose
> > values would be the objects we needed to look up.
>
> A lot depends on how you're using the objects and / or data. CF is very
> good at caching database queries so re-running the query is not a big
> overhead (because, well, basically you don't end up re-running the
> query!).



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: CFC performance difficulties

2003-06-26 Thread Sean A Corfield
On Thursday, Jun 26, 2003, at 12:12 US/Pacific, Mike Pacella wrote:
> Thanks for the reply Sean.  My one question is that I've been doing 
> Java for about 2 years and this is primarily the methodology we, as a 
> company subscribed to.In situations where we had objects that 
> would need to be looked up frequently, we'd create Hashtables whose 
> values would be the objects we needed to look up.

A lot depends on how you're using the objects and / or data. CF is very 
good at caching database queries so re-running the query is not a big 
overhead (because, well, basically you don't end up re-running the 
query!).

> This would give us easy access to the objects...I thought that, with 
> ColdFusion, structures were essentially Hashtables.  And, CFCs were 
> essentially objects.  So I figured this would be a "slam dunk".

CF provides quite a thick abstraction layer over Java so while some 
idioms translate over well, others do not. CFCs are objects but, for 
example, a method is *also* an object so that CF's 'late binding' and 
metadata model can behave consistently. Furthermore, CF's structs are 
case-insensitive which adds overhead compared to Java's hash tables.

> Is there another way you would suggest, just speaking in general OO 
> terms even, that would speed up this problem?  If I'm catching your 
> drift properly, you are suggesting that my design is weak, and that 
> CFC limitations aren't the problem.  So, any help on the fallacies of 
> my design would be greatly appreciated...

I don't have enough information to hand to say whether the design is or 
is not appropriate to the problem you're trying to solve. If you could 
tell us a little bit more about how you are using the data / objects 
and what the application does, that would help.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: CFC performance difficulties

2003-06-26 Thread Sean A Corfield
On Thursday, Jun 26, 2003, at 13:07 US/Pacific, Bryan Love wrote:
> Wow, you have a lot going on here.  It's no wonder it takes a while to
> execute Is there any reason you do not want to run two queries 
> instead?
> You are transferring the work load of the DB to the CF server in the 
> code
> below - you should let the DB do what it does best.

Bryan's right here - and this goes back to my comment about Blake 
Stone's "Five Secrets": be lazy, defer object creation and 
initialization until you really need it.

> You'll need one query to get the list of campuses and another to 
> display the
> information about a chosen campus, right?  That's how CF was meant to 
> work
> best.

If you lazy initialize the Campus CFCs on demand from the campus code, 
that might well be 'faster' (assuming your page doesn't require all the 
Campus objects on page one?). 'faster' in the sense that your first 
page won't get a big hit and the overall time will be spread over 
multiple pages perhaps.

Again, a lot depends on how you are using this information.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Host with the leader in ColdFusion hosting. 
Voted #1 ColdFusion host by CF Developers. 
Offering shared and dedicated hosting options. 
www.cfxhosting.com/default.cfm?redirect=10481

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: CFC performance difficulties

2003-06-26 Thread Bryan Love
also

if you insist on doing it with one query you have other options... cache the
query and use this (untested code):






#selectCampuses[idx].campusCd#
#selectCampuses[idx]
.


+---+
Bryan Love
  Database Analyst
  Macromedia Certified Professional
  Internet Application Developer
TeleCommunication Systems
[EMAIL PROTECTED]
+---+

"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
- Thomas Paine, The American Crisis

"Let's Roll"
- Todd Beamer, Flight 93



-Original Message-
From: Mike Pacella [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 12:48 PM
To: CF-Talk
Subject: CFC performance difficulties






  


SELECT campusCode, typeCode, campusName, localName,
openDate, addedDate, changedDate,
terminalID,
communityInd, locationCode
FROM CAMPUS
  

QueryAddRow(qSelectCampus);
QuerySetCell(qSelectCampus, "campusCode", "8");
QuerySetCell(qSelectCampus, "campusName", "RF -
SYSTEM ADMIN");
stCampusData = StructNew();
 


// Create the campus object
stCampusDataArgs = StructNew();
stCampusDataArgs.campusCd = campusCode;
if (typeCode neq "")
stCampusDataArgs.campusTypeCd = typeCode;
if (campusName neq "")
stCampusDataArgs.campusNm = campusName;
if (localName neq "")
stCampusDataArgs.campusLocalNm = localName;
if (openDate neq "")
stCampusDataArgs.campusOpenDt = openDate;
if (addedDate neq "")
stCampusDataArgs.campusAddDt = addedDate;
if (changedDate neq "")
stCampusDataArgs.campusChangeDt = changedDate;
if (terminalID neq "")
stCampusDataArgs.trmId = terminalID;
if (communityInd neq "")
stCampusDataArgs.cmmColInd = communityInd;
if (locationCode neq "")
stCampusDataArgs.locCd = locationCode;




StructInsert(stCampusData, campusCode,
objCampusData);



 



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: CFC performance difficulties

2003-06-26 Thread Bryan Love
Wow, you have a lot going on here.  It's no wonder it takes a while to
execute Is there any reason you do not want to run two queries instead?
You are transferring the work load of the DB to the CF server in the code
below - you should let the DB do what it does best.

You'll need one query to get the list of campuses and another to display the
information about a chosen campus, right?  That's how CF was meant to work
best.

+---+
Bryan Love
  Database Analyst
  Macromedia Certified Professional
  Internet Application Developer
TeleCommunication Systems
[EMAIL PROTECTED]
+---+

"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
- Thomas Paine, The American Crisis

"Let's Roll"
- Todd Beamer, Flight 93



-Original Message-
From: Mike Pacella [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 12:48 PM
To: CF-Talk
Subject: CFC performance difficulties






  


SELECT campusCode, typeCode, campusName, localName,
openDate, addedDate, changedDate,
terminalID,
communityInd, locationCode
FROM CAMPUS
  

QueryAddRow(qSelectCampus);
QuerySetCell(qSelectCampus, "campusCode", "8");
QuerySetCell(qSelectCampus, "campusName", "RF -
SYSTEM ADMIN");
stCampusData = StructNew();
 


// Create the campus object
stCampusDataArgs = StructNew();
stCampusDataArgs.campusCd = campusCode;
if (typeCode neq "")
stCampusDataArgs.campusTypeCd = typeCode;
if (campusName neq "")
stCampusDataArgs.campusNm = campusName;
if (localName neq "")
stCampusDataArgs.campusLocalNm = localName;
if (openDate neq "")
stCampusDataArgs.campusOpenDt = openDate;
if (addedDate neq "")
stCampusDataArgs.campusAddDt = addedDate;
if (changedDate neq "")
stCampusDataArgs.campusChangeDt = changedDate;
if (terminalID neq "")
stCampusDataArgs.trmId = terminalID;
if (communityInd neq "")
stCampusDataArgs.cmmColInd = communityInd;
if (locationCode neq "")
stCampusDataArgs.locCd = locationCode;




StructInsert(stCampusData, campusCode,
objCampusData);



 



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



CFC performance difficulties

2003-06-26 Thread Mike Pacella
   
 


  
 


SELECT campusCode, typeCode, campusName, localName, openDate, 
addedDate, changedDate,
terminalID, communityInd, 
locationCode
FROM CAMPUS
  

QueryAddRow(qSelectCampus);
QuerySetCell(qSelectCampus, "campusCode", "8");
QuerySetCell(qSelectCampus, "campusName", "RF - SYSTEM ADMIN");
stCampusData = StructNew();
 


// Create the campus object
stCampusDataArgs = StructNew();
stCampusDataArgs.campusCd = campusCode;
if (typeCode neq "") stCampusDataArgs.campusTypeCd = 
typeCode;
if (campusName neq "") stCampusDataArgs.campusNm = 
campusName;
if (localName neq "") stCampusDataArgs.campusLocalNm = 
localName;
if (openDate neq "") stCampusDataArgs.campusOpenDt = 
openDate;
if (addedDate neq "") stCampusDataArgs.campusAddDt = 
addedDate;
if (changedDate neq "") 
stCampusDataArgs.campusChangeDt = changedDate;
if (terminalID neq "") stCampusDataArgs.trmId = 
terminalID;
if (communityInd neq "") stCampusDataArgs.cmmColInd = 
communityInd;
if (locationCode neq "") stCampusDataArgs.locCd = 
locationCode;




StructInsert(stCampusData, campusCode, objCampusData);



 


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: CFC performance difficulties

2003-06-26 Thread Bryan Love
post the code you are using to create the array of structs from the query
results.

+---+
Bryan Love
  Database Analyst
  Macromedia Certified Professional
  Internet Application Developer
TeleCommunication Systems
[EMAIL PROTECTED]
+---+

"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
- Thomas Paine, The American Crisis

"Let's Roll"
- Todd Beamer, Flight 93



-Original Message-
From: Mike Pacella [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 12:12 PM
To: CF-Talk
Subject: CFC performance difficulties


Thanks for the reply Sean.  My one question is that I've been doing Java for
about 2 years and this is primarily the methodology we, as a company
subscribed to.In situations where we had objects that would need to be
looked up frequently, we'd create Hashtables whose values would be the
objects we needed to look up.  This would give us easy access to the
objects...I thought that, with ColdFusion, structures were essentially
Hashtables.  And, CFCs were essentially objects.  So I figured this would be
a "slam dunk".

Is there another way you would suggest, just speaking in general OO terms
even, that would speed up this problem?  If I'm catching your drift
properly, you are suggesting that my design is weak, and that CFC
limitations aren't the problem.  So, any help on the fallacies of my design
would be greatly appreciated...

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



CFC performance difficulties

2003-06-26 Thread Mike Pacella
Thanks for the reply Sean.  My one question is that I've been doing Java for about 2 
years and this is primarily the methodology we, as a company subscribed to.In 
situations where we had objects that would need to be looked up frequently, we'd 
create Hashtables whose values would be the objects we needed to look up.  This would 
give us easy access to the objects...I thought that, with ColdFusion, structures were 
essentially Hashtables.  And, CFCs were essentially objects.  So I figured this would 
be a "slam dunk".

Is there another way you would suggest, just speaking in general OO terms even, that 
would speed up this problem?  If I'm catching your drift properly, you are suggesting 
that my design is weak, and that CFC limitations aren't the problem.  So, any help on 
the fallacies of my design would be greatly appreciated...
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: CFC performance difficulties

2003-06-26 Thread Rich Z
Michael:

I'll admit that I don't have years of OO experience behind me, but in my
experience I've found that many of the applications I've designed/built
share a very common paradigm: objects that require a line-item view
(e.g. lists and search results) and a zoomed-in or "detailed" view
(often used for full view of a single object or an edit/modify page of
that object). 

With that assumption, I think it makes the most sense to reserve object
instantiation for those full views of your object while creating other
CFC's that simply build queries for search results. I suppose the better
question to ask is - why would I need all the glorious details and
methods of a particular object if all I can really do in a line-item
sort of view is click on it?

Again, I'm not an OO expert by any means, so if someone out there can
enlighten us further, I'd look forward to it. I just try to use business
(or more specifically end-user) goals to drive the design.

-Rich

-Original Message-
From: Pacella, Michael [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 26, 2003 11:37 AM
To: CF-Talk
Subject: CFC performance difficulties

Has anyone experienced slow downs when passing around several CFCs as
objects ?

Here's the problem we have run in to:

To encapsulate information about all of the Campuses in our database, a
CFC
was created to act sort of like a Java object representing campus
(complete
with properties such as campusName, campusCode, campusBeginDate,
campusContact, etc.. -- and settors and gettors to retrieve them)...

Another CFC was created to access the database, performing functionality
such as "search". Search would query the DB, and then step thru the
results,
creating Campus CFC objects for EACH campus returned. The end result of
the
function would be a Structure whose Keys were the CampusCode and whose
Value
were the actual, aforementioned Campus CFC object. 

Passing around over 100 of these CFC objects encapsulated in a Structure
causes a massive performance hitUsing GetTickCount(), it was
determined
that simply writing a query and looping through it took about 27
milliseconds. Whereas, creating this structure of Campus CFCs, looping
through that and having an actual OO programmatic concept took about 563
milliseconds.

That seems a little bit excessive. The question is, (1) am I
misconstruing
the power of CFCs (2) can/have they been implemented in a similar
fashion
(3) was it intended for several to be encapsulated in structures (which
old
Java guys might look at as Hashtables whose values are Objects)...

Any insight here would be extremely helpful -- Thanks !
<http://webforums.macromedia.com/coldfusion/messageview.cfm?catid=3&thre
adid
=643548> 
 


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Host with the leader in ColdFusion hosting. 
Voted #1 ColdFusion host by CF Developers. 
Offering shared and dedicated hosting options. 
www.cfxhosting.com/default.cfm?redirect=10481

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: CFC performance difficulties

2003-06-26 Thread Sean A Corfield
On Thursday, Jun 26, 2003, at 08:36 US/Pacific, Pacella, Michael wrote:
> Another CFC was created to access the database, performing  
> functionality
> such as "search". Search would query the DB, and then step thru the  
> results,
> creating Campus CFC objects for EACH campus returned. The end result  
> of the
> function would be a Structure whose Keys were the CampusCode and whose  
> Value
> were the actual, aforementioned Campus CFC object.

Reading a database and converting every row returned into an object is  
not likely to perform particularly well in any OO language. Object  
instantiation can be an expensive operation, depending on how you've  
coded your objects.

Mapping relational <-> OO like this is often a shock to folks who've  
never worked in OO, particularly if they perform a fairly naive (read:  
straightforward) mapping. There are ways to design encapsulation such  
that it doesn't create a huge performance overhead. A lot depends on  
how you are trying to use the objects.

Blake Stone gave a great talk at JavaOne about how to write faster  
code. He was talking about Java but some of his points relate to CFMX  
just as much, especially the one about deferring operations and  
performing lazy initialization. See some notes on my blog:

http://www.corfield.org/ 
index.php?fuseaction=blog.archive&month=2003_06#000398

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Host with the leader in ColdFusion hosting. 
Voted #1 ColdFusion host by CF Developers. 
Offering shared and dedicated hosting options. 
www.cfxhosting.com/default.cfm?redirect=10481

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



CFC performance difficulties

2003-06-26 Thread Pacella, Michael
Has anyone experienced slow downs when passing around several CFCs as
objects ?

Here's the problem we have run in to:

To encapsulate information about all of the Campuses in our database, a CFC
was created to act sort of like a Java object representing campus (complete
with properties such as campusName, campusCode, campusBeginDate,
campusContact, etc.. -- and settors and gettors to retrieve them)...

Another CFC was created to access the database, performing functionality
such as "search". Search would query the DB, and then step thru the results,
creating Campus CFC objects for EACH campus returned. The end result of the
function would be a Structure whose Keys were the CampusCode and whose Value
were the actual, aforementioned Campus CFC object. 

Passing around over 100 of these CFC objects encapsulated in a Structure
causes a massive performance hitUsing GetTickCount(), it was determined
that simply writing a query and looping through it took about 27
milliseconds. Whereas, creating this structure of Campus CFCs, looping
through that and having an actual OO programmatic concept took about 563
milliseconds.

That seems a little bit excessive. The question is, (1) am I misconstruing
the power of CFCs (2) can/have they been implemented in a similar fashion
(3) was it intended for several to be encapsulated in structures (which old
Java guys might look at as Hashtables whose values are Objects)...

Any insight here would be extremely helpful -- Thanks !
 
 

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Host with the leader in ColdFusion hosting. 
Voted #1 ColdFusion host by CF Developers. 
Offering shared and dedicated hosting options. 
www.cfxhosting.com/default.cfm?redirect=10481

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4