Search This Blog

Tuesday, March 23, 2010

Release It! - Introduction

The primary notion that software developers have to embrace is that architectural and design decisions are really financial decisions.  Any time a system is in an unusable state usually means lost revenue.  Software spends most of its life operating in a data center and not in development, so it makes sense to optimize for operations and not development.  Developers are often taught what a system should do, such as make sure the SSN is properly formatted, and not what a system should not do, like running out of memory on constant basis forcing a nightly reboot of the servers.  Most software is designed to pass QA's tests, not survive in the wild for the next 10 years, which often leads to financial impacts. 

The manufacturing domain has the notion of design for manufacturability (DFM) which is the idea of designing products that can be manufactured at low cost with high quality.  Software's idea of DFM might be called design for production.

Decisions made early in a system's development have the most impact on availability, capacity and flexibility.  Unfortunately, the early decisions are often the least informed.  The goal is to make software that is fast and cheap to build, good for users and cheap to operate.  In order to accomplish this, you need to use improved architectural and design techniques.   These techniques need to account for the fact that the scope of software has changed over the years, 25,000 concurrent users and 99.99% uptime on commodity hardware,  instead of a couple hundred users running on mainframes.

Architectures can be split into two groups: Ivory Tower or Pragmatic.  Ivory Tower architectures focus on the end state of the system and are less worried about the messy details.  Ivory Tower architects tend not to listen to coders and probably don't listen to users either.  Ivory Tower architects tend to issue "one size fits all" edicts, such as "you should always code the presentation tier using JSF" or "EJBs should always be used for business logic".  

Pragmatic architectures tend to use lower level abstractions and focus on the dynamic nature of the system.  "How can we update the system without forcing a reboot?" or "How can we make sure the system runs in a lower bandwidth environment?"

Many systems are designed in an artificially clean environment and don't account for real-world settings.  Designers need to reorient their thinking: release 1.0 is not the end of the project but, instead, is the beginning of the software's long life.
   

Monday, March 22, 2010

Release It! - Preface

Michael T. Nygard is the author of Release It!: Design and Deploy Production-Ready Software which looks to be an interesting software book.  As I read it, I plan to summarize my understanding of each chapter in the hopes that I'll better understand and retain the information.  This post covers the first chapter.

The preface gives us a "lay of the land" and sets expectations.   The book is aimed at anyone creating an enterprise-class application.  What is an enterprise-class application?  Any application where if it goes down the company loses money.  I suspect that Twitter, Facebook and many parts of Google would be considered enterprise-class.  If GMail stops working then Google can't serve its ads to the millions of people who use it.  Probably not good.  If you think about your own application, do you wish to avoid those late night support calls?  Is it your hope that the operations people can properly deploy your application into their data centers and keep it tuned and humming?  If any of these apply to your application, perhaps this book can help you.  The author hopes that the reader will come to the realization that no matter how much you plan, bad things will happen to your software when released into the wild and you need to account for those things.


 The book is broken up into four sections with each section prefaced with a real-world case study.  The names in the studies have been changed to protect the innocent but the money lost and the pain that was felt remain.


Section one revolves around keeping the system alive.  Nobody is going to worry about paying for new features in your next release if they have to reboot the system every day just to keep it breathing.  The system must be stable.


Section two addresses capacity.  What does capacity mean?  How can it be optimized over time?  What are some design patterns and anti-patterns that affect capacity?


Section three discusses how to make your system more easily deployable into the data center.  Hardware, software and networking has changed over the years and we need to be aware of those changes in order to make deployment more palatable to the operations folk.


Finally, section four is about obtaining intel from your running system.  How do you gather relevant data?  What do you do with that data?

Saturday, March 13, 2010

How do I upgrade the RAM in my Acer Aspire Revo?

I finally got around to throwing in another 1GB stick of RAM into the machine I've be using as my media center.  The scariest part was trying to figure out how to crack open the case without breaking anything.  Luckily, netbooked on YouTube has posted a video on how to open the thing up.  Once you know the secret, it is pretty simple.  I cracked open the case to see exactly what type of RAM was already installed and then ordered a similar stick from Crucial.  The Revo can take up to 4 GB of RAM but that means throwing away the existing stick and spending more money than I wanted.  Adding the 1GB stick only cost me $25 USD so despite the fact that some people are of the opinion that the extra RAM is a waste of money, I went ahead and did it anyway.  With the additional RAM I was able to dedicate 512 MB to the video card.  I haven't played with the system enough to know if video performance has improved any but I'll report any findings I may have in a future post.  All in all, the upgrade was inexpensive and painless.

Friday, March 12, 2010

Is Adobe Flash as evil as Apple claims?

I was listening to This Week in Android and they talked about a version of Android that is in development that runs, wait for it, Adobe Flash.  The application they've been showcasing is Farmville, which made me chuckle a bit.  Is Farmville a harmless time waster or digital crack that has the potential to turn the entire world into obsessed farming zombies?  I digress.  The interesting point in the discussion is that Flash did not consume resources, including battery life, nearly as much as Apple would have you believe.  It could be that the newer handsets have better chipsets -- they are putting 1Ghz chips into phones now that are capable of running Quake 3-- or that Android manages resources better than the iPhone OS.  In short, we should start to see if Adobe Flash is the mobil vampire that Apple claims it is.  My money is that it isn't.

Monday, March 8, 2010

Why should Apple tell me what I can and cannot buy?

I don't develop mobile applications, but if I were I'd spend some serious time thinking before committing to the iPhone platform.  I know Apple is the market leader and their stuff, for the most part, just works but I'm disliking Apple more and more each day.  Today, I learned that they are pulling network scanning applications from the app store.   Last month Apple pulled the boobie apps from the store.  Parents don't want their children downloading software with half-naked women onto their iPods, which I completely understand.  Today, they removed a type of tool that I personally use -- something that can detect if there is an open wifi hotspot in the area.  I'm sure Apple will issue a press release explaining why they did it and will apologize to any developers that may have been affected but I'm no longer interested in hearing Apple's rhetoric.  As a developer, you have to pony up for an Apple laptop if you are going to develop on their platform -- period.  How would you feel if you bought one of their expensive computers just so you can create your own application in the hopes that you might make a few bucks and Apple deems your app as inappropriate for their platform?  No warning, no guidelines, no apologies -- your application no longer welcome in the app store.  As a developer I would be furious.  As a consumer, I'm not too happy either.  Apple is now telling me what I can and cannot purchase.  I don't like the Big Brother aspect of the company and I'm very likely to buy an Android phone when I finally decide to buy a smart phone.  I'm hoping that Android continuously eats away at Apple's market share and forces them to be a little less controlling and let consumers may their own purchasing decisions.  Thanks for letting blow off a little steam.  I feel better now.

Saturday, March 6, 2010

What does "Hello World" look like in Google App Engine?

Google's App Engine is an platform as a service cloud offering that is free for most uses.  The documentation is pretty clear but I found that some of the steps did not work out of the box for me.  For that reason, I'm going to take some time and document the steps I used to get a "Hello World" web application pushed out into Google's cloud.

Context: all I want to do for now is to be able to build and deploy the simplest web application possible.  I'm using version 1.3.1 of the App Engine SDK, JDK 1.6.0_17,  Ant 1.7.1, IntelliJ IDEA 9.0.1 Ultimate Edition and Ubuntu Linux 9.10.

Step 1: get your self a Google App Engine (GAE) account and an application id.  These steps are nicely documented on the Google App Engine Experiments blog and I suggest you see his directions for getting yourself set up.

Step 2: get a project template in place.  Luckily, the GAE SDK provides a nice template complete with "Hello World" code.  Copy the contents of appengine-java-sdk-1.3.1/demos/new_project_template to your working directory. 

Step 3: edit the build.xml file so that it points to your installation of the GAE SDK.  The Ant property you are looking for is appengine.sdk.

Step 4: edit src/WEB-INF/appengine-web.xml so that that the application tag contains your application id.  If you miss this step, your application will not deploy.

Step 5:  build the project.  All you do is type ant and wait a couple seconds.  You'll see messages about classes being enhanced with DataNucleus, which is framework that sits in front of various persistence engines.  I'm guessing GAE uses this to more easily support JPA and JDO.

Step 6: run a quick test of the web app.  To do this, we'll launch the bundled web container via ant runserver.  If everything is working, you should be able to point your browser at http://localhost:8080/ and see a nice little "Hello App Engine" message.  When you are done, ctrl-c the server to shut it down (I haven't figured out a nice way to shut it down yet).

Step 7: deploy the WAR into the cloud.  The Ant file has an update target but that failed for me.  ant update resulted in "Your authentication credentials can't be found and may have expired. Please run appcfg directly from the command line to re-establish your credentials."  I found a thread that seems to indicate that the cookie used to store credential expires after 24 hours.  This is what I did to make things work: /opt/appengine-java-sdk-1.3.1/bin/appcfg.sh update www followed by ant update the rest of the day.  To verify that my app was uploaded I visited http://myappid.appspot.com/ and was pleased to see the app running as expected.  IntelliJ IDEA has support for GAE and I verified that I can use that as well to upload the application.

It is fairly obvious that the GAE build system expects a certain directory structure layout and performs byte code manipulations -- it isn't just a simple matter of compiling .java files and packaging them up into a WAR file.  To help me learn how the build system works, I plan on porting the build to use Gradle.  I also have a Spring MVC application based on Spring 3.0.0 that I'm going to port over to GAE to learn about the restrictions GAE imposes on your application.  Expect posts on those two topics in the not so distant future.

Friday, March 5, 2010

How do I automount my virtual box shared folder in an Ubuntu guest?

I'm a big fan of VirtualBox and I run a whole bunch of virtual machines based on Ubuntu.  One of vbox's features is to allow the virtual machine access to the host's file system.  I always forget how to do it and have to troll the web for a solution.  I've done this enough times that I figured I should save myself some time and outline the steps here:
  • mkdir share
  • sudo mount -t vboxsf -o uid=1000,gid=1000 sharename mountpoint The user id and group id should be adjusted to match your account's numbers.
  • put into /etc/rc.local this line:  mount -t vboxsf -o uid=1000,gid=1000 .  This will remount the share during boot up. Notice how we didn't have to specify sudo in this case.
Replaced the user and group ids to match your account's ids. Many thanks to this blog post which gave me most of the information I needed.