How Linux Mastered Wall Street
When it comes to the fast-moving business of trading stocks, bonds and derivatives, the world's financial exchanges are finding an ally in Linux, at least according to one Linux kernel developer working in that industry.
This week, at the annual LinuxCon conference in Vancouver, Linux kernel contributor Christoph Lameter will discuss how Linux became widely adopted by financial exchanges, those high-speed computerized trading posts for stocks, bonds, derivatives and other financial instruments.
As an alternative to traditional Unix, Linux has become a dominant player in finance, thanks to the operating-system kernel's ability to pass messages very quickly, Lameter said in an interview with IDG. In fact, the emerging field of high-frequency trading (HFT) would not be possible without the open-source operating system, he argued. Lameter himself was hired as a consultant by one exchange -- he won't say which one -- based on his work in assembling large-scale Linux clusters.
NYSE Does Linux
The largest exchange, the New York Stock Exchange (NYSE) Euronext, is run on a Linux system that can generate 1,500,000 quotes and process 250,000 orders every second, offering acknowledgments of each transaction within two milliseconds.
As late as 2007, Wall Street exchanges were still largely run on Unix, such as Hewlett-Packard's HP-UX, IBM's AIX, and Sun Microsystems' Solaris. Over the past few years however, Linux crept into this market, showing up first in ancillary systems and then running a few core exchanges.
"The release cycles with Solaris and AIX were very long -- two to three years between updates. Linux was able [to make the changes needed] within a month or so," Lameter said.
Financial exchanges need their servers to execute trades as quickly as possible. Even an edge of a few milliseconds could, over the course of trading billions of dollars a day, provide a competitive edge. This intensity created a hotbed of innovation that couldn't be easily encapsulated within multiyear release cycles, Lameter explained.
"The trading shops saw that the lowest-latency solutions would only be possible with Linux," Lameter said. "The older Unixes couldn't move as fast as Linux did."
One key attribute was the TCP/IP stack, the configuration of which determines how fast a message can be passed between two systems. Another appealing attribute has been a revamped scheduler, which ensures that a process -- one performing a trade for example -- isn't interrupted once it has been started. Lastly, thanks to an army of volunteer developers, Linux was able to offer drivers for new hardware more quickly than the large Unix vendors.
Linux also offered financial firms the ability to modify the source code to further speed performance, Lameter said. "It depends on how daring the exchange is," Lameter said, noting that NASDAQ uses a modified version of the Gentoo Linux distribution.
Others just use off-the-shelf distributions and pay consultants to tweak the settings for maximum performance. Red Hat Enterprise Linux is now the dominant Linux distribution among exchanges, Lameter said. Red Hat counts among its customers the Chicago Mercantile Exchange, New York Mercantile Exchange, Frankfurt Stock Exchange, Eurex derivative exchange and Philippine Stock Exchange.
A typical architecture of an exchange will consist of a number of different subsystems, Lameter said. One component is a matching engine, which pairs a seller and a buyer for each trade. The engine captures all the information about the trade so it can be retraced and audited. Specific engines handle specific sets of stocks. An average exchange will have somewhere from 60 to 100 servers handling the matching.
An exchange will also have a set of front-end processors, which is the system that the traders connect to. This system will usually consist of 500 to 1000 servers. "The trader is not allowed to connect to the matching engine itself," Lameter said. Instead, the trader's machine connects to the front-end server and the server checks the trade to verify it is possible, then sends instructions for the trade to the matching engine. Once the trade is completed, the front-end processing system then returns a message to the trader.
On the software side, many exchanges still primarily use software that was built in-house, using languages such as Java or C++. Some, however, are migrating toward commercial packages, at least for some tasks such as message passing. Tibco's messaging software and Informatica's 29West are the predominant messaging tools in this space. Many exchanges have also settled on an emerging standard for messaging, the Linux-friendly Middleware Agnostic Messaging API (MAMA).
Windows, Eat Linux's Dust
Microsoft has not yet made major inroads to this market, Lameter said. "Windows is mostly relegated to the back office," he said. He claimed that Windows typically has larger latency times than that of Linux, and noted that in 2009, the London Stock Exchange tried and abandoned Windows servers.
Microsoft declined to discuss the London Stock Exchange, though a spokesperson did note that it has plenty of customers in the financial services industry, such as Thomson Reuters and KAS Bank. Microsoft also cited a 2010 IDC study that showed that, worldwide, Microsoft enjoyed 74.7 percent of the server market, while Linux captured only 21.4 percent of the market.