Archive for May, 2008

Load Testing your web server

One of my new duties at work is load testing web applications. We usually only do this with the release of a new application or during migration to new hardware. I’ve used a couple different tools but am most happy with a product called WAPT which stands for Web Application Performance Tool and is put out by SoftLogica. The software runs on a typical worktation and can generate the load of hundreds or even thousands of users depending on your hardware.

Creating your test script is easy as it records your progress as you step through your application.  After you are done recording your path through your application, you can go back and edit each page and configure variables to produce dynamic information.  See variables circled in red below:

WAPT GUI

In my tests I took a workstation and set it to scale 250 users at 10 minute intervals to an upper limit of 2000 users. The tools has a nice graphical interface that lets you step through your web application, recording pages and form data sent. After you stop recording, you go back and can modify the data being sent using functions that can generate random numbers and sequences of text or iterations from lists. It makes it possible to create a test script that will never send the same data twice to your application. This goes for both web form selections or plain text entry.

After your test is complete, you have a ton of data and graphs you an go over. Here is an example one graph from one of my tests:

average response time graph

This particular graph charts the average response time calculated from 90% of the activity placed on the server for a particular lookup screen. You can see that as the system reached 1000 concurrent users, it started to crap out and we halted the test. This particular system was running a newly configured LPAR on AIX using Oracle Application Server. It didn’t seem to scale as well as we had hoped but oh well.

The good news is we were able to determine that the enfironment for an existing application wasn’t performing as well as the old environment. Always nice to know before you make the switch and find out you can’t scale. ;-)

SOA vs SaaS… What’s the difference?

So I was trying to get a clear picture of these two ‘things’ and what they really mean.  They sound similar when you say them, Service Oriented Architecture and Software aa Service.  Not knowing a whole lot about either topic I kept asking myself, what’s the difference?  Turns out, at least from my perspective, they are very different.  SOA is really describing a way to architect software, while SaaS is about how to make software available to users.  Here was the really big definitive point for myself, that in each phrase, the word Service means something entirely different. 

With SOA, Service refers to something that easily interacts across platforms using industry standards for extreme compatibility.  A good example could be a small utility application that uses Web Services to communicate.  Since Web Services are an industry standard and cross platform, software built around them can meet SOA criteria. 

With SaaS, Service refers to something offered without having to be installed, configured or maintained by your own system administrator.  The company offering the software, like Salesforce.com for example, takes care of everything for you as part of the Service they provide the customer. 

So the trick for me is to remember the definition of the word Service which has two meanings here.  As long as you can keep those straight, it makes understanding the roles of SOA and SaaS much easier in this industry of ever growing terms and phrases that quite honestly borders on the ridiculous.�

Coldfusion and “_required”

So I got burned the other day with more of Coldfusion’s built in form validation. Turns out, that there are six baned form fields that will invoke this sort of form validation according to this livedocs entry.

In particular, I was burned with “_required” which has an even more restrictive set of rules. In order to invoke that validation, you just have a hidden field that is named the same as a visible field, but add “_required” to the field name.

Just so happens I was using a hidden form field named, “apprenticeship_flag_required” and was using it to store a value to let my javascript perform some business logic. Well, this now meant that Coldfusion was going to always require the form field “union_apprentice_flag”. It produces that ever informative error we have come to know and love:

error message

Changing the hidden form field to “apprenticeship_flag_req” fixed the problem.

Integrate Coldfusion in Joomla (PHP)

So I have a couple sites I manage with Joomla and recently needed to code a customized online membership form that would interact with PayPal. Because I know CFML much better than PHP, I wanted to code this portion with Coldfusion. The only trick was how does one get CFML to execute within a PHP template? Turns out it is easy with the Joomla “wrapper” feature.

The way it works is to first create your CFML templates. I did them without any extra formatting knowing they would be included withing an iframe generated by Joomla. Then, I just created a new menu item within Joomla that was of type “Wrapper”. One of the elements of such a menu item is called the, “Wrapper Link”. You just provide a fully qualified URL to your CFML template (could even reside on another server) and Joomla will process the request and pull in all it’s contents. It worked perfectly for me with the exception that I had to watch my margins carefully because you are limited in width to the size of the iframe available in Joomla. This will depend on the layout you use with Joomla of course. But there you go, no reason you must be limited to PHP, Perl, Coldfusion or any other scripting language for that matter. The working application can be seen here.

Don’t name cfinput form variables with “_time”

So this makes no sense to me at all, and it might be so terribly rare that you will never see it happen. If you use CFFORM and CFINPUT and you have two form fields of almost the same name (tack “_time” on to one of the form fields’ name) the internal coldfusion server side validation will null out the value of the form field without “_time” in its name. Whew, that was a mouthful, let me try to explain with an example. Take the following example code:

Date: <cfinput type=”text” name=”start_outage” validate=”date” required=”yes” value=”4/30/2008″><br />
Time: <cfinput type=”text” name=”start_outage_time” validate=”time” required=”yes” value=”11:54 PM”><br />

If you submit a form with these two fields, you will end up with the following output for your date field :

1899-12-30

Where the heck did that come from? Well, as it turns out, if you try to perform date functions, like DateFormat() on a zero value, it will produce the date 1899-12-30 which is I think Coldfusion’s answer to the UNIX Epoch. Anyway, I’ve got bad data, but I’m keying good data. Finally, I find a post in another discussion that indicates there is some built in server side validation Coldfusion will perform if it comes across a form field that ends with “_time”. It just so happens that a side effect is zeroing out the value of a date field that has the same form field name without the “_time” at the end. In this case the names were:

start_outage for the DATE
start_outage_time for the TIME

As soon as I changed the name of my date field to “start_outages” everthing worked. Also, changing the time field name to “start_outagetime” fixed performance and I had no more zeroed out dates. Even stranger that made debugging this problem hard was that the debug output at the bottom of my web page plainly displayed the values I expected for all of my form fields, however, as soon as I tried to output the form variables, all the dates that had matching time form fields were all zeroed out and showing “1899-12-30″.

Whew! It’s all over now and hopefully this information will help someone else out there. Here is a complete listing of code that will reproduce the problem, just paste into a single CFML template and run it:


<cfform action=”#script_name#” method=”post”>
Date: <cfinput type=”text” name=”start_outage” validate=”date” required=”yes” value=”4/30/2008″><br />
Time: <cfinput type=”text” name=”start_outage_time” validate=”time” required=”yes” value=”11:54 PM”><br />
<input type=”hidden” name=”formAction” value=”submit” />
<input type=”submit” value=”submit” />
</cfform>

<cfif formAction eq “submit”>
<cfoutput>
MySQL Date/Timestamp = #DateFormat(form.start_outage,”yyyy-mm-dd”)# #TimeFormat(form.start_outage_time,”hh:mm tt”)#
</cfoutput>
</cfif>