On Counting Things

Musings on inventory tracking behind the scenes after another annual SparkFun Inventory Day is in the books.

Here at SparkFun we have a big warehouse filled with stuff. A lot of that stuff you see here on SparkFun.com for sale. Most things we only have a few of or a few hundred of. The most of one thing we ever had in stock that was for sale was our 6 Pin Arduino Stackable Header. While today we have just under 10,000 in stock, back in June of 2010 we had over 78,000 readily available. That’s a lot of headers!

They're small. And we have many of them.

They're small. And we have many of them.

We don’t sell everything we stock. Many of the widgets available on SparkFun.com are built on our production floor and many of them use parts that we don’t sell. Here the parts get smaller and the numbers get bigger. The champion for most-used product here is the original 0.1μF 25V capacitor. While today we have about 200,000 of these in the building we once had almost half a million (again back in 2010 - an interesting year for our stock numbers). It’s a versatile little cap that appears on over 200 of our different products in various quantities including 22 on every Quadstepper Motor Driver Board. We also sell them in strips of 50 but that doesn’t really count.

Can you count all 22 0.1μF caps on this board?

Can you count all 22 0.1μF caps on this board?

All told, there are about six million things in our warehouse spread across about 4,000 SKUs (stock keeping units, or distinct items). We have a big database for keeping track of these things and we rely on the database and reality agreeing. If they don’t then we can’t build things or ship orders the way we would expect to. So, every so often, we shut down everything and count all the things.

Some of you may already be familiar with these Inventory Days. We typically close up shop for the day so orders don’t ship and widgets don’t get built and the stock generally sits still so it can be counted. We do inventory days once a year and last Friday was our most recent. While some you were patiently waiting for us to finish up so we could ship orders once more we were busy as beavers as evidenced in this time lapse video:

ReplaceMeOpen

ReplaceMeClose

It’s a lot of work but it gets easier every time as we learn and adapt. Some of the first inventory days, when our warehouse did not contain the millions of dollars worth of hardware it does now, were comparatively disastrous. Among the worst I can recall was uploading a CSV file with manually typed (read: error-laden) stock values into a script that crunched over the live database to update the numbers. Jordan, our now Director of Inventory, would probably cite the time we hired a third party company to come count things for us as among the worst blunders. Turns out they hadn’t much experience counting small electronic bits and bobs and made some very bad assumptions.

But why put ourselves through all this pain? Well, we want our database to remain close to reality for obvious reasons. After all, any database is a model of supposed reality, not the other way around. If the two disagree it’s the database that needs to change. There’s also an auditing component - we have an emergency line of credit based on the value of our inventory. It’s the kind of thing we can tap when a comet vaporizes the top floor of the building and the bank doesn’t just take our word that we have as much in the building as we say we have.

"So there's a comet, big deal. It'll burn up in our atmosphere and what's ever left will be no bigger than a chihuahua's head."

"So there's a comet, big deal. It'll burn up in our atmosphere and what's ever left will be no bigger than a chihuahua's head."

Is there a better way of counting everything besides shutting down business for a day? Sure! It’s called cycle counting and involves counting everything continuously throughout the year a few SKUs at a time. With limited resources, though, one must be smart about what gets counted when and how often. Cycle counting is a supply chain art form about which many books have been painstakingly written. To do it effectively one needs to know where everything is. And that gets us to one of SparkFun’s biggest challenges ever: Inventory Location.

Right now we have a pretty extensively built back-end to SparkFun.com called Sparkle. Sparkle knows that we have 200,000 0.1 μF 25V capacitors in the building. But that’s as far as it goes. If half the stock is on a shelf in production and the other half in a separate back stock area, well... Sparkle doesn’t know that. Fortunately we have people that do but it makes counting all locations take a lot longer than it should. And regardless, Sparkle only knowing stock numbers at the in-the-building level means a human must:

a) know all the locations of a thing,  
b) count all the locations of said thing at the same time, and  
c) enter the total of all locations into Sparkle before any one location changes.

This is near impossible for many products because they are found in several places for good reasons. Some places fluctuate stock faster than others and stock moves around. If (instead of freezing the entire works) we could freeze a single location, count it, book it, and unfreeze it... well then we’d be getting somewhere. This is why inventory location is so important and far more than just knowing where stuff is.

One of the things I do at SparkFun is oversee the group that builds and expands Sparkle. When it comes to nuts that are tough to crack, inventory location is a strong front-runner. Sparkle has its fair share of technical debt. In the plainest of terms: the way Sparkle keeps track of stock, a way that has worked for us since SparkFun was a wee fraction of its current size, does not transmogrify to location-based inventory very willingly.

I think of it like trying to get a dirty cat into a bath tub. If you’re so determined you will get that cat in and clean and back out again, but those claws will embed themselves in every soft surface (including and especially human skin) while attempting to impede the process, if you’re not careful. Bathing the creature while sustaining minimal injury (to both cat and bathers) is of paramount importance. The cat may get away from you and hide on your first few tries forcing you to repeatedly start over. Having a few skilled cat-cleaners on your team is a must. Determination and time are your best allies. Also catnip.

ReplaceMeOpen

ReplaceMeClose

Fortunately by now the cat is in the tub (to continue the metaphor). He’s coming clean despite much wailing and flailing but nobody’s yet been painfully scratched and we aim to keep it that way. Completing the task with minimal pain to our production and inventory teams is of paramount importance but is secondary even to our customers never needing to realize such a shift is happening behind the scenes.

At this point we have a pretty clear road map that details the winding path from Sparkle’s old-school inventory tracking system to the high-granularity hotness of inventory location. It meanders to evade the very disruptions that would undermine the efficacy of the effort. This map came after much probing of the problem space by generating experimental branches of code and abandoning them. If there's one thing I've learned battling technical debt over the years it's this: Action without direction roughs out the shape of the problem but it cannot solve it. It is, however, among the best ways to define the map that will see you ultimately through to the end.

With any luck, last Friday’s inventory day will in fact have been our last. Then, as we look forward to moving into our new headquarters in roughly a year, we’ll be able to shelve all of our gear, know where it is, know how much we have, and keep it up to date.

It’s far from the sexiest project to work on but it’s what makes business go.