Is it August already?

I’ve just realized that it has been 4 months, to the day, since I last posted to this blog. Now, some may put it down to laziness, lack of enthusiam, or the inability to muster together something interesting to talk about. However, in my case, it is none of the above. Back in March, my wife and I decided to join the league of homeowners. After a number of years of renting, we had decided that we’d funded enough of our landlords’ vacations, and it was time to gain some equity.

So, amongst looking at houses, sorting out mortgages, tracking down insurance, finding out about taxes, and the thousands of other things that happen during the house buying process, this poor blog went on the back-burner.

Aside from home life, things have been very busy at Envoy. We’re working on some very interesting stuff right now, and sometime in the near future I’ll go into more detail about the solutions we’re building.

So, I’m back in the saddle again. Some interesting things have happened over the past few months. On the Java side of things, Eclipse v3 was finally released. I’ve been using it for the past few weeks and have been very pleased. The CVS Integration is great, and makes handling configuration management tasks very easy – in fact, it’s even been known for an IntelliJ-using colleague of mine to ask me to do some CVS tasks through Eclipse!

The recent news about IBM contributing Cloudscape to the Apache group is also interesting. The choice of production-quality Open Source (non-GPL) embeddable Java databases has been rather limited. Projects looking for embedded database capabilities now have the additional choice of a proven technology.

Posted in Uncategorized | Comments Off on Is it August already?

Java, .exe and NSIS

A posting on Brian Duff’s blog about creating native Windows launcher executables for Java applications inspired me to write a short posting about my experience with the Nullsoft Scriptable Install System (NSIS).

I will not go into much detail about NSIS – I’ll leave the review for a future post. Suffice to say, it is an extremely flexible Windows installer builder, exposing a powerful scripting language. Not only does the functionality offered by this scripting language allow the creation of installers, it also allows the creation of custom Java application launchers.

For my nntp//rss project I created a custom Java launcher in NSIS, based upon the Jelude and Java Launcher scripts. The script searches for a local install of the Java Runtime Environment, and, if it finds one, uses it to start launch nntprss-start.jar. You can find the code in the nntp//rss CVS repository. The nice thing is that you can easily display a dialog box if the user does not have a JRE installed, and then open a browser to Sun’s Java Download page. Once you’ve created the launcher script, NSIS has a compiler that quickly turns the script into a small (~40K) executable.

NSIS is definitely worth checking out. I’ve also used it to build a .NET application installer that checks for the appropriate version of the .NET framework, and found it pretty easy to work with the scripting language. The product is supported by a great user community and, best of all, it’s completely open source. You can check out the project at http://nsis.sourceforge.net/

Posted in Java | 1 Comment

Write-Cache Enabled?

… otherwise known as when is a sync() not a sync()?

Recently I ran some performance tests on disk I/O, from both Java and C-based applications. The nature of the applications is such that they require transactional logging for reliability, and therefore need a guarantee that data has been written to disk. After running some simple write tests, I noticed an order of magnitude difference in performance between a couple of machines. This got me thinking about the impact of disk write synchronization, and what kind of differences would lead to this delta in performance.

Java makes explicit synching a relatively simple task. For the standard I/O library, you need to obtain a FileDescriptor instance, and from there you can invoke sync(). If you’re using NIO, subclasses of FileChannel and the MappedByteBuffer expose a force() method. These methods map down to a Operating System call (e.g. fsync()) which will force all outstanding I/O for the file to be written to disk.

Or so, based upon the documentation, you would be led to believe.

However, there’s one little thing missing from this description. It is the fact that modern hard drives commonly have an on-disk write cache. This helpful little cache, when enabled, provides a considerable performance gain for disk writes. It also helps most hard drive manufacturers boast some pretty impressive performance figures, but I’ll leave that point to another discussion. The downside to this cache is that in the case of a system failure (power, OS crash, etc), there’s a fair chance that there’ll be some data in the cache which is not on the disk. For a transaction processing system, this could be fatal – there’s a chance that data may have been lost. Now, I must mention that there are some drives that have battery-backed write cache, and higher end RAID controllers also have equivalent battery-backed stores.

Back to the performance tests: What I haven’t mentioned so far is that there is a good chance that the write cache has been enabled by default. How do you find out if it is enabled? On Windows, it is as simple as opening up Device Manager, drilling down to your Hard Drive, bringing up its properties and selecting the ‘Disk Properties’ tab. You should see a checkbox indicating whether the write cache is enabled. If it is not enabled, you’ll get the following helpful message when you enable it:

“By enabling write caching, file system corruption and/or data loss could occur if the machine experiences a power, device or system failure and cannot be shutdown properly.”

Some good advice from Microsoft!

If you’re running Linux, the hdparm utility allows to enable or disable write caching for IDE-based drives. Be very careful with hdparm, as it can do a lot of nasty stuff to your hard drive.

/sbin/hdparm -W 0 /dev/hda 0 Disable write caching
/sbin/hdparm -W 1 /dev/hda 1 Enable write caching

For my Linux tests, changing this setting instantly clarified the difference in performance. On one Linux system, configured with a 40GB 5400RPM IDE drive, the write cache had been enabled by default. This system had shown 10x the performance of the other system, which was configured with an 18GB 10000RPM SCSI drive. Disabling the write cache on the 40GB drive brought the performance back down below that of the 18GB drive, as expected.

Are there any alternatives to write caching? There’s a concept called Tagged Command Queuing, which uses intelligent algorithms to map disk commands to the rotational and seeking characteristics of the drive. This is commonly supported across SCSI drives, and was introduced as part of the ATA-4 IDE spec. It is also supported within newer Serial-ATA devices. This requires support from the disk I/O drivers, and I’ve yet to investigate implementations of this feature.

What’s the key take-away from this post? Well, writing reliable code is only half the challenge. The hardware platform and its constituent devices need to be carefully tuned to ensure that integrity is maintained and optimal reliability is achieved.

Check out the following links for more reading on this topic:

Microsoft Support How To: Manually Enable/Disable Disk Write Caching
Apple: Technote discussing Write Cache Flushing
EXT3 and disk write back cache
Experiments on Disk Write Back Caches
IDE write ordering
Questions regarding Journalling-FSes and w-cache recording

Posted in Technology | Comments Off on Write-Cache Enabled?

XDoclet and Commons Modeler

I’ve been working somewhat intensively with XDoclet over the past week, and, as it has proven to be quite a valuable tool, I thought I’d share my experience.

The specific reason for my foray into this particular technology was to automate the creation of JMX MBean descriptor metadata for Commons Modeler. Commons Modeler consumes an XML file describing the exposed operations and attributes of managed components. Having to maintain this XML document separately from the code is very burdensome and, of course, and easily lead to disconnects between the actual code and what is described within the XML doc.

Therefore, as a means to resolve this issue, I decided to look into XDoclet. I’d briefly investigated it in the past when doing some EJB development, but did not have time to pursue it further. So, this was an educational exercise that had long been overdue. XDoclet enables Attribute-Oriented Programming. Basically this means leveraging metadata within existing source files to automatically generate code. This metadata can either be the actual characteristics of Java classes and their intrinsic methods, parameters and attributes, or annotations in the form of JavaDoc tags. The beauty of it is that it allows you to specify and extract metadata from within the code, rather than having to be separately maintained.

XDoclet contains two core components. First, an optimized Java source parser, capable of exposing JavaDoc tags and class metadata through an object model. Second, a template engine, similar in ways to other popular Java-based template technology. XDoclet uses template (.xdt) files while iterating over Java source files in order to generate new content – in my case, the mbeans-descriptors.xml

Overall I found using XDoclet a positive experience. There’s an immediate ROI in the form of saved time and reduced scope for error just from not having to separately maintain metadata from the actual code. Creating a custom template was pretty easy, and even creating a custom tag handler was a relatively intuitive process, especially if you have previously written JSP custom tags. That said, I have to give thanks to the authors at Vecna for the Customizing XDoclet page, which provided a great jumpstart on the process.

If you’re looking for ways to exploit the metadata richness available from your Java application code – whether for automatically generating descriptors for JMX or EJB deployment, creating Struts configuration files, or producing other types of content – you should spend some time checking out XDoclet. They’re actually in the midst of working on version 2 (XDoclet v2 Wiki), which now uses QDox as the Java source parser engine and supports both Jelly and Velocity as templating engines.

XDoclet Project Home Page

Posted in Java | Comments Off on XDoclet and Commons Modeler

Skype Conferencing

Hot on the tails of SIPphone, Skype today announced the introduction of conferencing support into its P2P-based VoIP telephony platform. I heard about this from an article in The Register, and went straight to download the 0.97 release to try it out.

First impressions: the UI needs some work, but you’ll soon forget about that when you start a conference call. I tried a four-way call (Skype currently supports up to five conference participants), and had hardly any complaints about audio quality. Some minor jitter, but overall a very pleasant experience – certainly good enough to give traditional POTS-based conference providers a run for their money.

All I can now wonder is how long will it last before Skype starts turning some of their offerings into value-added services? Certainly the End User License Agreement has, since the outset, indicated that “certain functions in the Skype Software are only available to paid subscribers after a free trial period of the Skype Software and Services (the “Free Trial Period”) ends.

I’m very intrigued to see what will be Skype’s next steps…

Posted in VoIP | 1 Comment

XA in a Nutshell

Mike Spille recently posted a three-part series covering XA and the joys of 2 Phase Commit. He provides a thorough description of the topic, with some great examples and good coverage to areas such as failure scenarios and recovery techniques. The final post provides a great insight into various logging techniques that could be adopted by the Transaction Manager developer, as well as other implementation concerns. Well worth a read. Even if you’re not building transaction-oriented systems, or are depending on the transaction services of your Application Server, these posts will give you a good appreciation of what is going on behind the scenes.

XA Exposed Part I
XA Exposed Part II
XA Exposed Part III: The Implementor’s Notebook

Posted in Java | Comments Off on XA in a Nutshell

A reflection on quickSub

When I initially released quickSub, back in July of last year, there were to drivers behind the project:

1. Provide a mechanism by which to alleviate the end-user from the current issued faced by content providers for offering a consistent subscription interface

2. Generate sufficient stimulus within the development community to drive convergence on a standardized subscription model for newsreaders and aggregators.

Driver one seems to have been reasonably successful. quickSub is now in use at a number of major blog-related sites, and used across a range of individual blogs.

Driver two seems to still be a sticking point. In a way, the day quickSub has been successful on the second point is the day I lay the project to rest. In recent months there has been some activity focused around a ‘feed’ URI scheme. This has been adopted by a few of the more popular aggregators and newsreaders, and allows one-click subscription. However, it doesn’t really provide a solution for the web-based aggregators (Bloglines, myFeedster et. al.), for whom a URI scheme-based solution would require the deployment of a subscription agent on the end user’s machine.

Posted in quickSub | Comments Off on A reflection on quickSub

quickSub 0.3.2

… has just been released. Now featuring support for NetNewsWire.

Posted in quickSub | Comments Off on quickSub 0.3.2

Happy New Year

Wishing you all a safe, healthy and prosperous 2004!

Posted in Uncategorized | Comments Off on Happy New Year

SIPphone

I recently had my first SIPphone experience. For those unfamiliar with the service, SIPphone is Michael Robertson’s (mp3.com founder) new VoIP venture, firmly focused on providing Internet telephony to the masses. I found it a solution that, despite initial configuration issues, provides a good low-cost entry to the world of internet-based telephony.

SIPphone resells BudgeTone phones from Grandstream Networks, and host the necessary proxy and directory servers that provide the core of their VoIP telephony service.

SIPphone pitch their offering as a ‘just plug in’ experience – however my experience, within a corporate network environment, was a little more complicated. Given the average uPNP-enabled router commonly found in home and small business networks, I would foresee the process being a little easier in those environments than what I experienced.
The phone was, initially, behind a firewall. This particular firewall implements some pretty restrictive rules and, unsurprisingly, the SIPphone did not want to co-operate. It would obtain an IP address from the local DHCP server, but would not allow any outbound or inbound calls. We did not want to relax the rules for the firewall, so we decided to continue the test by allocating the phone a public static IP address. Assigning a static IP address requires you to program the phone – either through using the keypad, or through accessing the administration interface offered up by its built-in Web server. For anyone having difficultly with either of the interfaces, I’d suggest downloading a copy of the user manual from Grandstream. Also, SIPphone hosts an active community forum as part of its support offerings.

Once the phone was reconfigured with a static IP, along with the necessary DNS server information, we were up and running. However, before running a voice test, I had to unplug the phone and move it to a different location. Upon restoring power, I noticed that my settings had been reset to their defaults. This was a little confusing, as I had not forced a reset of the configuration parameters. It materializes that the phone was contacting a SIPphone-hosted TFTP server and downloading a configuration update that was overwriting my IP settings. It seems like the centralized provisioning and management service for these phones does not allow a local override of the IP settings. When the phone downloads configuration from the TFTP server, any local updates to the IP configuration are overridden. I’m sure SIPphone could set our IP configuration within the phone’s file on their TFTP server, but I’d like to have the flexibility to make these changes locally. I’m sure their support team has had to field a few calls regarding this problem. In the end, set the TFTP address to 0.0.0.0 within the phone’s configuration, disabling the remote configuration update.

Once the IP issues had been resolved, I finally got a chance to make some calls. SIPphone has some carrier agreements in place that allow you to dial 1-800 calls from the phone. This is great for access calling card services, and I could see this being a real cost-saver to people working overseas who need to contact people not connected to the VoIP network. SIPphone also has routing agreements with other VoIP initiatives, such as Pulver’s Free World Dialup.

Now, on to the phone itself. The BudgeTone phones are cost-effective VoIP terminals. They’re comparable to a $20-$30 POTS telephone in terms of build quality, so at $60 it is more than reasonable for a VoIP equipped phone. As far as sound quality goes, the clarity was good, with little or no jitter. There was some minor echo, although I think this is more due to the design of the phone rather than the underlying connectivity. One of the test calls was to a person also using a BudgeTone phone; the call had noticeable echo when the remote user enabled the speakerphone. I tried both national (USA) and international calls with a good level of success.

My concerns? Not too many. The hardware is flexible enough that if you had to switch from one provider (SIPphone) to another (e.g. FWD), it would require a simple reconfiguration. My only real concern is the number allocation scheme chosen by SIPphone. They’ve decided to issue numbers within the 747 area code of the North American Numbering Plan. NANPA currently indicates that this area code is geographically assigned, but not in use. At some point in the future numbers within the area code could be assigned to an entity not associated with SIPphone, potentially affecting existing SIPphone users.

All in all, SIPphone provided a good telephony experience. I’ve just noticed from the SIPphone site that they now offer free voicemail, which brings them into line with the free service offered by FWD. The cost of the hardware is very competitive, and they’ve recently announced a product that’ll let you VoIP-enable an existing phone – great for adding a cordless phone to the network. VoIP offers a number of advantages, including, of course, the low (bandwidth-dervied) call cost characteristic. SIPphone provides a low-cost way to start experiencing the benefits of Internet telephony.

Posted in VoIP | 2 Comments