Re: Performance problem
Yes I agree, I increased the loop count to 5000 and noticed that the StringBuffer method ran 1/3 to 1/2 quicker than cfset a = a a bit more text, . However when I tried again with a loop count of 500 StringBuffer method was slower. my code: cfset jsbOutput = CreateObject( java, java.lang.StringBuffer ).Init() / cfloop index=i from=1 to=5000 cfset jsbOutput.Append( a bit more text, ) / /cfloop cfoutput li#jsbOutput.ToString()# /cfoutput cfset a = cfloop index=i from=1 to=5000 cfset a = a a bit more text, /cfloop cfoutput li#a# /cfoutput Andrew ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250376 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Performance problem
Gert Franz wrote: just change some text to something about 10 times larger and change the 500 to maybe 5000 and then you'll find out how fast string buffer is in comparison to CFMX strings... Neat. I just did 2,000,000 string appends of a 26 character string, resetting the string to empty every 1000 iterations, for a total string length of 52 megabytes (mebibytes?) Anyway, the old fashioned CFML took 89 seconds. The java string buffer method took only 28 seconds Here's the code: cfset a = cfset starttime = now() cfset cnt = 0 cfloop index=i from=1 to=200 cfset a = a This is some crazy stuff. cfset cnt = cnt + 26 cfif i mod 1000 is 0 !--- write to file and reset string to empty --- cfset a = /cfif /cfloop cfoutputpDone with #cnt# bytes in #abs(dateDiff('s',Now(),starttime))# seconds./p/cfoutput cfset a = createObject(java,java.lang.StringBuffer) cfset starttime = now() cfset cnt = 0 cfloop index=i from=1 to=200 cfset a.append(This is some crazy stuff. ) cfset cnt = cnt + 26 cfif i mod 1 is 0 !--- write to file and reset string to empty --- cfset a = createObject(java,java.lang.StringBuffer) /cfif /cfloop cfoutputpDone with #cnt# bytes in #abs(dateDiff('s',Now(),starttime))# seconds./p/cfoutput (I reset the string buffer every 1000 iterations because in the real world, I'd be writing out the file every so often rather than writing one giant file) Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250294 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Performance problem
You can easily eliminate the evaluate() as a factor by replacing cfset field = evaluate(resultSet.#ThisColumn#) with cfset field=resultSet[ThisColumn][resultSet.currentRow] but it doesn't look like you're executing that line enough times to account for the performance problem. Reed I have some code that dynamically generates CSV, TAB, and EXCEL (HTML tables) from a query, and it is running pretty slowly. A lot slower than I'd like it to. Essentially, I set a bunch of variables like START_PAGE, END_PAGE, START_ROW, END_ROW, START_FIELD, and END_FIELD that allow me to loop through the query and loop through the list of fields and output the data in the appropriate format. I added some debugging code and generating 124 rows took 19 seconds. Generating 1416 rows took 309 seconds. Which means if someone wants to generate a drop with 5,000 rows, it's gonna take a long freakin' time! It seems like it shouldn't be that slow. It's only writing every 100 rows to disk (the 124 record file was 445KB). And a couple of cflog statements indicate that the file write takes less than a second. Here's the query loop that outputs the rows of data. cfloop query=resultSet cfset fileOutput = fileOutput START_ROW cfloop list=#fields# index=ThisColumn cfset field = evaluate(resultSet.#ThisColumn#) cfif field eq and format eq EXCELcfset field=nbsp;/cfif cfset fileOutput = fileOutput START_FIELD cfif format eq CSV cfset fileOutput = fileOutput csvFormat(field) cfelse cfset fileOutput = fileOutput FIELD /cfif /cfloop cfset fileOutput = fileOutput END_ROW cfif currentRow MOD 100 is 0 cflog text=writing file #now()# cffile action=APPEND file=#application.udf.ROOT_DIR#\tools\entityLookup3\drops\#filename# output=#fileOutput# addnewline=No cflog text=done writing file #now()# cfset fileOutput = /cfif /cfloop I suspect that it's the Evaluate() that's running slowly. Any ideas on how to speed this code up? Thanks! Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250298 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Performance problem
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: You can easily eliminate the evaluate() as a factor by replacing cfset field = evaluate(resultSet.#ThisColumn#) with cfset field=resultSet[ThisColumn][resultSet.currentRow] but it doesn't look like you're executing that line enough times to account for the performance problem. Actually, for most people, it gets called for every field in every row. I just did a comparison, and your method works out about the same.. in one particular drop it did it in 50 seconds where the Evaluate() method did it in 45 seconds. I did solve most of my problem by: #1 - turning the task into an event gateway and having it run asynchronously #2 - using the java stringbuffer method to generate the drop file. Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250309 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Performance problem
scracth that, your method took 45 seconds, the evalute() method took 50 seconds. That was on a drop of about 2500 records. Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250310 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Performance problem
scracth that, your method took 45 seconds, the evalute() method took 50 seconds. The parania about evaluate is strictly a matter of philosophy. The impact on performance is only marginal. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250317 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Performance problem
I suspect that its your use of Append. Appending to a file means that everytime the file has to be opened, seeked to the end, and the new value appended. This is pretty slow if you to it a bunch of times. I suggest creating the string in memory and then writing it out to file. Russ -Original Message- From: Rick Root [mailto:[EMAIL PROTECTED] Sent: Thursday, August 17, 2006 11:03 AM To: CF-Talk Subject: Performance problem I have some code that dynamically generates CSV, TAB, and EXCEL (HTML tables) from a query, and it is running pretty slowly. A lot slower than I'd like it to. Essentially, I set a bunch of variables like START_PAGE, END_PAGE, START_ROW, END_ROW, START_FIELD, and END_FIELD that allow me to loop through the query and loop through the list of fields and output the data in the appropriate format. I added some debugging code and generating 124 rows took 19 seconds. Generating 1416 rows took 309 seconds. Which means if someone wants to generate a drop with 5,000 rows, it's gonna take a long freakin' time! It seems like it shouldn't be that slow. It's only writing every 100 rows to disk (the 124 record file was 445KB). And a couple of cflog statements indicate that the file write takes less than a second. Here's the query loop that outputs the rows of data. cfloop query=resultSet cfset fileOutput = fileOutput START_ROW cfloop list=#fields# index=ThisColumn cfset field = evaluate(resultSet.#ThisColumn#) cfif field eq and format eq EXCELcfset field=nbsp;/cfif cfset fileOutput = fileOutput START_FIELD cfif format eq CSV cfset fileOutput = fileOutput csvFormat(field) cfelse cfset fileOutput = fileOutput FIELD /cfif /cfloop cfset fileOutput = fileOutput END_ROW cfif currentRow MOD 100 is 0 cflog text=writing file #now()# cffile action=APPEND file=#application.udf.ROOT_DIR#\tools\entityLookup3\drops\#filename# output=#fileOutput# addnewline=No cflog text=done writing file #now()# cfset fileOutput = /cfif /cfloop I suspect that it's the Evaluate() that's running slowly. Any ideas on how to speed this code up? Thanks! Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250158 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Performance problem
When doing a lot of string concatenation, you should totally use the Java string buffer: cfset jsbOutput = CreateObject( java, java.lang.StringBuffer ).Init() / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cffile Output=#jsbOutput.ToString()# / To only does the concatentation once at the end via the ToString() method. This will make it blazing fast. This should replace anywhere you build the output for the file. ... Ben Nadel www.bennadel.com -Original Message- From: Rick Root [mailto:[EMAIL PROTECTED] Sent: Thursday, August 17, 2006 11:03 AM To: CF-Talk Subject: Performance problem I have some code that dynamically generates CSV, TAB, and EXCEL (HTML tables) from a query, and it is running pretty slowly. A lot slower than I'd like it to. Essentially, I set a bunch of variables like START_PAGE, END_PAGE, START_ROW, END_ROW, START_FIELD, and END_FIELD that allow me to loop through the query and loop through the list of fields and output the data in the appropriate format. I added some debugging code and generating 124 rows took 19 seconds. Generating 1416 rows took 309 seconds. Which means if someone wants to generate a drop with 5,000 rows, it's gonna take a long freakin' time! It seems like it shouldn't be that slow. It's only writing every 100 rows to disk (the 124 record file was 445KB). And a couple of cflog statements indicate that the file write takes less than a second. Here's the query loop that outputs the rows of data. cfloop query=resultSet cfset fileOutput = fileOutput START_ROW cfloop list=#fields# index=ThisColumn cfset field = evaluate(resultSet.#ThisColumn#) cfif field eq and format eq EXCELcfset field=nbsp;/cfif cfset fileOutput = fileOutput START_FIELD cfif format eq CSV cfset fileOutput = fileOutput csvFormat(field) cfelse cfset fileOutput = fileOutput FIELD /cfif /cfloop cfset fileOutput = fileOutput END_ROW cfif currentRow MOD 100 is 0 cflog text=writing file #now()# cffile action=APPEND file=#application.udf.ROOT_DIR#\tools\entityLookup3\drops\#filename# output=#fileOutput# addnewline=No cflog text=done writing file #now()# cfset fileOutput = /cfif /cfloop I suspect that it's the Evaluate() that's running slowly. Any ideas on how to speed this code up? Thanks! Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250169 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Performance problem
Well you're also building a string by repeatedly appending. This creates a new string every tiem, assuming cf doesn't optimize code like that into using stringbuffers. Also, do you want the 445 KB tyo be sitting in RAM only to write to some file? I think you should write some better-performing code using a java.io.PrintWriter and a java.io.FileOutputStream (make a temp file... Using java.io.File's createTempFile() if you want.. And cfcontent it into deletion...) Dov -Original Message- From: Rick Root [mailto:[EMAIL PROTECTED] Sent: Thursday, August 17, 2006 11:03 AM To: CF-Talk Subject: Performance problem I have some code that dynamically generates CSV, TAB, and EXCEL (HTML tables) from a query, and it is running pretty slowly. A lot slower than I'd like it to. Essentially, I set a bunch of variables like START_PAGE, END_PAGE, START_ROW, END_ROW, START_FIELD, and END_FIELD that allow me to loop through the query and loop through the list of fields and output the data in the appropriate format. I added some debugging code and generating 124 rows took 19 seconds. Generating 1416 rows took 309 seconds. Which means if someone wants to generate a drop with 5,000 rows, it's gonna take a long freakin' time! It seems like it shouldn't be that slow. It's only writing every 100 rows to disk (the 124 record file was 445KB). And a couple of cflog statements indicate that the file write takes less than a second. Here's the query loop that outputs the rows of data. cfloop query=resultSet cfset fileOutput = fileOutput START_ROW cfloop list=#fields# index=ThisColumn cfset field = evaluate(resultSet.#ThisColumn#) cfif field eq and format eq EXCELcfset field=nbsp;/cfif cfset fileOutput = fileOutput START_FIELD cfif format eq CSV cfset fileOutput = fileOutput csvFormat(field) cfelse cfset fileOutput = fileOutput FIELD /cfif /cfloop cfset fileOutput = fileOutput END_ROW cfif currentRow MOD 100 is 0 cflog text=writing file #now()# cffile action=APPEND file=#application.udf.ROOT_DIR#\tools\entityLookup3\drops\#filename# output=#fileOutput# addnewline=No cflog text=done writing file #now()# cfset fileOutput = /cfif /cfloop I suspect that it's the Evaluate() that's running slowly. Any ideas on how to speed this code up? Thanks! Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250165 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Performance problem
Back in June there was a thread called CFFILE Performance about this on the BlueDragon Interest mailing list that might be helpful to you, Rick. I know you're a subscriber and that you probably have those emails handy. But for those who don't, you can search the archives of the list here: http://www.newatlanta.com/c/products/bluedragon/self_help/archiveSearch/show Search Josh -Original Message- From: Rick Root [mailto:[EMAIL PROTECTED] Sent: Thursday, August 17, 2006 11:03 AM To: CF-Talk Subject: Performance problem I have some code that dynamically generates CSV, TAB, and EXCEL (HTML tables) from a query, and it is running pretty slowly. A lot slower than I'd like it to. Essentially, I set a bunch of variables like START_PAGE, END_PAGE, START_ROW, END_ROW, START_FIELD, and END_FIELD that allow me to loop through the query and loop through the list of fields and output the data in the appropriate format. I added some debugging code and generating 124 rows took 19 seconds. Generating 1416 rows took 309 seconds. Which means if someone wants to generate a drop with 5,000 rows, it's gonna take a long freakin' time! It seems like it shouldn't be that slow. It's only writing every 100 rows to disk (the 124 record file was 445KB). And a couple of cflog statements indicate that the file write takes less than a second. Here's the query loop that outputs the rows of data. cfloop query=resultSet cfset fileOutput = fileOutput START_ROW cfloop list=#fields# index=ThisColumn cfset field = evaluate(resultSet.#ThisColumn#) cfif field eq and format eq EXCELcfset field=nbsp;/cfif cfset fileOutput = fileOutput START_FIELD cfif format eq CSV cfset fileOutput = fileOutput csvFormat(field) cfelse cfset fileOutput = fileOutput FIELD /cfif /cfloop cfset fileOutput = fileOutput END_ROW cfif currentRow MOD 100 is 0 cflog text=writing file #now()# cffile action=APPEND file=#application.udf.ROOT_DIR#\tools\entityLookup3\drops\#filename# output=#fileOutput# addnewline=No cflog text=done writing file #now()# cfset fileOutput = /cfif /cfloop I suspect that it's the Evaluate() that's running slowly. Any ideas on how to speed this code up? Thanks! Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250178 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Performance problem
If for some reason the thought of resorting to Java scares you, (or you didn't know about Ben's solution) you could change the way you are concatenating. If you are doing loops within loops, you can you temporary string variables that you use only for the loop, then rejoin it to the larger string. I've seen a 10 minute process drop to 11 seconds after doing this in selected locations. You can use a combination of cfflush and . characters spread throughout your code to see the actual slowdown occur, then fix those sections. Terrence Ryan Senior Systems Programmer Wharton Computing and Information Technology E-mail: [EMAIL PROTECTED] -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, August 17, 2006 1:07 PM To: CF-Talk Subject: RE: Performance problem When doing a lot of string concatenation, you should totally use the Java string buffer: cfset jsbOutput = CreateObject( java, java.lang.StringBuffer ).Init() / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cffile Output=#jsbOutput.ToString()# / To only does the concatentation once at the end via the ToString() method. This will make it blazing fast. This should replace anywhere you build the output for the file. Ben Nadel www.bennadel.com -Original Message- From: Rick Root [mailto:[EMAIL PROTECTED] Sent: Thursday, August 17, 2006 11:03 AM To: CF-Talk Subject: Performance problem I have some code that dynamically generates CSV, TAB, and EXCEL (HTML tables) from a query, and it is running pretty slowly. A lot slower than I'd like it to. Essentially, I set a bunch of variables like START_PAGE, END_PAGE, START_ROW, END_ROW, START_FIELD, and END_FIELD that allow me to loop through the query and loop through the list of fields and output the data in the appropriate format. I added some debugging code and generating 124 rows took 19 seconds. Generating 1416 rows took 309 seconds. Which means if someone wants to generate a drop with 5,000 rows, it's gonna take a long freakin' time! It seems like it shouldn't be that slow. It's only writing every 100 rows to disk (the 124 record file was 445KB). And a couple of cflog statements indicate that the file write takes less than a second. Here's the query loop that outputs the rows of data. cfloop query=resultSet cfset fileOutput = fileOutput START_ROW cfloop list=#fields# index=ThisColumn cfset field = evaluate(resultSet.#ThisColumn#) cfif field eq and format eq EXCELcfset field=nbsp;/cfif cfset fileOutput = fileOutput START_FIELD cfif format eq CSV cfset fileOutput = fileOutput csvFormat(field) cfelse cfset fileOutput = fileOutput FIELD /cfif /cfloop cfset fileOutput = fileOutput END_ROW cfif currentRow MOD 100 is 0 cflog text=writing file #now()# cffile action=APPEND file=#application.udf.ROOT_DIR#\tools\entityLookup3\drops\#filename# output=#fileOutput# addnewline=No cflog text=done writing file #now()# cfset fileOutput = /cfif /cfloop I suspect that it's the Evaluate() that's running slowly. Any ideas on how to speed this code up? Thanks! Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250205 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Performance problem
Ben, when would you use java.lang.StringBuffer as compared to cfset a = cfloop index=i from=1 to=500 cfset a = a some text /cfloop I found the above method faster. Andrew. When doing a lot of string concatenation, you should totally use the Java string buffer: cfset jsbOutput = CreateObject( java, java.lang.StringBuffer ).Init() / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cfset jsbOutput.Append( some text ) / cffile Output=#jsbOutput.ToString()# / To only does the concatentation once at the end via the ToString() method. This will make it blazing fast. This should replace anywhere you build the output for the file. .. Ben Nadel www.bennadel.com ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250255 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Performance Problem - Client Variables
On 12/15/05, Cornillon, Matthieu (Consultant) [EMAIL PROTECTED] wrote: 1) In the CF Administrator, it seems that you set the client variable store for the *server* and not for the specific CF application. Is that correct? In other words, if I have two applications, named application_one and application_two in their Application.cfm CFAPPLICATION tags, but those applications sit on the same server, do all their client vars get put into the same datastore? If not, how (in the administrator module) does one set per-application settings? When you make your selection in the cf admin, this is for the DEFAULT client variable store. That is, if the cfapplication tag makes no specific mention of where the vars go via the cfapplication tag's clientstorage=foo parameter, then they go into the server-specified default. If you do specify a dsn other than the default, you have to make sure on your own that the CDATA and CGLOBAL tables are set up properly there to accept your data. 2) Is there a way that I can programmatically display client variable settings for the application? In other words, is there some variable like Application.ClientStorage that I can read and display? (I ask because of the above-mentioned fact that I cannot access the administrative module directly.) I don't believe so. Try a CFDUMP of the server scope and see if that nets you anything. I really doubt it will as that would be a nasty security hole. However, since you can specify your own client variable storage location via the cfapplication tag that means you can send data to the dsn of your choice and then use all CF tools to dump or output same as you please. 3) Does anyone have any experience with this sort of delay of constant length? Not personally, although it certainly sounds as if you have traced the problem correctly. If you had CF Admin access you could install SeeFusion and trace it down for sure. I recently put the Enterprise version on a client's server and its ability to log slow queries includes client var updates. A wonderful tool for performance tuning. -- --mattRobertson-- Janitor, MSB Web Systems mysecretbase.com ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227113 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Performance Problem - Client Variables
People seem to have no end of problems with client variables. One problem is they are a database hit on every request whether you use them or not. Another is that bots fill up your database and then weird things start happening (see my thread yesterday RSS looks ok but not ok). We found that cookie client vars were overflowing on one site so switched to db vars. The performance impact was surprisingly large given it was only one db hit. In the end, I wrote a CFC (which is initialised into a session var) that we use as a client var store instead. It simply reads and writes data to and from a database table, but it only does it as needed. Seems to work well. CFC pasted below if anybody's interested. -Original Message- From: Cornillon, Matthieu (Consultant) [mailto:[EMAIL PROTECTED] Sent: Friday, 16 December 2005 9:46 a.m. To: CF-Talk Subject: Performance Problem - Client Variables All, I am in the process of moving a CF site from one server to another. The new site is in CFMX7. I do not have access to the administrator settings, as I have to work through someone in another department on this. The problem is that I have ~8.5 seconds (+/- 0.2 seconds) delay on each page load. Not the slow load of dial-up, with pictures slowly appearing, but the delay and then a full instant load. This is true regardless of page content. I eventually ran a test where I took two identical pages, both blank HTML pages with no CF code and put them in an isolated directory where the Application.cfm had only the CFAPPLICATION tag. One page had the ...html extension, the other the .cfm extension. The former loaded instantly, the latter only after the delay. In another test, I tried setting clientmanagement to no, and the problem went away. So I am looking further there. Because I have no direct access to the Administrator page, I have to do my investigation remotely. I know that I am *supposed* to be storing the client variables in an Oracle datasource. This is how we currently do it, and it works fine. So, I am guessing that this is just a matter of a configuration problem there. While I am trying those things out, I am wondering whether any of you have any thoughts on the following questions: 1) In the CF Administrator, it seems that you set the client variable store for the *server* and not for the specific CF application. Is that correct? In other words, if I have two applications, named application_one and application_two in their Application.cfm CFAPPLICATION tags, but those applications sit on the same server, do all their client vars get put into the same datastore? If not, how (in the administrator module) does one set per-application settings? 2) Is there a way that I can programmatically display client variable settings for the application? In other words, is there some variable like Application.ClientStorage that I can read and display? (I ask because of the above-mentioned fact that I cannot access the administrative module directly.) 3) Does anyone have any experience with this sort of delay of constant length? Thanks a million, Matthieu ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227115 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Performance Problem - Client Variables
Ahem... cfcomponent output=No cffunction name=init returntype=client output=no cfargument name=datasource type=string required=yes cfargument name=clientId type=string required=yes cfset obj.datasource = arguments.datasource cfset obj.clientId = arguments.clientId !--- housekeeping --- cfquery datasource=#obj.datasource# DELETE FROMclientVariables WHERE created cfqueryparam value=#dateAdd(m, -3, now())# cfsqltype=CF_SQL_TIMESTAMP /cfquery cfreturn this /cffunction cffunction name=get returntype=string output=no cfargument name=name type=string required=yes cfset qry = cfquery name=qry datasource=#obj.datasource# SELECT val FROMclientVariables WHERE clientId = cfqueryparam value=#obj.clientId# cfsqltype=CF_SQL_VARCHAR AND name = cfqueryparam value=#lCase(arguments.name)# cfsqltype=CF_SQL_VARCHAR /cfquery cfreturn qry.val /cffunction cffunction name=set returntype=client output=no cfset var arg = cfset clear(structKeyList(arguments)) cfloop collection=#arguments# item=arg cfquery datasource=#obj.datasource# INSERT INTO clientVariables ( clientId, name, val, created ) VALUES ( cfqueryparam value=#obj.clientId# cfsqltype=CF_SQL_VARCHAR, cfqueryparam value=#lCase(arg)# cfsqltype=CF_SQL_VARCHAR, cfqueryparam value=#arguments[arg]# cfsqltype=CF_SQL_VARCHAR, cfqueryparam value=#now()# cfsqltype=CF_SQL_TIMESTAMP ) /cfquery /cfloop cfreturn this /cffunction cffunction name=clear returntype=client output=no cfargument name=names required=yes cfquery datasource=#obj.datasource# DELETE FROMclientVariables WHERE clientId = cfqueryparam value=#obj.clientId# cfsqltype=CF_SQL_VARCHAR AND name IN (cfqueryparam value=#lCase(arguments.names)# cfsqltype=CF_SQL_VARCHAR list=Yes) /cfquery cfreturn this /cffunction /cfcomponent -Original Message- From: Matthew Walker Sent: Friday, 16 December 2005 10:07 a.m. To: 'cf-talk@houseoffusion.com' Subject: RE: Performance Problem - Client Variables People seem to have no end of problems with client variables. One problem is they are a database hit on every request whether you use them or not. Another is that bots fill up your database and then weird things start happening (see my thread yesterday RSS looks ok but not ok). We found that cookie client vars were overflowing on one site so switched to db vars. The performance impact was surprisingly large given it was only one db hit. In the end, I wrote a CFC (which is initialised into a session var) that we use as a client var store instead. It simply reads and writes data to and from a database table, but it only does it as needed. Seems to work well. CFC pasted below if anybody's interested. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227116 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Performance Problem - Client Variables
All, Thanks for your input on the client variable problem I mentioned. Turns out that the problem was that the client variable store table (in an ODBC datasource) was not indexed properly. Never would have tracked that down if you all hadn't given me the hints that you did. Major problem averted. Thanks once again for your help! Matthieu ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227127 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54