Why We Hate Stored Procedures

May 19th, 2010 by Fish

Okay we really don’t hate stored procedures and have actually used them  extensively on past projects but we so often tell people to remove them  that we’ve been accused of hating them. Here’s the deal, as we mentioned  in a past post, two scalability best practices are 1) put as little  business logic in the database layer as possible and 2) use as few  features of the RDBMS as possible. Both of these are violated by the use  of stored procedures, if they contain any business logic. If the stored  procedures are simply instantiations of SQL data statements then you’re  probably okay.

Expanding on the two reasons for avoiding stored procedures mentioned  above, we’ll first discuss why business logic doesn’t belong in the  database layer. The biggest reason for this is that the database server  is likely the most expensive server in your system and the most  difficult to scale. Adding more computational processing on it makes it  the most expensive layer to perform these and requires you to upgrade  the hardware or split the database sooner than necessary. It is much  cheaper from a cost per computation perspective to have this business  logic processed on a much cheaper application server.

Avoiding the use of RDBMS features is important when it comes to  remaining vendor agnostic and getting the best possible price during  negotiations. Using features specific to certain database vendors locks  you in to that vendor. While you may never want to switch database  vendors it does reduce your negotiating strength. When you are locked in  to a vendor your best alternative to a negotiated agreement, BATNA, is  not good and their sales staff knows this.

While we don’t hate stored procedures we do seem them as an impediment  to scaling. If you already have them in place you may be hesitant to  spend the money moving them into the application logic. One method of  doing so at minimal incremental cost is to start today with the policy  that if any engineer touches a stored procedure they must move it. This  way the cost is small, because you’re already touching the code, and  spread out because it’s not done all at once.

Rework – Book Review

May 17th, 2010 by Wabb

I heard that the guys at 37signals were Tim Ferriss fans, and as a result I was a bit leery of their book ReWork.   I was surprised by how much I enjoyed it.  The book is full of folksy, practical wisdom for small companies and small group leadership.  Much of it is extensible to larger product teams.  I loved the book despite a few claims that are just not true in my mind.

I think there are three great themes throughout the book that make it a must read for executives, product managers, managers and engineers.  The first is that you can always do less.  We all simply try to build too much worthless crap into our products.  As a result costs go up, deadlines are missed, morale tanks and budgets are blown.  Striving to do less is a great idea when developing products.  Small, evolutionary changes beat the big bang in our experience as well.

The second great point is that one should grow profitably and try to avoid taking outside money.  Being the master of your own destiny and beholden to no one except your customer makes work so much more enjoyable than trying to please customers and shareholders.  Cash is king – just make money!  Be profitable.  Don’t measure yourself by employees – measure yourself by profits.

Their third point is the notion of work life balance.  Sleep is essential to creativity and productivity.  Burnout is the enemy of companies, culture and people.  The new world order includes working across geographies, from home, and from different hours that fit the needs of great employees.  I couldn’t agree more.

While I loved the book and could go on about some of their other good points, I believe it’s also important to address a few flaws.  The authors say that learning from mistakes is overrated and cite a HBS/HBR article indicating that successful entrepreneurs have a higher success rate on successive tries at new companies than entrepreneurs who have failed.  I don’t doubt this statistic, but as it applies to learning from failures it does not pass the nonspuriousness test; there are other potential and even more plausible explanations for this statistic.  Success begets success, attracts other people who are likely to be successful, attracts better funding and advice, etc.  Academic research shows that we do in fact learn from failures – as long as they are the “right type” of failures and as long as we process them correctly.  Whether you learn or not is an individual characteristic.  I doubt this is a Stanford vs. Harvard issue – we all know we can find information that backs our points if we look hard enough.  The point is that you can learn a lot from failure – both your failures and the failures of others.

I also do not believe that their wisdom in its totality is extensible to all businesses.  Generally this is true of any “wisdom” – but they would seem to believe that what makes them successful as a business will make everyone successful.  Quite honestly, they are successful at least partially because they are in a market segment that is underserved and simply unattractive to many other companies.  There’s nothing wrong with that – in fact it’s a great business opportunity and I would love to have their business.  But some companies need capital (especially hardware companies) and need larger numbers of employees to capitalize on market opportunities that might otherwise be taken by competitors.  Can these companies be even more successful by employing the 37signals approach?  I believe so.   But the competitive dynamics are different and the 37signals approach needs to be tweeked as a result.

Lastly, I simply do not agree with their view on workaholics.  The authors seem to claim that workaholics are intellectually lazy.  I haven’t found this to be true in all or even most cases.  Some of the smartest people I know work quite a bit and they aren’t intellectually lazy at all.  Some people (like me) who aren’t so smart use commitment to make up for their lack of IQ.  I do agree that we shouldn’t expect people to be workaholics, but to say that they are intellectually lazy seems a bit overboard to me.  No doubt that the authors have had bad experiences with people who are overly committed – or perhaps they simply haven’t seen people who work both hard and smart.

In summary – this is a great and easy book to read.

How Do You Use The Art of Scalability?

May 14th, 2010 by Fish

We’ve heard some very nice comments about how people have used The Art of Scalability such as to convince their teams on the proper approach to scale their system and to share leadership and management ideas with managers. No one has admitted to using it as a door stop…yet at least. We did have someone tell us that they read a page each night before falling to sleep but they didn’t explain whether that was causal or just correlated.

We thought we’d also share a picture of a well used version of the book.

Tagged copy of The Art of Scalability
One of my favorite comments was from an individual to whom we sent a copy. He responded that he now had two copies on his bookshelf, one active and the other a hot fail over.  We love the comments, please keep them coming.

Matching Data Value and Data Storage Costs

May 12th, 2010 by Wabb

We often consult with clients who have storage costs overruns.  These aren’t just the actual cost of storage, which as we all know have been dropping fairly drastically.  Rather, as we outline in our book, it’s all the other costs of storage:  space for the storage, power for the storage, the cost to traverse huge indices and the resulting response time, etc.  Most often these clients have a single solution for their storage needs.  Regardless of the actual value of the data being stored to the business, it goes into a cookie cutter high speed SAN; easy to access – overall costly to maintain on a relative basis.

Our solution to this is simple:  Not all data is created equal.  No, we aren’t going to tell you to “enslave it” but we are going to violate certain constitutional rights and tell you that you should absolutely “profile” it.  TSA be damned.  We are going to borrow a technique from our marketing friends and apply something known as an RFM cube to the data.  RFM stands for recency, frequency and monetization.  Marketing gurus use this technique to make recommendations to people or send special offers to keep high value customers happy or to “re-activate” those who haven’t been active recently.

“Recency” accounts for how recently the data item in question has been accessed.  This might be a file in your storage system or rows within a database.  Frequency speaks to how frequently the data is accessed.  Monetization is the value that specific piece of data has to your business in general.  The three of them help us calculate overall business value and access speeds.  By matching the type of storage to the value of the data in an RFM-like approach, we might have a cube that has very high cost storage mapped to high value data in the upper right and an approach to delete and/or archive data in the bottom left:

The product of our RFM analysis might yield a score for the value of the data overall.  Maybe it’s as simple as a product or maybe you’ll add some magic of your own.  If we plot this on a cost and value curve, we can start matching storage needs to it.  Low value data goes away or goes on low cost systems with slow access times.  If you need to access it, you can always do it offline and email the report or whatever to the requester.  High value systems might go on very fast but relatively costly SSDs or some storage area network equivalent.  We’ve made some mappings below, though the escalation isn’t meant to represent today’s market prices:

Now go save your company some cash!

iPad or Kindle?

May 10th, 2010 by Wabb

I’ve been a proud owner of the Kindle DX for about 6 months and the iPad 3G since it’s launch date (see Fish’s review of the iPad here).   Both of these platforms are excellent examples of the advances we can make in usability and interface design when we focus devices on a narrow set of tasks.  We’ve labelled this trend “purpose built design” and these two devices are excellent examples of what we can accomplish in interfaces and usability when we limit the functionality of a device.

Bottom line up front:  If you are just looking for a book reader, you should consider the Kindle or the Kindle DX.  The Kindle has significantly greater battery life (if you turn off the 3G radio when it is not needed) than the iPad; I charge mine about once every 10 days.   The Kindle’s very narrow focus on being an excellent reading interface makes it very simple to use.  Page forward, page back, menu and home buttons get you 90% of what you need.  A built in dictionary helps you look up words and at least on the DX pdfs are easy to read and display. The e-ink technology and no back lighting eliminates eye strain and allows the device to be read easy in direct sunlight.  More importantly, most airlines with which I fly do not make you turn it off on taxiing.  On that note – turning it off does absolutely nothing as the device displays random cover art – take heed airlines – stop asking people to turn off Kindles.  I take novels, my dissertation research papers, client research and my non-fiction research.  While Amazon is trying to extend the functionality of their ereader into general purpose use like interacting with social networking sites, it simply wasn’t meant to do this and the interface is clumsy.  The strength of the interface is its purpose built focus on reading, but this focus limits its abilities to be useful as anything but a reading platform.  3G operation is “free” with no monthly charge for downloading books and you can shop on your computer or the Kindle and get books downloaded to your Kindle in about a minute.

If you want a general purpose media consumption device including movies, books, music, browsing and light computing (word processing), then the iPad wins hands down.  The battery life is enough to last a standard business day and is therefore enough for most domestic or short international flights.  The interface is intuitive and easy to use and the relationship with Netflix rocks.  For light usage, note taking, etc the iPad is a great alternative to a lightweight notebook.  By downloading the Kindle reading application, you can have access to the large library of Kindle books though the device is more power hungry than the Kindle.  3G coverage will cost you $30/month for unlimited usage which is a steal compared to laptop 3G data plans, but is nevertheless expensive compared to Kindle’s free coverage for book downloads.   Airlines will no doubt make you turn your iPad off during takeoffs and landings.  Because the iPad has less of a laser focus on a single interaction like reading, the user interface is a bit more difficult than that of the Kindle.  That said, the folks at Apple are world class at interface design and the touchscreen and limited functionality of the iPad relative to a computer mean that the interface is more intuitive than the typical keyboard and mouse setup.  iPhone users will be up and running in seconds.

If you are only looking for a way to transport books and get easy access to them, get a Kindle.  If you want a computer replacement, or a general purpose media consumption system then choose the iPad.