Differences cause problems

This is obvious, but differences between environments cause problems. You can expect bugs to cluster around them.

Case in point: on my current project, we use a hand-maintained schema for production (and manual testing), but our unit tests go against one that is generated from the Hibernate schema. Naturally, we are seeing bugs related to differences between these, the most recent one being about the width of particular columns.

Any time you accept a difference between your development environment and your production environment, you are introducing a vector for bugs. If you use a cluster in prod, but not in development, expect bugs about clustering. If you use a different database (or schema ;), expect database related bugs. If you typically run your production app for a month without restarting, but your development environment only goes for an hour, expect bugs related to endurance.

This is not to say that having differences isn’t the right thing to do. It can be, especially if the difference is expensive to fix (e.g. giving each developer a $250,000 server cluster is probably not viable). However, you need to take care around it.

Differences in environments is one of the best arguments for a build machine (particularly an automated one). It is generally viable to have at least one environment that is “prod like”; use this for your automated tests.

Author: Robert Watkins

My name is Robert Watkins. I am a software developer and have been for over 20 years now. I currently work for people, but my opinions here are in no way endorsed by them (which is cool; their opinions aren’t endorsed by me either). My main professional interests are in Java development, using Agile methods, with a historical focus on building web based applications. I’m also a Mac-fan and love my iPhone, which I’m currently learning how to code for. I live and work in Brisbane, Australia, but I grew up in the Northern Territory, and still find Brisbane too cold (after 22 years here). I’m married, with two children and one cat. My politics are socialist in tendency, my religious affiliation is atheist (aka “none of the above”), my attitude is condescending and my moral standing is lying down.

4 thoughts on “Differences cause problems”

  1. A build server may not be the best for trying to catch those “long running” bugs – but I guess there is no way to do that easily – unless you have run a release candidate for a month prior to going to prod (not sure if that is always feasable).

  2. You might be surprised, Michael… a build server can do 8 hour endurance runs over night, and 60 hour runs over the weekend. This should suffice to show up anything obvious.

    No substitute for a month of endurance testing, of course, but still better than nothing.

  3. I was just thinking about this exact scenario a few days ago. We’re about to deploy a big update and I’m not sure our production database is identical to our test database. It seems like it wouldn’t be that hard to write a tool that compared two databases and produced a diff report, showing exactly which tables, views, columns, keys are different between the two.

  4. Yes Robert, you could actually give it a hammering in a short amount of time – in most cases that is probably “enough” diligence (I guess you can aim to process the same number of transactions).

    I once had a problem that took about 1 to 2 months of heavy prod use to surface. Turned out it was a dodgy SMTP server that would go into “drip feed” mode and eat up my web threads (so I moved to JMS, and also overwrode the default infinite timeout on the JavaMail API !! whoops).

    And, lets be honest, who hasn’t at one time or another done some “clever” multithreaded code, and got tripped up by a deadlock that only happens on a 4 way prod machine (when you only have a 2 way or a single processor dev machine !!). I stick my hand up. I ignored all the advice – threads are too easy in java (and too tempting), and too easy to get wrong (note: this was in early J2EE days, and I had no other options at the time).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: