In a recent blog post, a senior developer at Walmart Labs explained that the company's embrace of open source costs big money. Eran Hammer observed that Walmart's backing for the Hapi project is a "significant expense (exceeding $2m)."

Why does Walmart bother with open source at all? Why not use proprietary code from somewhere else and save the company the trouble?

[ See which open source projects are off to a great start in InfoWorld's top 10 new open source projects of the year. | Track trends in open source with InfoWorld's Technology: Open Source newsletter. ]

The Hapi.js project is an open source Node.js framework that "enables developers to focus on writing reusable application logic instead of spending time building infrastructure." Hammer explains that Walmart uses it extensively for production applications, so investment in it is a cost of doing business. Indeed, many companies invest in custom frameworks for their development work, including the internal customization of open source code. But Walmart has gone further, spending over and above the cost of internal development so that Hapi can be used by companies unrelated to Walmart.

This is not done for the love of humanity. Walmart takes the effort to work in the open because there is a return to be had from that investment. When other companies adopt Hapi, Walmart expects their internal implementations will lead them to improve the code to better suit their needs. Since the majority of these improvements are likely to be integral to the code in the commons, any rational actor will make pull requests attempting to have their work integrated in the project trunk.

Of course -- otherwise, the team making the changes would be eternally burdened with the need to refactor and test their changes each time the trunk is updated. Successful pull requests lead to merges that bring the whole community together for the upkeep of the code, not just the developers who originally wrote it.

In other words, adoption leads to contribution, which leads to improvement and innovation. Walmart has put in place a set of metrics to estimate the return on investment. Hammer explains "every five startups using Hapi translated to the value of one full-time developer, while every 10 large companies translated to one full-time senior developer." In return for its extra work on open development, Walmart gets high-quality programming at a cost far below that of recruiting and retaining extra staff. In turn, this demonstrable return allows the company to justify further development investment because "by paying developers to work on Hapi full time, we get back twice (or more) that much in engineering value."

The investment in open development also brings other tangible benefits. Walmart gets much more thorough testing of new features since early adopters in the community shake the issues out of new code before Walmart's more conservative deployment policy puts it in production. The company also finds it much easier to hear from good applicants when it needs to hire -- Walmart has been getting about a dozen qualified candidates for every Node opening it advertises. Not to mention performance -- the framework turns out to be really good for Walmart's workloads: "The Walmart mobile servers built using Hapi were able to handle all mobile Black Friday traffic with about 10 CPU cores and 28Gb RAM," according to a later blog.

When the only justifications people attempt for open source relate to saving licensing costs, it's easy for proprietary vendors to offer discounts to temporarily divert attention away from the flexibility they insist you surrender. But when there are concrete metrics for measuring the business return on investment in open development, open source solutions are able to show their real value. As Hammer concludes, "Looking for clear ROI isn't anti-community but pro-sustainability."

This article, "Walmart's investment in open source isn't cheap," was originally published at InfoWorld.com. Read more of the Open Sources blog and follow the latest developments in open source at InfoWorld.com. For the latest business technology news, follow InfoWorld.com on Twitter.