Presentation Files for Performance Tuning Coldfusion: Before the JVM from CFUnited

September 21st, 2009

For anyone who missed it, or wanted to get some of the program links or jvm.config settings, here you go!
Download it from here.

Source:Presentation Files for Performance Tuning Coldfusion: Before the JVM from CFUnited

admin Alagad

Setting the edit position on the Datagrid

September 21st, 2009

Just quickly wanted to describe setting the edit position on the Flex Datagrid component.

I recently wanted to add a new empty row to my datagrid and make sure that new row had focus and was ready to be edited. Setting the editedItemPosition property on the datagrid requires passing an object in the following format:
 
{ rowIndex : 0 , columnIndex : 1 }
Here’s some code to get you there if your looking to do something similar:

import mx.collections.ArrayCollection;
import mx.events.DataGridEvent;
 
[Bindable]–>

protected var dataGridDataProvider:ArrayCollection = new ArrayCollection([{name:'firstName', description:'First Name'}, {name:'lastName', description:'Last Name'}, {name:'email',  description:'Email'}])
 
/**
* Handles the click event from the add row btn.
*
* @param event MouseEvent
*/
public function addRowBtnClickHandler(event:MouseEvent):void
{
//add am empty item
dataGridDataProvider.addItem({name:”, description:”});
//select the empty item
dataGrid.selectedIndex = dataGridDataProvider.length - 1;
//set the new item to edit
dataGrid.editedItemPosition = {rowIndex:dataGrid.selectedIndex, columnIndex:1}
}
 
/**
* Handles DataGridEvent that is dispatched when an item editing session ends on the dataGrid.
*
* @param event DataGridEvent
*/
public function dataGridItemEditEndHandler(event:DataGridEvent):void
{
  trace(’Edit the Datagrid.’)
}
]]>
<mx:DataGrid id=”dataGrid”height=”100%” width=”100%”dataProvider=”{dataGridDataProvider}”editable=”true”itemEditEnd=”dataGridItemEditEndHandler(event)”><mx:columns>     <mx:DataGridColumn width=”40″    editable=”false”    paddingLeft=”10″     textAlign=”center”>       <mx:itemRenderer>         <mx:Component>           <mx:CheckBox/>         </mx:Component>       </mx:itemRenderer>     </mx:DataGridColumn>     <mx:DataGridColumn dataField=”name”   headerText=”Name”/>     <mx:DataGridColumn dataField=”description”   headerText=”Description”/>     </mx:columns></mx:DataGrid><mx:Button id=”addRowBtn”  label=”Add A Row”  click=”addRowBtnClickHandler(event)”/> 
 

Hope this helps some folks and thanks for any comments.
Sincerely,
Matt
 

Source:Setting the edit position on the Datagrid

admin Alagad

Apache's Jmeter Part III - Using a csv to replicate real traffic

September 21st, 2009

Time for post number 3 regarding Jmeter, and today I will go over simulating users performing searches for keywords feeding from a CSV file. Lets start with a basic test plan, with one thread group, a single web request to google, a random timer, and a results tree listener so we can see what is going on.  It should look something like this to begin with (refer to my earlier posts to get to this point, either Jmeter part I or Jmeter part II)

Now you need to create or obtain a CSV file containing your search terms you wish to run through (or users to login, items to view, whatever you would like to change during each request).  I made a super simple one here, feel free to download or create your own, and name it searches.csv.
Download a sample searches.csv file.
Now, save that csv file in the same directory that you saved your test plan file. Add a new element as a child of your thread group, called ‘CSV Data Set Config’.

Set the filename to ’searches.csv’ (or whatever you named your data file), set the Variable Names to ‘TERM’, delimiter to a comma, and stop thread on EOF to false, and sharing mode to ‘All Threads’.  The sharing mode just sets the scope of where this variable name (defined as term above) will be available, inside this thread group, inside a single thread, or to the entire test on any thread.

Now we have to tell our individual search to use this CSV data, which is actually really simple to do.  Go to your HTTPClient sampler, and in the HTTP parameters list, change the q value, which is currently a string ‘coldfusion’, to ${TERM}.

Now when you save your plan and run it, take a look at your results tree, and click on ‘Request’.  You will see that each search sent to google uses the next item from your CSV data file to perform the test. 

This is a great technique to use for simulating multiple user logins. Combine this with the cookie manager, and you can fully simulate users logging in, performing a series of actions, and logging out at the end.

Source:Apache's Jmeter Part III - Using a csv to replicate real traffic

admin Alagad

ColdFusion 9 ORM on Tomcat Gotcha

September 21st, 2009

I am sitting here working through an application that makes use of the new ColdFusion 9 ORM capabilities.  I have a simple business object that I created using EntityNew(), then populated it, and attempted to save it using EntitySave().  Nothing fancy and everything straight out of the docs.
The problem was, when I ran this code I would just get a blank screen – no errors, nothing.  I started up my application server – Tomcat – in the console and checked the output as I ran the script.  Sure enough, there was a slew of Java errors being displayed with the first being …

java.lang.NoClassDefFound: javax/transaction/Synchronization

With a bit of googling, I came across a blog article by Rupesh Kumar which mentioned this issue in the comments.  I had heard that Tomcat was not officially supported by ColdFusion which did not make a lot of sense, but apparently this just came back and bit me.
Somewhere in the Hibernate integration with ColdFusion 9, it is expecting a library called jta.jar (part of the Java Transaction support) to be included with the application server.  This library is not included by default with Tomcat and thus the error I was seeing, or not seeing.
I did some searching and could not find the jta.jar library to download, but I did find a zip download of all of the classes available on the Java site at http://java.sun.com/javaee/technologies/jta/index.jsp.  So, I simply downloaded this and renamed it to jta.jar, then dropped it into my Tomcat /lib folder.  With that in place, I restarted Tomcat, fired up my CF template again and everything worked like it should.
I can’t fault Adobe since they don’t support Tomcat.  I am curious as to why they don’t support it since it used to be supported, but hopefully this will save somebody a couple of hours digging around when their script fails to show anything.

Source:ColdFusion 9 ORM on Tomcat Gotcha

admin Alagad

Alagad Quickies

September 21st, 2009

I have a few quick things I think people might be interested in, but rather than writing a bunch of small blog entries, I figured I’d wrap them up into one shot. 
First off, Alagad has released an all-new alagad.com website.   This new website separates the developer-focused content from the corporate marketing information.  This should probably make both audiences happier.  I personally love the new design and hope you do too. We’ll be adding more content including project descriptions, client information, event information, press releases and more.  All things in good time!
This week five of the Alagad team members (Scott Stroz, Brian Kotek, Chris Peterson, Vicky Ryder and myself, Doug Hughes) are at the CFUnited conference.   We’re what I’d call a roaming sponsor, which means we didn’t spring for a booth.  However, we’re not skimping on our conference give away.  If you’re at CFUnited and you find an Alagad employee you can get entered into a raffle to win one of ten Alagad bags stuffed with a Mac Mini, a Wii, an iPod Touch, or an Amazon gift card.  All you need to do is answer a short survey!
Speaking of conferences, I’ve decided that we’re going to be sponsoring the Adobe Max conference this year.  I’m excited since we’ve never done that before.  I’m not sure we’ll do the big give away, but I’ll try to do something exciting.  (Any ideas?)
Finally, we have nine of the very nice Alagad backpacks left over from our conference giveaways.  So we’re planning on holding a series of Blog-based contests with the winner getting one of the bags.  Chris Peterson is running the first one right now. Keep your eyes on the Alagad blog for more information.

Source:Alagad Quickies

admin Alagad

Troubleshooting Coldfusion Performance: The Problem

September 21st, 2009

In this post series, I would like to put forward a hypothetical situation involving poor ColdFusion application performance, the investigative steps to take to isolate the issues, and the remedial steps to perform in order to solve those issues. I would really like some feedback from readers as well here, to hypothesize on possible issues, possible resolutions, and supply other tools or methods which may identify or solve the issues we discuss. I hope that this post series will not only help you identify and deal with ColdFusion issues, but also help to identify database, network, or hardware issues as they may arise. Note: This hypothetical situation, while pulled from my experiences, is not a direct parallel to any of my previous customers, and is instead a combination of factors from several different projects. Lets call it Project X. The Environment Project X is setup to run across (4) Coldfusion 8 Enterprise edition servers, in a load balanced cluster behind a hardware load balancer. Sticky sessions are configured, so once a user makes a request to a given server, their subsequent requests should continue on the same server. Project X has a single MS SQL 2005 database on a 32 bit Windows 2003, which has 4 GB of ram. This server has (3) 15K 75 gig SCSI hard drives in RAID 5, upon which the operating system and the MS SQL binaries are installed. There is an iSCSI connected device which has (8) 10K 147 gig SCSI hard drives. The iSCSI device contains the MS SQL data and log files. Each Project X web server is a 32 bit Windows 2003 server with 4 GB of ram, and (3) 15K 75 gig SCSI hard drives in RAID 5. Each web server is running 2 instances of ColdFusion in a local cluster (using round robin to split requests between instances), and each ColdFusion instance is using the default JVM configuration that ships with ColdFusion 8. There is a shared folder on the MS SQL server which contains all shared page assets (files uploaded by the users, PDF documentation, and images). Each web server is running Apache, and has an alias pointing to the shared folder on the SQL box (using a UNC path). All servers are connected to a 24 port gigabit switch, and is hosted on an OC3 line. Project X is a web based file sharing application which allows users to upload and share files of many types (images, pdf’s, office documents, and more). It makes use of Application.cfm to load site variables, and uses several CFC objects to encapsulate database queries and user information. The ProblemFor several years this configuration has worked fine for the customer, with stable servers and acceptable response times. Project X has recently run an ad campaign in the national media, which has increased their site traffic by a factor of 2. Since the campaign, users have been complaining of slow web response times, as well as error messages. Investigating the server logs also shows that the coldfusion instances have been crashing with out of memory errors.You are tasked with uncovering the issues that are causing the slow page rendering, and the out of memory server issues. In my next post I will share both my techniques I use to identify these issues, as well as a selection of idea’s in comment responses to this post. Thoughts?Bonus Now to encourage participation here, anyone who contributes in comments to this chain of blog posts by commenting (with a relevant comment to this discussion) will be entered into a drawing to win an Alagad backpack (trust me, these are the best backpacks ever, I use mine for travel, school, everything). I will do a drawing for the backpack in a connect room after this blog series is completed, so lets bring on the idea’s!

Source:Troubleshooting Coldfusion Performance: The Problem

admin Alagad

Hibernate & ColdFusion 9 - What is ORM?

September 21st, 2009

Before we dig into Hibernate, I wanted to take a quick textbook look at what ORM is since Hibernate is an example of an ORM framework.  ORM spelled out is object/relational mapping.  One text I read said that the slash between object and relational is supposed to emphasize the mismatch problem that occurs when the object oriented world meets the relational world.
The way the book Java Persistence with Hibernate defines ORM is:

.. the automated (and transparent) persistence of objects in a Java application to the tables in a relational database, using metadata that describes the mapping between the objects and the database.

This sounds pretty simple – so basically an ORM knows enough about the object model in your application to know how to take a Person object and its related Address etc. instances and transform that data into your relational database structure and vice versa.
Again, according to Java Persistence with Hibernate, an ORM solution is made up of the following 4 components:

An API for performing basic CRUD expressions – think SQL
A language or API for creating queries that refer to object and their properties instead of tables and column
Capabilities for describing mappings between objects
Capabilities for functionality including dirty checking, lazy fetching, and other optimization

There were a lot of buzz words in that last point, but the optimization reference is one I am interested in.  ORM solutions in the past have always seemed to just add an extra layer of overhead to an application and thus suffer a performance penalty.  If through Hibernate we can optimize the queries that are run and the way data is returned, that could make a big difference.  On the flip side, there are quite a few benefits to a properly implemented ORM solution like Hibernate.
Productivity
As much as the DBAs out there love to write and optimize SQL queries, like any other coding, it still takes time to write and time to debug.  In addition, you may have to deal with cross platform issues in dealing with different relational database systems.  An ORM framework such as Hibernate can drop right into place and with a few tweaks to the object model, handle all of this persistence layer for us.  I expect there will be some optimization work and a few queries that still need to be written, but for the most part, all of that redundant CRUD work is taken care of.
Maintenance
Maintenance goes along with productivity – fewer lines of code to be written in the first place means fewer lines of code to maintain down the road.  In the case of Hibernate, you are also dealing with an open source, battle tested application rather than starting from scratch with your own persistence layer – thus hopefully reducing the bugs you have to deal with.
Performance
This one is where I have the most questions.  With hand coded SQL queries, you can always tweak the query to get just the data you need.  You can cache those query results and more to get every little bit of performance you can.  With an ORM solution, it is argued in the book that via Hibernate, these optimizations are even easier to achieve and faster to implement.  There is also the argument that with an open source project like Hibernate, there were many more minds looking at the code and had more time to investigate optimizations than you have on any given project.  This argument I can see and agree with.
Vendor Independence
This benefit can be argued as with most custom applications I have ever worked on, you very rarely see a database platform change.  However, if you were developing software that was sold commercially and had to support multiple database platforms, I could see this being a big benefit.  In order to support multiple platforms without an ORM, you would either be limited to very generic SQL or you would have built multiple persistence layer implementations which would just add to the maintenance overhead.  With a vendor independent solution such as Hibernate, this dependency is taken care of for you.
That is enough for today.  Next up, the requisite Hello World project – what book would be complete without one?  The book obviously sets this up in Java, but my plan is to duplicate it on ColdFusion 9 using the new Hibernate integration.

Source:Hibernate & ColdFusion 9 - What is ORM?

admin Alagad

Upcoming CFUnited Presentation - Performance Tuning: Before the JVM

September 21st, 2009

I just wanted to remind folks of my upcoming presentation at CFUnited, entitled Performance Tuning Coldfusion: Before the JVM. I will go over tooling and techniques you can use to identify difficult to find source code issues, as well as the methodoligies I use when diagnosing issues on a customers server that is having performance difficulties.  I will show you how to obtain and analyze a heap dump using VisualVM, how to review method usage and trace method calls using HPJmeter, how to isolate and resolve MS SQL performance issues using the Database Engine Tuning Advisor, and generally how to isolate problematic code issues and apply logical thinking to arrive at conclusions which will allow you to resolve performance issues.
I had the oppertunity to give this presentation last night at the Mid Michigan CFUG in Lansing, and I believe it was very well received. Much note taking was going on, and I think everyone walked away with a few new idea’s they could apply to their servers right away. Hope to see you at CFUnited 2009!

Source:Upcoming CFUnited Presentation - Performance Tuning: Before the JVM

admin Alagad

Has Flash Player 10 killed Papervision 3D?

September 21st, 2009

I’m just throwing that question out there. Please don’t expect to find the answer to this or really any quandary from reading one of my blog posts.
Up until this past weekend I hadn’t really played around with the Papervision open source 3d engine in over a year. I remember Papervision being the new hotness back them. Seems like every other blog post was some sort of cool new 3D texturing globe component or amazing 3D navigation using it. Then Flash 10 came out with it’s own somewhat native 3D functionality and the Papervision buzz wore off.
So what became of this popular 3D engine?
Well, from what I can gather, Papervision is continuing to be used on various 3D projects across a wide variety of Flash application online. Check out the New York Times 3D rendering of the 15th hole at the US Open Golf Tournament here. Or check out the radical 3D navigation in this UFC promotional site here.
So why is it still being used, isn’t it native in Flash 10?
A. Flash 10’s 3D capabilities fall short of the expectations for your client’s particular project. The new 3D capabilities of the Flash 10 are more of a distortion of a bitmap with perspective and not truly a 3D engine.  In fact the developers of Papervision are activily looking at how to better take advantage of the new player to speed up and increase the performance of their 3D engine.
B. The penetration numbers for Flash 10 aren’t there yet. While the Flash browser plug in is pretty ubiquitous among internet-enabled desktops, the latest version with 3D support is only being reported on about 87% of devices compared with Flash 9 at 99%.

Is the project still evolving?
Papervision’s blog seems to be pretty active and the source code continues to be actively updated. However the actual project download (swc or zip) is dated at March of 0, there hasn’t been an issue reported in a while and the project wiki hasn’t been updated for about half of a year. So it would appear that some of the hype has at least slowed.
My $0.02?
I’m a fan of using some subtle 3D techniques to enhance an application. Flash player 10 provides me with enough resources to create some interesting transitions and navigation elements without the overhead of adding an additional truly 3D engine. And as for penetration, that would differ from client to client. So maybe Flash player 10’s 3D hacks are going to cover me for 90% of my needs. That being said, I’d still turn to Papervision for any project that actually had any involved 3D elements. I’m thinking of applications that would take advantage of spacial dimensions such as a cargo loading application or maybe a 3D product design application like a build your own wine bottle website.
What about you guys? Where do you draw the line? Do you think Flash 10 killed the Papervision 3D engine or maybe it’s momentum?
 

Source:Has Flash Player 10 killed Papervision 3D?

admin Alagad

'ColdFusion and jQuery: Perfect Together' Presentation Files

September 21st, 2009

As promised, I have posted the presentation files - including all the code - for my CFunited presentation.
You can get the files here.

Source:'ColdFusion and jQuery: Perfect Together' Presentation Files

admin Alagad