mercoledì 29 ottobre 2008

PreparedStatement performance improvement

Sometimes, when saving the results of a cardsorting, Netsorting seems to slow down dramatically. The application has to save tens of records on the database, and the problem could be related to the performances of this operation.

I therefore decided to implement a PreparedStatement version of the INSERT.

Before changing the call, however, I decide to test the difference in the performances.

I compared 3 versions of the database call.

The first was the old one, where statement.execute (sql) was used.
The second method used a PreparedStatement and the PreparedStatement.execute() call.
The third version used the same PreparedStatement, but using the bash version.

I tested it inserting, for each method, 1000 rows. The results are the follows:
statement.execute (sql) * 1000: 837 millisec
PreparedStatement.execute() * 1000: 625 millisec
PreparedStatement.addBatch() * 1000: 186 millisec

The performance gain is quite impressive, and I therefore decided to implement it.

The code example of the third version

String psql = "INSERT INTO CSANSWER VALUES (nextval('CSANSWER_ID'),?,?,?,?,?);";
csaps = connection.prepareStatement(psql);
....
connection.setAutoCommit(false);
for () {
csaps.setInt(1, getTestId());
csaps.setInt(2, getQuestionnaireId());
csaps.setInt(3, getId());
csaps.setInt(4, itemid);
csaps.setInt(5, groupid);
csaps.addBatch();
}

csaps.executeBatch();
connection.commit();
connection.setAutoCommit(true);

Useful links:
Batch Updates
Prepared Statement With Batch Update

giovedì 24 luglio 2008

tomcat or httpd?

java is slow, c++ is fast.
Tomcat is slow, httpd is fast.
Right?
Probably not.


First off, I'm bias in favor of Tomcat. Based on these results, I can state with confidence Tomcat 5.5.4 has made great strides since Tomcat 3.3. Tomcat 5.5.4 is faster, more reliable and more efficient than previous releases. For those who wonder “can tomcat handle static files?” My opinion is yes. If you only have a single server co-located at an ISP and can't afford a dedicated image server, Tomcat will work just fine. For sites that need high performance/high availability, the
best option is to setup dedicated Apache2 for the static files. This setup allows tomcat to focus on generating dynamic content, instead of clogging the network IO. Hopefully these results help dispell the myth that Tomcat 5.5.4 can't handle static files efficiently.

tomcat benchmark summary.

Running the test on a quiet network five times, with the ab commands running in a different order to balance out any caching issues, I got the following:

Direct access via httpd - 300 per second
Direct access via Tomcat - 483 per second
Access via both servers connected by jk - 307 per second
Access via both servers connected by proxy - 222 per second

www.wellho.net

Apache httpd is really only appropriate with odd configurations
including load balancing, multiple apps in separate JVMs, other needs
(such as PHP support, or some module only available in Apache), or when
Apache httpd is already present and nobody wants to get rid of it.

Christopher Schultz

see also Tomcat: the definitive guide.

martedì 27 maggio 2008

Proximity matrix as excel file

Though Netsorting has some build in analysis tools, the editor may prefer to analyze the data with it's own statistical tools. She can therefore download the proximity matrix as an excel file.

I've just published on google docs an example of the proximity matrix of the card sorting.

A proximity matrix in google docs

download graphs as svg

Netsorting uses SVG (Scalable Vector Graphics) to render the graphics of the cluster analysis of card sorting.

Now you can download the graphical representation of the kmeans analysis on the principal component analysis of the proximity matrix of the card sorting as a svg file.

Using Inkscape, a free open source vector graphics editor, you can edit the graph and export it as pdf, ps, png. Inkscape is available for Linux, Windows and Mac Os.

Here is an example of the clusters generated from the card sorting of the semantic domain of coffee (in Italian).

Read this doc on Scribd: kmeans card sorting caffé

domenica 25 maggio 2008

Working on the drag and drop version

In these days I'm working to implement the drag and drop version of the card sorting user interface.
I've made a first try some months ago, but the results weren't satisfactory.
Now I'm using the beautiful YUI as a framework for JavaScript and AJAX.

Thanks to it's Drag & Drop Utility a stylish and usable drag and drop interface seems easy to implement.

I'll update this post when the new interface will be terminated.

Welcome

This is the blog of Netsorting.
Here I will post some news concerning the application, it's development, it's new features and so on.