Solid State Drives – Lean & Mean

February 20th, 2010 § 0

Crucial 256GB SSD For a while I have been harping on about how much difference a speedy hard drive can make to a developer’s PC.  So, I took my own advice, and recently coughed up the cash for a new Crucial 2.5 inch 256GB solid state drive.  You could argue that doing this was even going two / three times better than my previously recommended solution of a Western Digital Velociraptor (10,000rpm).  The performance difference is astounding!

Here’s the obligatory Windows Experience Index (WEI): 7.3 for the drive (the highest rated item on my Laptop). Crucial WEIPreviously, the one of the fastest available magnetic drives for laptops (2.5 inch form factor) was the Western Digital Scorpio Black, 7200rpm drive, which previously scored 5.7 in the Windows Experience Index on my laptop.  Admittedly the WEI isn’t a very scientific benchmark, but it is based on an all-round measurement (both sequential & random read/write). The Crucial SSD is, in theory, around 3-times faster at average sequential reads than the Scorpio Black (the Crucial reads at between 230 MB/sec and 250 MB/sec, whereas the Scorpio Black reads at between 63 MB/sec and 76 MB/sec).  Most people’s typical usage is not based on one extreme or the other between sequential or random IO though.  Between the operating system and our applications, we do a little of everything.

Subjective review

While having specific performance measurements might help prove one drive is better than another, most of us will probably judge how much faster one drive “feels” in our system.  For example, I’ve noticed that my laptop tends not to wait on disk IO anymore and if my processor was faster, I might be feeling the benefit of my new Crucial SSD even more than I am now, and its already made a big difference to me.  I don’t play games on this laptop, so if anything feels like a bottleneck, its the Core 2 Duo 2.5Ghz processor.  Now that data comes off the disk so fast, single threaded applications seem to end up waiting for the CPU.

Disklight.NET screenshotI’ve also always used my Disklight.NET system-tray application on all my PC’s, to keep an eye on when my hard drive is holding up my PC.  At work, my PC is under my desk, so when its being slow or unresponsive, it’s nice to have something to tell me when it’s waiting on disk IO.  Most of the time, I hardly ever saw this application show more than 25 MB/sec on any of my machines with magnetic-platter hard disks.  On the right is a screenshot of the readings when starting up a Windows XP virtual machine on my laptop (by the way, the XP virtual machine boots in about 9 seconds).  I’ve even seen “Read:” values as high as 168 MB/sec when running backup software that scans my music library.

Power consumption & other benefits

The other main plus sides for solid state drives:

  • typically consume about 0.5W of power, whereas most magnetic drives will consume anywhere from 2W to 15W.  Therefore, they will help extend battery life in laptops.
  • do not get hot
  • no noise
  • no moving parts, therefore failure rates are lower
  • less risk from physical impact & movement because there are no moving parts
  • lighter (reduces weight in laptops)

Book review: C# in Depth

December 29th, 2009 § 0

image Its been a while since I’ve read a book that’s almost purely about a programming language and C# in Depth does not disappoint.  Even though I’ve recently done a couple of Microsoft certification exams and read the relevant preparation materials, those were more about the .NET framework and the .NET libraries more than any particular programming language.  This book is all C# though, cover to cover, and Jon Skeet lives up to the hype…

Fear not! There is none of the boring “Chapter 1: What is a class” type of material here.  It is assumed that you are already familiar with programming in C# and the material serves more to highlight how the language has evolved from C# 1.1, through C# 2.0 to C# 3.0 and explains how the language version numbers are not the same as the framework version numbers.  The book dives right into a preview of the most modern C# trends, before going back to explain how it all got to be that way.  Some of it was really mind-blowing stuff to me, and it really shouldn’t have been because that was only the C# 2.0 parts. There is so much potential in the C# 2.0 language and .NET 2.0 framework and they are really under-utilised, possibly due to being overshadowed by the emergence of .NET 3.0 and quickly followed by .NET 3.5 with LINQ.

For those LINQ enthusiasts out there, you really should read this book if you want to understand the fundamentals of LINQ and where it evolved from (a LOT of it is based in C# 2.0 generics and anonymous methods/delegates).  If you’re like most of us developers, you’re probably only just moving on to using .NET 3.5 at work and possibly don’t even realise some of the power you’ve been missing out on.  Having worked on several corporate projects in 2009, it appears that many larger organisations are still sticking using .NET Framework 2.0. By the way, you can get away with using a lot of the C# 3.0 features on the .NET framework 2.0, since many of the additions are language based or are based on compiler “tricks”. If ever there was a code magician / illusionist – Jon Skeet could be him!

Manning (publishers) are releasing an Early Access Preview of the second edition of this book in electronic form now (the soft-cover is due Summer 2010, according to the Manning C# in Depth website).  I’d still recommend the first edition, having most of the same material except for the last few chapters, and its in paperback form so you can read on the run

Developers and DBA’s

October 20th, 2009 § 0

How well do you know your database server?  And no!, I’m not talking about favourite colours, favourite things to do, or other first date questions here… I mean how well do you know the technology behind your database server and what makes it tick?  Many developers out there focus on the web and application layers and only look to the database layer as a persistence medium.  At least until they need to get a LOT of data in or out in a hurry that is…

More often than not, small companies can’t afford to have a dedicated database administrator (DBA). So it often falls to the technical operations guy/gal and the developers to manage the company database(s).  I’ve been in the position of one of those developers, where looking after databases was more of an add-on task than any official duty, and that experience has taught me that a good DBA is worth their weight in gold.

Every developer should get to know at least one database technology intimately because your database can do a lot more for you than just persist data.  Get to know the engine of your database server: how it works; how it makes decisions on query plans; different algorithms for joining and grouping data and how it all evolved.

As an example, have you ever written a program that processes data on-the-fly and batching bulk-inserts?  Assuming all that bulk-inserted data goes into a set of tables that will later be processed for rollups, you’ll have some indexes on those tables, so that the rollups run faster… right?  Well those indexes will have a dramatic performance impact on your bulk-insert operation… I’ve learned that when processing large amounts of data for crunching rollups later on… only create the indexes just before you need them and then drop the indexes again afterwards.  The reason is that the bulk-insert is probably going to be the long-running operation and writing to a table with 3 indexes across columns can take 2-3 times longer than writing to a table with no indexes.

My database of preference is SQL Server because I’ve worked with Microsoft technologies all my working life and found the tool-sets generally hit the mark on best compromise between functionality and easy learning curve.  SQL Server 2000 was the top dog around the time I was finding my feet and an invaluable resource was Kalen Delaney’s book Inside Microsoft SQL Server 2000.  I have *huge* respect for the team that created one of the first databases that was capable of running on desktop computer hardware, whilst having a .dll/.exe footprint in the order of 10’s of Megabytes and, to this day, is capable of managing databases in the order of Terabytes!