August 27, 2007
I started work on a Java class that mimics the functionality of the mysqldump command today.
My goal is to create a standalone application to begin with, but design the class such that it can be plugged into any other Java application requiring MySQL backup capability.
After completing the initial prototype of the dump_table method (minus blob support), I began to wonder what the performance would be like compared to the bundled mysqldump application (written in C).
As this was a prototype with no optimisations, the results were not that bad. The following figures were obtained from running both the C-based mysqldump and the MySQLDump.java app against a fairly large innodb attachments table (about 260mb).
| OSX Laptop |
| mysqldump (C-based) |
MySQLDump (Java-based) |
real 2m51.762s
user 0m10.784s
sys 0m8.213
|
real 3m23.485s
user 0m29.113s
sys 0m12.276s
|
Now this was in no way a strict test environment. I ran the test on my laptop running OSX 10.4.10 connecting to an OpenSolaris server running MySQL 4.0.24 (out of the box) over Wifi. I had to increase the max_allowed_packet and import the large table, but apart from that the server was a clean install.
The mysqldump client was from the MySQL 5.0 packaged install for OSX and the Java VM was version 1.5.0. I did try running the test against the beta JVM 1.6.0 for OSX, but that was 30 seconds slower. I’m sure that will improve when the final version is released and debugging code removed.
I tried a final test by running both commands directly on the OpenSolaris server still connecting via IP.
| OpenSolaris B69 |
| mysqldump (C-based) |
MySQLDump (Java-based) |
real 0m57.313s
user 0m18.140s
sys 0m8.104s
|
real 0m39.877s
user 0m2.387s
sys 0m2.424s
|
As you can see there is a slight improvement, probably due to the mysqldump version being older out of the box on Solaris and Java apps running faster on that platform. Of course the final version will check if it is run locally on the server and issue a “SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE”. I just wanted to confirm my view of Java running faster under Solaris.
I wonder how fast this would run under Perl…OK, enough fun with timings, I best get back to writing the code before I head off on Holiday….
August 21, 2007
It’s been at least a month since I last installed Solaris and after receiving several e-mails with details on the next OpenSolaris build (every other week) I just couldn’t resist the urge to take it for a test drive.
The installation has not changed much (I just missed build 70 - it’s downloading as I type) and this time around I found myself running the text based install from within the GUI, not a bad thing as I prefer the text install and always forget to select that option at boot. 
An hour or so later and I now have a Solaris box to play with, handy as I am looking at using Java for one of my projects, and as I have mentioned before, Java runs best on Solaris!.
Not one to stand still for longer than a minute, I began focusing my attentions on JavaEE 5. Once again I found myself choosing between GlassFish and Apache Geronimo, not an easy task. I was very impressed with Geronimo the last time I fired it up, but I have been hearing a lot of good things about GlassFish recently and the v2 release can not be far off.
GlassFish felt much quicker this time around and the admin interface is looking very “Enterprise Like”, very nice!. A quick deploy of Lucene and everything worked as expected, now for the hard part, design…
As for preempting change, well who could have missed the IBM/Solaris announcement last week. Solaris is finally getting the recognition it deserves and with IBM on board and Dell not far behind, we may now start to see the Small/Medium Business taking advantage of the Enterprise capabilities and World-Record performance.
With this information to hand I spent the weekend upgrading my Solaris Administrator Cert to include Sun Certified Network Administrator for Solaris 10. You need a good understanding of the IP stack to take this test, and in doing so you learn a lot about the differences between Solaris and other Unix variants.
If your still not convinced, try it for yourself, download your copy of Solaris 10 here, it’s free!.
August 12, 2007
Over the years I have managed to gain experience in many programming languages, and the question I get asked most often (and ask myself) is which language is the best?

Unfortunately there is no simple answer to that question, ok well I could say Java if I was to base my answer on my current mood
, but the truth is that we use programming languages to perform some function (hehe) and every language/framework/platform has pros and cons in it’s ability to perform that function.
The Internet blurred this question even more. With the web now a common platform for applications and every language having some kind of web framework or capability, which one should you use? As more and more VM’s or frameworks appear that can run apps written in many languages does it really matter what language you use or is it more a question of platform?. The world of software development is constantly changing and we are seeing a focus on design patterns and good practice that applies to all languages. This can only be a good thing!.
So how do you choose? These days I make an effort to learn every new language or variation, something that becomes easy to do as you understand basic programming principles. It only takes an hour or two of your time to pick up on a languages key features, then can you make an educated decision using a myriad of factors like Hardware and Operating System you will be using, upcoming language features and community support and most importantly, a good dose of grey matter.
If you are looking for the “right” language for your next idea i’d suggest you choose something you enjoy, after all that’s what it is all about right? You’ll find you are much more productive doing something you enjoy…
On that note I’ll return to my Groovy book, or should I read the Lua book instead?
August 05, 2007
Since writing the mmMySQL macro a few weeks ago I have been looking for a way to produce impressive Graphs that would compliment the textual output from the macro.
Creating good looking Graphs often means resorting to Matplotlib in Python, GD in Perl/PHP or RRDTool. The result of these tools is often a static image depicting an historical view of your data, something that does not lend well to a non-daemonized Wiki page. That got me thinking…..how could I embed a graph into the webpage and collect data at the same time?…..a Java Applet!
After a quick search for a MySQL Java Applet I came up short and began to wonder how easy it would be to write my own. MySQL already produce a connector for Java, Connector/J, so that’s the connectivity sorted, I just needed a graph library now…..enter JFreeChart.
Not necessarily lightweight at around 2Meg, the libraries make easy work of connecting to MySQL and populating live Graphs. In fact with today’s connectivity and the caching built into the JRE 1.6 the initial download is the only bottleneck, unless of course you are using a mobile device which may not have the capacity or even the capability.
Starting out in Eclipse with a simple Hello World applet I quickly got frustrated at the lack of GUI tools and the flaky applet viewer. A wander over to the Netbeans site soon got me back on track with the top notch Matisse GUI builder, add to that the wicked profiler (Nice Graphs) it didn’t take long to get a working live graph applet. In fact the hardest part in creating the concept was dealing with the JRE security model and having to manually sign the applet for it to work (the JRE protects the user and prevents any socket connections without user approval).

So I have a concept, something that works, a lot of potential, all I need to do now is pull out my Thinking in Java book and work on something more concrete. I’m thinking of creating wrapper classes that extend the JFreeChart classes to provide custom MySQL charts e.g. Traffic Chart and Connections Chart. If only I had more time….. 