Re: CF (8.0.0) performance vs PHP (5)
I ran a variant of John's code using the rand function for the string length and got fairly similar results as before. It may well depend on the size and number of the strings, since the main inefficiencies can be piling up of immutable strings and subsequent GC. And like they say, there's lies, damn lies, and statistics... d ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339097 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Yes, cfsavecontent appears to use a java buffer internally, and runs just about as fast. Pick whichever method gives you code you like better with your content, its source, and your coding style. Dave Its actually faster according to the tests I've seen. Both ArrayAppend and cfsaveContent came out the fastest in John Whish's testing on CF8 (see http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/string-concatenation-performance-test-128). In most cases both of these were faster than StringBuilder or StringBuffer. concatenate with coldfusion : 6797ms listappend with coldfusion : 21344ms arrayappend with coldfusion : 47ms coldfusion with save content: 47ms concatenate with java stringbuffer : 62ms concatenate with java StringBuilder : 63ms Some time or other I'll have to try John's test case under load with jMeter and see what the performance is actually like. regards, larry ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338986 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
It may well depend on the size and number of the strings, since the main inefficiencies can be piling up of immutable strings and subsequent GC. And like they say, there's lies, damn lies, and statistics... d On Tue, Nov 9, 2010 at 10:10 AM, Larry Lyons larrycly...@gmail.com wrote: Yes, cfsavecontent appears to use a java buffer internally, and runs just about as fast. Pick whichever method gives you code you like better with your content, its source, and your coding style. Dave Its actually faster according to the tests I've seen. Both ArrayAppend and cfsaveContent came out the fastest in John Whish's testing on CF8 (see http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/string-concatenation-performance-test-128). In most cases both of these were faster than StringBuilder or StringBuffer. concatenate with coldfusion : 6797ms listappend with coldfusion : 21344ms arrayappend with coldfusion : 47ms coldfusion with save content: 47ms concatenate with java stringbuffer : 62ms concatenate with java StringBuilder : 63ms Some time or other I'll have to try John's test case under load with jMeter and see what the performance is actually like. regards, larry ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339066 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Yes, cfsavecontent appears to use a java buffer internally, and runs just about as fast. Pick whichever method gives you code you like better with your content, its source, and your coding style. Dave On Sat, Nov 6, 2010 at 9:22 PM, Larry Lyons larrycly...@gmail.com wrote: +1,000,000 for Jame's theory about string concatenation. CF is very inefficient at this. Doesn't amtter much for small stuff and a few repeats, but for bulk, a Java buffer is the way to go. Dave String concatenation is quite slow in CF. This blog did some fairly simple tests and found that cfsavecontent was the fastest was to do string concatendation, see http://blog.fi.net.au/?p=279 I've run run similar tests using a more robust testing procedure and found similar results, (see http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/string-concatenation-performance-test-128) Basically cfsavecontent is on the average twice as fast as the java string buffer. What I'd suggest is do not write the file line by line but build up the string using cfsavecontent then write the string to disk. I think you'll find that that is about as fast as the PHP method, or nearly so. regards, larry -- Larry C. Lyons web: http://www.lyonsmorris.com/lyons LinkedIn: http://www.linkedin.com/in/larryclyons -- People need to realize that the plural of anecdote is not data. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338921 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Unless you're testing this under a significant load, such as using jMeter etc., this test is essentially meaningless. Loops over thousands or simple page loads do not mean anything. I'd look at a more real world test, make sure the HTML is exactly the same, structure the code to be similar etc. Moreover what was the code you used. Until we see it for all we know its a very biased test towards PHP, CF or HTML. For giggles, I just tried this on my box and got: HTML 33 milliseconds (static DataTime stamp and no queries to DB) CF 2910 milliseconds (cleared template cache and newly restarted CF service) CF 707 milliseconds (after above run) And here's the code I tested. NOTE: only needed two cfdumps to get to 50K page size: cfset count = 10 cfoutput#Now()#/cfoutput cfquery name=Q_GetData datasource=thedatasource select top #count# * from table1 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table2 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table3 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table4 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table5 /cfquery ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338927 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Moreover what was the code you used. Until we see it for all we know its a very biased test towards PHP, CF or HTML. CF code I used was included in my post. HTML was rendered CF - view source - save as HTML. I don't do PHP. On Sun, Nov 7, 2010 at 11:09 AM, Larry Lyons larrycly...@gmail.com wrote: Unless you're testing this under a significant load, such as using jMeter etc., this test is essentially meaningless. Loops over thousands or simple page loads do not mean anything. I'd look at a more real world test, make sure the HTML is exactly the same, structure the code to be similar etc. Moreover what was the code you used. Until we see it for all we know its a very biased test towards PHP, CF or HTML. For giggles, I just tried this on my box and got: HTML 33 milliseconds (static DataTime stamp and no queries to DB) CF 2910 milliseconds (cleared template cache and newly restarted CF service) CF 707 milliseconds (after above run) And here's the code I tested. NOTE: only needed two cfdumps to get to 50K page size: cfset count = 10 cfoutput#Now()#/cfoutput cfquery name=Q_GetData datasource=thedatasource select top #count# * from table1 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table2 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table3 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table4 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table5 /cfquery ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338928 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: CF (8.0.0) performance vs PHP (5)
John, Hey keep in mind that cfdump is a debug/development tag. It's not designed to perform at all under load. Under the hood I suspect it uses java reflection classes. -mark Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: John M Bliss [mailto:bliss.j...@gmail.com] Sent: Sunday, November 07, 2010 11:41 AM To: cf-talk Subject: Re: CF (8.0.0) performance vs PHP (5) Moreover what was the code you used. Until we see it for all we know its a very biased test towards PHP, CF or HTML. CF code I used was included in my post. HTML was rendered CF - view source - save as HTML. I don't do PHP. On Sun, Nov 7, 2010 at 11:09 AM, Larry Lyons larrycly...@gmail.com wrote: Unless you're testing this under a significant load, such as using jMeter etc., this test is essentially meaningless. Loops over thousands or simple page loads do not mean anything. I'd look at a more real world test, make sure the HTML is exactly the same, structure the code to be similar etc. Moreover what was the code you used. Until we see it for all we know its a very biased test towards PHP, CF or HTML. For giggles, I just tried this on my box and got: HTML 33 milliseconds (static DataTime stamp and no queries to DB) CF 2910 milliseconds (cleared template cache and newly restarted CF service) CF 707 milliseconds (after above run) And here's the code I tested. NOTE: only needed two cfdumps to get to 50K page size: cfset count = 10 cfoutput#Now()#/cfoutput cfquery name=Q_GetData datasource=thedatasource select top #count# * from table1 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table2 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table3 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table4 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table5 /cfquery ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338929 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: CF (8.0.0) performance vs PHP (5)
It must do as it requires createObject(java) to be enabled and the java class loader. Russ -Original Message- From: Mark A. Kruger [mailto:mkru...@cfwebtools.com] Sent: 07 November 2010 21:46 To: cf-talk Subject: RE: CF (8.0.0) performance vs PHP (5) John, Hey keep in mind that cfdump is a debug/development tag. It's not designed to perform at all under load. Under the hood I suspect it uses java reflection classes. -mark Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: John M Bliss [mailto:bliss.j...@gmail.com] Sent: Sunday, November 07, 2010 11:41 AM To: cf-talk Subject: Re: CF (8.0.0) performance vs PHP (5) Moreover what was the code you used. Until we see it for all we know its a very biased test towards PHP, CF or HTML. CF code I used was included in my post. HTML was rendered CF - view source - save as HTML. I don't do PHP. On Sun, Nov 7, 2010 at 11:09 AM, Larry Lyons larrycly...@gmail.com wrote: Unless you're testing this under a significant load, such as using jMeter etc., this test is essentially meaningless. Loops over thousands or simple page loads do not mean anything. I'd look at a more real world test, make sure the HTML is exactly the same, structure the code to be similar etc. Moreover what was the code you used. Until we see it for all we know its a very biased test towards PHP, CF or HTML. For giggles, I just tried this on my box and got: HTML 33 milliseconds (static DataTime stamp and no queries to DB) CF 2910 milliseconds (cleared template cache and newly restarted CF service) CF 707 milliseconds (after above run) And here's the code I tested. NOTE: only needed two cfdumps to get to 50K page size: cfset count = 10 cfoutput#Now()#/cfoutput cfquery name=Q_GetData datasource=thedatasource select top #count# * from table1 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table2 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table3 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table4 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table5 /cfquery ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338930 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: CF (8.0.0) performance vs PHP (5)
Right on... Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Russ Michaels [mailto:r...@michaels.me.uk] Sent: Sunday, November 07, 2010 3:53 PM To: cf-talk Subject: RE: CF (8.0.0) performance vs PHP (5) It must do as it requires createObject(java) to be enabled and the java class loader. Russ -Original Message- From: Mark A. Kruger [mailto:mkru...@cfwebtools.com] Sent: 07 November 2010 21:46 To: cf-talk Subject: RE: CF (8.0.0) performance vs PHP (5) John, Hey keep in mind that cfdump is a debug/development tag. It's not designed to perform at all under load. Under the hood I suspect it uses java reflection classes. -mark Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: John M Bliss [mailto:bliss.j...@gmail.com] Sent: Sunday, November 07, 2010 11:41 AM To: cf-talk Subject: Re: CF (8.0.0) performance vs PHP (5) Moreover what was the code you used. Until we see it for all we know its a very biased test towards PHP, CF or HTML. CF code I used was included in my post. HTML was rendered CF - view source - save as HTML. I don't do PHP. On Sun, Nov 7, 2010 at 11:09 AM, Larry Lyons larrycly...@gmail.com wrote: Unless you're testing this under a significant load, such as using jMeter etc., this test is essentially meaningless. Loops over thousands or simple page loads do not mean anything. I'd look at a more real world test, make sure the HTML is exactly the same, structure the code to be similar etc. Moreover what was the code you used. Until we see it for all we know its a very biased test towards PHP, CF or HTML. For giggles, I just tried this on my box and got: HTML 33 milliseconds (static DataTime stamp and no queries to DB) CF 2910 milliseconds (cleared template cache and newly restarted CF service) CF 707 milliseconds (after above run) And here's the code I tested. NOTE: only needed two cfdumps to get to 50K page size: cfset count = 10 cfoutput#Now()#/cfoutput cfquery name=Q_GetData datasource=thedatasource select top #count# * from table1 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table2 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table3 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table4 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table5 /cfquery ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338931 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
+1,000,000 for Jame's theory about string concatenation. CF is very inefficient at this. Doesn't amtter much for small stuff and a few repeats, but for bulk, a Java buffer is the way to go. Dave String concatenation is quite slow in CF. This blog did some fairly simple tests and found that cfsavecontent was the fastest was to do string concatendation, see http://blog.fi.net.au/?p=279 I've run run similar tests using a more robust testing procedure and found similar results, (see http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/string-concatenation-performance-test-128) Basically cfsavecontent is on the average twice as fast as the java string buffer. What I'd suggest is do not write the file line by line but build up the string using cfsavecontent then write the string to disk. I think you'll find that that is about as fast as the PHP method, or nearly so. regards, larry -- Larry C. Lyons web: http://www.lyonsmorris.com/lyons LinkedIn: http://www.linkedin.com/in/larryclyons -- People need to realize that the plural of anecdote is not data. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338916 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: CF (8.0.0) performance vs PHP (5)
I think the cfexecute tag is definitely not the faster cf tag ever. As an ex php programmer and a current ColdFusion programmer I do have to say that there is usually a speed benefit to php over ColdFusion however, I do have to say that I think the overall benefits to ColdFusion far outweigh the cons to ColdFusion over php. I personally have had very, very few server or speed issues on my ecommerce site, which receives over a million page views a month. Check out my article about php vs ColdFusion. http://paulalkema.com/post.cfm/php-vs-coldfusion Paul Alkema ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338871 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Well, I agree with David... giving PHP a try after using CF for around 8 years, I have found PHP to be much faster on an average setup hardware. Having said that, Wil, I do realise your point, can you please guide us to some resource where we can learn performance tuning of CF specially on the JVM level? I stopped using ACF for this reason because it was just too resource intensive for my development machine, then I shifted to Railo which I found much better in speed and now PHP which is amazingly fast on the same machine. Regards, Arsalan -- From: Wil Genovese jugg...@trunkful.com Sent: Wednesday, October 20, 2010 2:06 AM To: cf-talk cf-talk@houseoffusion.com Subject: Re: CF (8.0.0) performance vs PHP (5) Again this means nothing. I've worked on very high load high performance ColdFusion based web applications that literally served up 2.5 to 3 million user requests per day and each request took less than 350ms on average. It comes down to performance tuning at all layers. The out-of-the-box install of ColdFusion is not tuned for performance. It's tuned to just run and let you get started. Wil Genovese Sr. Web Application Developer/ Systems Administrator wilg...@trunkful.com www.trunkful.com On Oct 19, 2010, at 4:01 PM, John M Bliss wrote: For giggles, I just tried this on my box and got: HTML 33 milliseconds (static DataTime stamp and no queries to DB) CF 2910 milliseconds (cleared template cache and newly restarted CF service) CF 707 milliseconds (after above run) And here's the code I tested. NOTE: only needed two cfdumps to get to 50K page size: cfset count = 10 cfoutput#Now()#/cfoutput cfquery name=Q_GetData datasource=thedatasource select top #count# * from table1 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table2 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table3 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table4 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table5 /cfquery On Tue, Oct 19, 2010 at 3:29 PM, Ketan Jetty kje...@yahoo.com wrote: This can lead to lots of controvertial posts. I did some performance testing long back between HTML, CF, PHP, ASP.NET and Java. The benchmark was a static HTML page and everything was measured against the performance of HTML. Criteria used in the benchmarking was to generate a datetime stamp, results from 5 queries to DB and a 50K page size The performance results matrix is given below: HTML 100% (static DataTime stamp and no queries to DB) PHP90% of HTML ASP.NET80% of HTML JAVA 75% of HTML CF 40% of HTML [but I can say that CF is slowly improving] These are my findings and may change from time to time. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338351 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
On Tue, Oct 19, 2010 at 10:51 PM, Bryan Stevenson wrote: Respectfully Ketanyour tests have nothing to do with the string concatenation performance issue that was the crux of this thread ;-) I very much doubt the performance issue discussed here has anything to do with string concatenation. cffile action='append'... appends code to the file on the file system. That means it waits until the data hits the disks. If you pull the plug after 10K lines, you will have a file with 10K lines on the filesystem when it comes back up. With a 15K RPM disk the rotational latency alone limits you to 250 operations per second. So 20K lines takes about 80 seconds. (If you test this you will frequently see higher performance numbers which is due to write caching not in the OS but on the disk. SAS disks typically allow you to disable that.) cfset this.FileObject.write(arguments.fileData,0, len(arguments.fileData)) doesn't write to disk, it writes to a JVM buffer. Only the final FileObject.flush() writes the buffer to disk. If you pull the plug after 10K lines, you will have a file with 0 lines on the filesystem when it comes back up. That your PHP code runs in about 8 seconds simply means it does string concatenation in memory followed by one write as well. Either explicitly in a PHP memory variable or implicitly by not doing a real fsync after writing to the filesystem. Jochem -- Jochem van Dieten http://jochem.vandieten.net/ ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338352 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Each server setup is unique and needs to be tuned for it's purpose, applications running and hardware. I have a couple of JVM Tuning posts on my blog that serve as a guide but not meant as an exact this is how you do it. http://www.trunkful.com/index.cfm/JVM-Tuning The Adobe website has detailed posts on the exact science of tuning the JVM for your specific server and application(s). Tuning your application, server, JVM, database and network are all part of building a high performance high availability setup. Each is unique and it's really something that should be done no matter which web application layer you choose. Wil Genovese Sr. Web Application Developer/ Systems Administrator wilg...@trunkful.com www.trunkful.com On Oct 20, 2010, at 1:17 AM, Arsalan Tariq Keen wrote: Well, I agree with David... giving PHP a try after using CF for around 8 years, I have found PHP to be much faster on an average setup hardware. Having said that, Wil, I do realise your point, can you please guide us to some resource where we can learn performance tuning of CF specially on the JVM level? I stopped using ACF for this reason because it was just too resource intensive for my development machine, then I shifted to Railo which I found much better in speed and now PHP which is amazingly fast on the same machine. Regards, Arsalan -- From: Wil Genovese jugg...@trunkful.com Sent: Wednesday, October 20, 2010 2:06 AM To: cf-talk cf-talk@houseoffusion.com Subject: Re: CF (8.0.0) performance vs PHP (5) Again this means nothing. I've worked on very high load high performance ColdFusion based web applications that literally served up 2.5 to 3 million user requests per day and each request took less than 350ms on average. It comes down to performance tuning at all layers. The out-of-the-box install of ColdFusion is not tuned for performance. It's tuned to just run and let you get started. Wil Genovese Sr. Web Application Developer/ Systems Administrator wilg...@trunkful.com www.trunkful.com On Oct 19, 2010, at 4:01 PM, John M Bliss wrote: For giggles, I just tried this on my box and got: HTML 33 milliseconds (static DataTime stamp and no queries to DB) CF 2910 milliseconds (cleared template cache and newly restarted CF service) CF 707 milliseconds (after above run) And here's the code I tested. NOTE: only needed two cfdumps to get to 50K page size: cfset count = 10 cfoutput#Now()#/cfoutput cfquery name=Q_GetData datasource=thedatasource select top #count# * from table1 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table2 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table3 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table4 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table5 /cfquery On Tue, Oct 19, 2010 at 3:29 PM, Ketan Jetty kje...@yahoo.com wrote: This can lead to lots of controvertial posts. I did some performance testing long back between HTML, CF, PHP, ASP.NET and Java. The benchmark was a static HTML page and everything was measured against the performance of HTML. Criteria used in the benchmarking was to generate a datetime stamp, results from 5 queries to DB and a 50K page size The performance results matrix is given below: HTML 100% (static DataTime stamp and no queries to DB) PHP90% of HTML ASP.NET80% of HTML JAVA 75% of HTML CF 40% of HTML [but I can say that CF is slowly improving] These are my findings and may change from time to time. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338353 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Whatever Jochemyou get the pointa simple page load test with some queries etc. has nothing to do with the threadit was a SPECIFIC performance issue. I bow down to your superior knowledge and use of semantics ;-) Cheers On Wed, 2010-10-20 at 09:56 +0200, Jochem van Dieten wrote: On Tue, Oct 19, 2010 at 10:51 PM, Bryan Stevenson wrote: Respectfully Ketanyour tests have nothing to do with the string concatenation performance issue that was the crux of this thread ;-) I very much doubt the performance issue discussed here has anything to do with string concatenation. cffile action='append'... appends code to the file on the file system. That means it waits until the data hits the disks. If you pull the plug after 10K lines, you will have a file with 10K lines on the filesystem when it comes back up. With a 15K RPM disk the rotational latency alone limits you to 250 operations per second. So 20K lines takes about 80 seconds. (If you test this you will frequently see higher performance numbers which is due to write caching not in the OS but on the disk. SAS disks typically allow you to disable that.) cfset this.FileObject.write(arguments.fileData,0, len(arguments.fileData)) doesn't write to disk, it writes to a JVM buffer. Only the final FileObject.flush() writes the buffer to disk. If you pull the plug after 10K lines, you will have a file with 0 lines on the filesystem when it comes back up. That your PHP code runs in about 8 seconds simply means it does string concatenation in memory followed by one write as well. Either explicitly in a PHP memory variable or implicitly by not doing a real fsync after writing to the filesystem. Jochem Bryan Stevenson B.Comm. VP Director of E-Commerce Development Electric Edge Systems Group Inc. phone: 250.480.0642 fax: 250.480.1264 cell: 250.920.8830 e-mail: br...@electricedgesystems.com web: www.electricedgesystems.com Notice: This message, including any attachments, is confidential and may contain information that is privileged or exempt from disclosure. It is intended only for the person to whom it is addressed unless expressly authorized otherwise by the sender. If you are not an authorized recipient, please notify the sender immediately and permanently destroy all copies of this message and attachments. Please consider the environment before printing this e-mail ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338369 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
This can lead to lots of controvertial posts. I did some performance testing long back between HTML, CF, PHP, ASP.NET and Java. The benchmark was a static HTML page and everything was measured against the performance of HTML. Criteria used in the benchmarking was to generate a datetime stamp, results from 5 queries to DB and a 50K page size The performance results matrix is given below: HTML 100% (static DataTime stamp and no queries to DB) PHP90% of HTML ASP.NET80% of HTML JAVA 75% of HTML CF 40% of HTML [but I can say that CF is slowly improving] These are my findings and may change from time to time. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338338 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
This means nothing to me without proper test procedures and full disclosure of the source code and test data for each test and the hardware specifications that were used along with databases and network specs. There's a large number of variables involved and I can attest to the fact that getting even one wrong can adversely affect a test environment. Externals such as networks, file systems, operating systems, performance tuning, the java layer, databases and more can have very large affects on the results for each of the languages you tested. Wil Genovese Sr. Web Application Developer/ Systems Administrator wilg...@trunkful.com www.trunkful.com On Oct 19, 2010, at 3:29 PM, Ketan Jetty wrote: This can lead to lots of controvertial posts. I did some performance testing long back between HTML, CF, PHP, ASP.NET and Java. The benchmark was a static HTML page and everything was measured against the performance of HTML. Criteria used in the benchmarking was to generate a datetime stamp, results from 5 queries to DB and a 50K page size The performance results matrix is given below: HTML 100% (static DataTime stamp and no queries to DB) PHP90% of HTML ASP.NET80% of HTML JAVA 75% of HTML CF 40% of HTML [but I can say that CF is slowly improving] These are my findings and may change from time to time. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338339 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Although I tend to agree with you Will, as a 12 year vet developing CF and for the past 3 years mixing in some PHP, PHP is just simply faster on an average setup every day need basis. I still use CF, and love it, but it's not as fast as PHP. Regards, David McGraw Oyova Software, LLC http://www.oyova.com On Tue, Oct 19, 2010 at 4:46 PM, Wil Genovese jugg...@trunkful.com wrote: This means nothing to me without proper test procedures and full disclosure of the source code and test data for each test and the hardware specifications that were used along with databases and network specs. There's a large number of variables involved and I can attest to the fact that getting even one wrong can adversely affect a test environment. Externals such as networks, file systems, operating systems, performance tuning, the java layer, databases and more can have very large affects on the results for each of the languages you tested. Wil Genovese Sr. Web Application Developer/ Systems Administrator wilg...@trunkful.com www.trunkful.com On Oct 19, 2010, at 3:29 PM, Ketan Jetty wrote: This can lead to lots of controvertial posts. I did some performance testing long back between HTML, CF, PHP, ASP.NET and Java. The benchmark was a static HTML page and everything was measured against the performance of HTML. Criteria used in the benchmarking was to generate a datetime stamp, results from 5 queries to DB and a 50K page size The performance results matrix is given below: HTML 100% (static DataTime stamp and no queries to DB) PHP90% of HTML ASP.NET80% of HTML JAVA 75% of HTML CF 40% of HTML [but I can say that CF is slowly improving] These are my findings and may change from time to time. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338340 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Respectfully Ketanyour tests have nothing to do with the string concatenation performance issue that was the crux of this thread ;-) Cheers On Tue, 2010-10-19 at 16:29 -0400, Ketan Jetty wrote: This can lead to lots of controvertial posts. I did some performance testing long back between HTML, CF, PHP, ASP.NET and Java. The benchmark was a static HTML page and everything was measured against the performance of HTML. Criteria used in the benchmarking was to generate a datetime stamp, results from 5 queries to DB and a 50K page size The performance results matrix is given below: HTML 100% (static DataTime stamp and no queries to DB) PHP90% of HTML ASP.NET80% of HTML JAVA 75% of HTML CF 40% of HTML [but I can say that CF is slowly improving] These are my findings and may change from time to time. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338341 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
For giggles, I just tried this on my box and got: HTML 33 milliseconds (static DataTime stamp and no queries to DB) CF 2910 milliseconds (cleared template cache and newly restarted CF service) CF 707 milliseconds (after above run) And here's the code I tested. NOTE: only needed two cfdumps to get to 50K page size: cfset count = 10 cfoutput#Now()#/cfoutput cfquery name=Q_GetData datasource=thedatasource select top #count# * from table1 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table2 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table3 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table4 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table5 /cfquery On Tue, Oct 19, 2010 at 3:29 PM, Ketan Jetty kje...@yahoo.com wrote: This can lead to lots of controvertial posts. I did some performance testing long back between HTML, CF, PHP, ASP.NET and Java. The benchmark was a static HTML page and everything was measured against the performance of HTML. Criteria used in the benchmarking was to generate a datetime stamp, results from 5 queries to DB and a 50K page size The performance results matrix is given below: HTML 100% (static DataTime stamp and no queries to DB) PHP90% of HTML ASP.NET80% of HTML JAVA 75% of HTML CF 40% of HTML [but I can say that CF is slowly improving] These are my findings and may change from time to time. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338342 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Again this means nothing. I've worked on very high load high performance ColdFusion based web applications that literally served up 2.5 to 3 million user requests per day and each request took less than 350ms on average. It comes down to performance tuning at all layers. The out-of-the-box install of ColdFusion is not tuned for performance. It's tuned to just run and let you get started. Wil Genovese Sr. Web Application Developer/ Systems Administrator wilg...@trunkful.com www.trunkful.com On Oct 19, 2010, at 4:01 PM, John M Bliss wrote: For giggles, I just tried this on my box and got: HTML 33 milliseconds (static DataTime stamp and no queries to DB) CF 2910 milliseconds (cleared template cache and newly restarted CF service) CF 707 milliseconds (after above run) And here's the code I tested. NOTE: only needed two cfdumps to get to 50K page size: cfset count = 10 cfoutput#Now()#/cfoutput cfquery name=Q_GetData datasource=thedatasource select top #count# * from table1 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table2 /cfquery cfdump var=#Q_GetData# cfquery name=Q_GetData datasource=thedatasource select top #count# * from table3 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table4 /cfquery cfquery name=Q_GetData datasource=thedatasource select top #count# * from table5 /cfquery On Tue, Oct 19, 2010 at 3:29 PM, Ketan Jetty kje...@yahoo.com wrote: This can lead to lots of controvertial posts. I did some performance testing long back between HTML, CF, PHP, ASP.NET and Java. The benchmark was a static HTML page and everything was measured against the performance of HTML. Criteria used in the benchmarking was to generate a datetime stamp, results from 5 queries to DB and a 50K page size The performance results matrix is given below: HTML 100% (static DataTime stamp and no queries to DB) PHP90% of HTML ASP.NET80% of HTML JAVA 75% of HTML CF 40% of HTML [but I can say that CF is slowly improving] These are my findings and may change from time to time. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338344 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
On Mon, Oct 18, 2010 at 5:14 AM, Bryn Parrott wrote: When I code this algorithm and execute in PHP 5 it runs in 7 seconds (give or take); When I code and excecute it in CF 8.0.0, it runs in around 74 seconds. Sonme might suggest this is difficult since I have deliberately not posted the code; Indeed. So I'll be just as obscure and limit myself to the words fake fsync in PHP and wait for the code. Jochem -- Jochem van Dieten http://jochem.vandieten.net/ ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338276 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
+1,000,000 for Jame's theory about string concatenation. CF is very inefficient at this. Doesn't amtter much for small stuff and a few repeats, but for bulk, a Java buffer is the way to go. Dave On Mon, Oct 18, 2010 at 4:04 AM, Jochem van Dieten joch...@gmail.com wrote: On Mon, Oct 18, 2010 at 5:14 AM, Bryn Parrott wrote: When I code this algorithm and execute in PHP 5 it runs in 7 seconds (give or take); When I code and excecute it in CF 8.0.0, it runs in around 74 seconds. Sonme might suggest this is difficult since I have deliberately not posted the code; Indeed. So I'll be just as obscure and limit myself to the words fake fsync in PHP and wait for the code. Jochem -- Jochem van Dieten http://jochem.vandieten.net/ ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338279 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
+1,000,000 for Jame's theory about string concatenation. CF is very inefficient at this. Doesn't matter much for small stuff and a few repeats, but for bulk, a Java buffer is the way to go. Thanks to all those that ventured suggestions ... There is a hint above - Java Buffer at what the eventual solution turned out to be. By the way what the code was doing was to assemble a string out of from constant strings and dynamic data from queries and then writing that out to a file using cffile. I replaced calls to cffile with calls to java.io.FileWriter and performamce improved on the benchmark data from 74 seconds to 8 seconds. Pretty much a smoking gun pointed at cffile I would say. The string concanenation inherent in my code is still there as it must be to perform the function I need. ...Cheers... ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338311 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
+1,000,000 for Jame's theory about string concatenation. CF is very inefficient at this. Doesn't matter much for small stuff and a few repeats, but for bulk, a Java buffer is the way to go. Thanks to all those that ventured suggestions ... There is a hint above - Java Buffer at what the eventual solution turned out to be. By the way what the code was doing was to assemble a string out of from constant strings and dynamic data from queries and then writing that out to a file using lt;cffilegt;. I replaced calls to cffile with calls to java.io.FileWriter and performamce improved on the benchmark data from 74 seconds to 8 seconds. Pretty much a smoking in the hand of lt;cffilegt;. I would say. The string concanenation inherent in my code is still there as it must be to perform the function I need. ...Cheers... ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338312 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
You still didn't answer the question. What is the version number of the JVM being used? This is very important. Anything less than 1.6. 0_10 is going to have performance issues. Hi Wil, In regards the JVM version, the original version I saw was 1.6.0_17. I changed it to use the Adobe distribution version for CF 8.0.0, which got me 1.6.0_01 and that had a 3 second better performance than the original, on the original code that utilised cffile. Now on that same 1.6.0_01 JVM version, with calls to java.io.filewriter replacing those to cffile, I get run times of 8 seconds (10x faster). Finally, I change the JVM version back to 1.6.0_17 and I get a run time of 12 seconds. So I conclude that unexpectedly, the older version of JVM is faster doing file io than the newer version, and of course java.io.Filewriter is faster than cffile go figure...! Unfortunately I am unable to spend further time on this, but again, thanks for your involvement and contribution. I will post the cfc encapsulating the calls to java.io.filewriter under separate cover for those that want it. Nothing special but might save someone some time. Cheers, Bryn ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338313 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
For those to whom it might be useful, here is the wrapper cfc I used for java.io.FileWriter which, in the application I was concerned with, attained a 10x performance improvement over cffile action='append'... under condition that over 20,000 lines needed to be written out to a text file. It aint nuthin special, but might save someone a few minutes... cfcomponent displayname=javaFile output=true cffunction name=initFile returntype=boolean access=remote output=Yes cfargument name=filename type=string required=yes cfset var retValue=false cfif not(fileexists(arguments.filename)) cffile action=write file=#arguments.filename# output= /cfif cfset this.FileObject = createobject(java, java.io.FileWriter).init(arguments.filename, true) cfset retValue=true cfreturn retValue /cffunction cffunction name=appendRaw returntype=boolean access=remote output=yes cfargument name=fileData type=string required=yes cfset var retValue=false cfset this.FileObject.write(arguments.fileData,0, len(arguments.fileData)) cfset retValue=true cfreturn retValue /cffunction cffunction name=appendLine returntype=boolean access=remote output=yes cfargument name=fileData type=string required=yes cfset var retValue=false cfset var CrLf = chr(13) chr(10) cfset var opbuffer=arguments.filedata CrLf cfset this.FileObject.write(opbuffer,0,len(opbuffer)) cfset retValue=true cfreturn retValue /cffunction cffunction name=done returntype=void access=remote output=yes cfset this.FileObject.flush() cfset this.FileObject.close() cfreturn /cffunction /cfcomponent ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338314 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Thanx for sharing! One for the utility belt, I am sure I will be putting this to use at one point or another. Every little bit helps you know, G! On Mon, Oct 18, 2010 at 9:50 PM, Bryn Parrott bryn_parr...@internode.on.net wrote: For those to whom it might be useful, here is the wrapper cfc I used for java.io.FileWriter which, in the application I was concerned with, attained a 10x performance improvement over cffile action='append'... under condition that over 20,000 lines needed to be written out to a text file. It aint nuthin special, but might save someone a few minutes... cfcomponent displayname=javaFile output=true cffunction name=initFile returntype=boolean access=remote output=Yes cfargument name=filename type=string required=yes cfset var retValue=false cfif not(fileexists(arguments.filename)) cffile action=write file=#arguments.filename# output= /cfif cfset this.FileObject = createobject(java, java.io.FileWriter).init(arguments.filename, true) cfset retValue=true cfreturn retValue /cffunction cffunction name=appendRaw returntype=boolean access=remote output=yes cfargument name=fileData type=string required=yes cfset var retValue=false cfset this.FileObject.write(arguments.fileData,0, len(arguments.fileData)) cfset retValue=true cfreturn retValue /cffunction cffunction name=appendLine returntype=boolean access=remote output=yes cfargument name=fileData type=string required=yes cfset var retValue=false cfset var CrLf = chr(13) chr(10) cfset var opbuffer=arguments.filedata CrLf cfset this.FileObject.write(opbuffer,0,len(opbuffer)) cfset retValue=true cfreturn retValue /cffunction cffunction name=done returntype=void access=remote output=yes cfset this.FileObject.flush() cfset this.FileObject.close() cfreturn /cffunction /cfcomponent ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338315 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
FWIW, you'll probably find a speed improvement if you have output=false on cfcomponent and cffunction... On Mon, Oct 18, 2010 at 6:50 PM, Bryn Parrott bryn_parr...@internode.on.net wrote: For those to whom it might be useful, here is the wrapper cfc I used for java.io.FileWriter which, in the application I was concerned with, attained a 10x performance improvement over cffile action='append'... under condition that over 20,000 lines needed to be written out to a text file. It aint nuthin special, but might save someone a few minutes... cfcomponent displayname=javaFile output=true cffunction name=initFile returntype=boolean access=remote output=Yes cfargument name=filename type=string required=yes cfse ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338316 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
It's not always ColdFusion that is at issue. The JVM plays a huge role here. What is your JVM version? Oh, and why not update your version of CF as well? Wil Genovese Sr. Web Application Developer/ Systems Administrator wilg...@trunkful.com www.trunkful.com On Oct 17, 2010, at 10:14 PM, Bryn Parrott wrote: Dear All, I have this algorithm that runs a query or two against a mySQL (5) database on a Win 2003 (64Bit) server. The code loops over the query; assembles some text and writes it out to a text file line by line. Fairly simple really. There are lots of records. When I code this algorithm and execute in PHP 5 it runs in 7 seconds (give or take); When I code and excecute it in CF 8.0.0, it runs in around 74 seconds. The PHP code is being executed using cfexecute... Now to me this kind of performance degradation/difference between PHP and CF is unintuive, given that PHP is interpreted; whilst CF is 'compiled'; I expected CF to run faster. This was not my code to begin with however I have gone over it and checked for all the usual suspects; memory leaks; var variables and the like. The CF code is in the form of a cfcomponent, and my execution time observations were taken on the second run to take the compilation phase into account. Now I'm aware that CF 8.0.1 fixed some performance issues relating to CFC methods (I think...); but were the issues as severe as I am seeing ? Anyway, have others any views to offer on why I am seeing such a severe performance degradation for CF over PHP and suggest any way in which I might tune the CF code/server so that it is more nearly the same or better than the PHP. Sonme might suggest this is difficult since I have deliberately not posted the code; however I'm thinking that perhaps you might suggest general things I may not have thought of. Thanks, Bryn ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338267 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Just a guess but... If you are doing a lot of string manipulation CF can be really slow. I don't know about CF 8 as I have not tried parsing large text strings with it, but earlier versions were abysmal performance wise when it came to string manipulation. As far as CFC's and objects go, I have seen plain old cfquery and cfoutput run ten+ times faster than doing the same thing by loading a bean with data and passing it to a DOA or Gateway. Even with CF 8. Based on my experience, I would imagine that the bottle neck would be in one of those two places. Again just a guess. G! On Sun, Oct 17, 2010 at 11:14 PM, Bryn Parrott bryn_parr...@internode.on.net wrote: Dear All, I have this algorithm that runs a query or two against a mySQL (5) database on a Win 2003 (64Bit) server. The code loops over the query; assembles some text and writes it out to a text file line by line. Fairly simple really. There are lots of records. When I code this algorithm and execute in PHP 5 it runs in 7 seconds (give or take); When I code and excecute it in CF 8.0.0, it runs in around 74 seconds. The PHP code is being executed using cfexecute... Now to me this kind of performance degradation/difference between PHP and CF is unintuive, given that PHP is interpreted; whilst CF is 'compiled'; I expected CF to run faster. This was not my code to begin with however I have gone over it and checked for all the usual suspects; memory leaks; var variables and the like. The CF code is in the form of a cfcomponent, and my execution time observations were taken on the second run to take the compilation phase into account. Now I'm aware that CF 8.0.1 fixed some performance issues relating to CFC methods (I think...); but were the issues as severe as I am seeing ? Anyway, have others any views to offer on why I am seeing such a severe performance degradation for CF over PHP and suggest any way in which I might tune the CF code/server so that it is more nearly the same or better than the PHP. Sonme might suggest this is difficult since I have deliberately not posted the code; however I'm thinking that perhaps you might suggest general things I may not have thought of. Thanks, Bryn ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338268 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
If you're appending text line by line to a memory variable, you're probably having issues relating to java strings being immutable. If you're appending to a file each time, that's probably slowing you down. Try the loop without writing any strings out and see what the difference is. If that's fast, try a Java class that buffers string or file output depending on how you want it to work. -- WSS4CF - WS-Security framework for CF http://wss4cf.riaforge.org/ On 18 October 2010 11:14, Bryn Parrott bryn_parr...@internode.on.net wrote: Dear All, I have this algorithm that runs a query or two against a mySQL (5) database on a Win 2003 (64Bit) server. The code loops over the query; assembles some text and writes it out to a text file line by line. Fairly simple really. There are lots of records. When I code this algorithm and execute in PHP 5 it runs in 7 seconds (give or take); When I code and excecute it in CF 8.0.0, it runs in around 74 seconds. The PHP code is being executed using cfexecute... Now to me this kind of performance degradation/difference between PHP and CF is unintuive, given that PHP is interpreted; whilst CF is 'compiled'; I expected CF to run faster. This was not my code to begin with however I have gone over it and checked for all the usual suspects; memory leaks; var variables and the like. The CF code is in the form of a cfcomponent, and my execution time observations were taken on the second run to take the compilation phase into account. Now I'm aware that CF 8.0.1 fixed some performance issues relating to CFC methods (I think...); but were the issues as severe as I am seeing ? Anyway, have others any views to offer on why I am seeing such a severe performance degradation for CF over PHP and suggest any way in which I might tune the CF code/server so that it is more nearly the same or better than the PHP. Sonme might suggest this is difficult since I have deliberately not posted the code; however I'm thinking that perhaps you might suggest general things I may not have thought of. Thanks, Bryn ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338269 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
It's not always ColdFusion that is at issue. The JVM plays a huge role here. What is your JVM version? Oh, and why not update your version of CF as well? Thanks Will... Initially I saw that the JVM was set to a non-adobe JVM; and so I changed it back to the standard ColdFusion8/runtime/jre. This had the important benefit of reducing response time by 3 seconds; but unfortunately this is not enough. In regards update of CF; I explored this possibility but it turned out that unless I can point to important business benefits the client is unlikely to want to spend the resource required to regression test all of the various applications running on the same server. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338270 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
Thanks to both Guido and James. I'll look into string handling/manipulation used in the code implementation and see if some more efficient technique might be useable. Cheers and thanks all for the swift responses. Cheers, Bryn ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338271 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
You still didn't answer the question. What is the version number of the JVM being used? This is very important. Anything less than 1.6.0_10 is going to have performance issues. Wil Genovese Sr. Web Application Developer/ Systems Administrator wilg...@trunkful.com www.trunkful.com On Oct 17, 2010, at 11:22 PM, Bryn Parrott wrote: It's not always ColdFusion that is at issue. The JVM plays a huge role here. What is your JVM version? Oh, and why not update your version of CF as well? Thanks Will... Initially I saw that the JVM was set to a non-adobe JVM; and so I changed it back to the standard ColdFusion8/runtime/jre. This had the important benefit of reducing response time by 3 seconds; but unfortunately this is not enough. In regards update of CF; I explored this possibility but it turned out that unless I can point to important business benefits the client is unlikely to want to spend the resource required to regression test all of the various applications running on the same server. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338272 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF (8.0.0) performance vs PHP (5)
If you're appending text line by line to a memory variable, you're probably having issues relating to java strings being immutable. If you're appending to a file each time, that's probably slowing you down. I was doing the latter e.g. appending to a file for each line. Try the loop without writing any strings out and see what the difference is. If that's fast, try a Java class that buffers string or file output depending on how you want it to work. That made a dramatic difference to the execution time. This gives me a lead as to what might be done to fix the problem. What can I say but thanks a bunch; and cheers Bryn ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338273 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm