<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Official Rackspace Blog &#187; Phil Toland</title>
	<atom:link href="http://www.rackspace.com/blog/author/phil-toland/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rackspace.com/blog</link>
	<description>The Official Rackspace Blog</description>
	<lastBuildDate>Fri, 17 May 2013 15:00:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How Rackspace Is Using Erlang</title>
		<link>http://www.rackspace.com/blog/how-rackspace-is-using-erlang/</link>
		<comments>http://www.rackspace.com/blog/how-rackspace-is-using-erlang/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 15:00:21 +0000</pubDate>
		<dc:creator>Phil Toland</dc:creator>
				<category><![CDATA[Tips for Devs and Sys Admins]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Programming language]]></category>

		<guid isPermaLink="false">http://www.rackspace.com/blog/?p=18229</guid>
		<description><![CDATA[Racker Phil Toland talks about how Rackspace is using Erlang and how the language helped the team backup 7,000 network devices in one datacenter in 39 minutes.]]></description>
				<content:encoded><![CDATA[<p><em></em>When I tell people that I work with <a title="Overview of the Erlang Programming Language | Rackspace Blog" href="http://www.rackspace.com/blog/overview-of-the-erlang-programming-language/" target="_blank">Erlang</a> at Rackspace they generally assume that I work on <a title="Cloud | Rackspace" href="http://rackspace.com/cloud" target="_blank">cloud</a> offerings or <a title="OpenStack Official Website" href="http://openstack.org" target="_blank">OpenStack</a>. In fact, my team, the Foundation Development and Automation Team, is part of the Infrastructure Services group and we support the traditional dedicated hosting business. As far as I know we are unique within Rackspace as the only team with a mission haiku:</p>
<p style="padding-left: 30px;"><em>Through automation,</em><br />
<em> Adapt and collaborate</em><br />
<em> Deliver software</em></p>
<p>Essentially, we build automation tools and APIs. My project team focuses on automating network devices. The basic tasks we support include backing up devices, pushing out updates to large groups of devices and generating base configurations for new devices. Recently, we have been working on more advanced tools: the API that backs the Firewall Manager on MyRackspace.com and the APIs for pulling topology information from switches and changing VLAN assignments on switch ports. Our earlier work was focused on providing full-stack automation tools, whereas now we are providing APIs for others to build tools upon. This change in focus allows us to work more efficiently, integrate with other automation efforts within the company and grow with the business.</p>
<p>There are currently about 50,000 network devices in our database. Breaking that number down a bit, we have firewalls, load balancers and switches. The single largest group of devices is the infrastructure switches, which account for more than half of the devices we manage. These devices are spread across eight datacenters in North America, Europe and Asia.</p>
<p>There are three challenges that we face when automating these devices. The first is performance at scale. Our responsibility for these devices differs depending on the type of device and its role in the network infrastructure. We don&#8217;t, for example, back up all 50,000 devices every night. That having been said, working with even a significant fraction of these devices requires a high level of parallelism. Some of the devices are quite slow and the time spent either waiting for the device or in network I/O is the primary bottleneck. Since we cannot speed up the communication with individual devices we need to communicate with several devices at once to speed up the overall process.</p>
<p>The second challenge is dealing with the differences between devices from different vendors and even differences between code versions on the same hardware. The lowest common denominator of device automation is logging in over SSH or Telnet and interacting with a command line session. We can also utilize SNMP, but the devices vary significantly in their level of support. Vendors will supply their own management interfaces and APIs that are often better than the alternatives, but if we utilize them we must do so in a way that provides a uniform interface to our clients.</p>
<p>The final challenge we face is transparency. If we cannot communicate with a device, or if an automation process fails, we need to know about the failure and, if possible, why it occurred. We also need to keep a record of all device interactions for troubleshooting and auditing purposes.</p>
<p>When I joined the team we had several Ruby on Rails applications that provided the basic features we needed. Unfortunately, those applications had significantly overlapping feature sets, but were information silos. This made it difficult to add features or fix bugs, especially since we were a very small team. The first step was to combine the smaller applications into one comprehensive application. This eliminated a significant amount of code duplication and allowed our team to be more effective.</p>
<p>At this point we also replaced our MySQL database with MongoDB. While MySQL is a fine product, we felt that it was introducing friction into our development process. As a small team we needed to be able to focus on solving the core business problems and MongoDB allowed us to do that in a way MySQL did not.</p>
<p>We still had issues with scale; the Ruby applications just couldn&#8217;t handle communicating with a large number of devices in parallel. The next step was to take the core Ruby code that we used to talk to devices and wrap it in a robust framework written in Erlang. This framework, which we call FireEngine, allows us to talk to a large number of devices at once, with more transparency than we have ever had. Our Rails application is now just a UI for the information in our database, while FireEngine does the heavy lifting of communicating with the devices on the backend.</p>
<p>There are three pieces of code that we developed while working on FireEngine that we are especially proud of. The first is a library that evolved from the original device communication code. We still have to communicate with a lot of devices by automating a command-line session. This library has evolved to the point where it can handle SSH1, SSH2 and Telnet transparently. Client code doesn&#8217;t need to know how to communicate with the device, only what to do once communication is established.</p>
<p>Earlier I mentioned that we use Ruby and Erlang together. The second piece of code is an Erlang library that allows us to seamlessly call Ruby functions from Erlang code. The code is simple, leveraging some basic features of Erlang to start an instance of Ruby and send it instructions, but it is very powerful. We are able to use Ruby where it makes sense within our Erlang application.</p>
<p>The third piece of code is a batch processing framework. Whenever we need to perform a large job, such as backing up all the customer devices in a datacenter, we use this library. Each job consists of a coordinator, a configurable number of asynchronous workers and callback module which specifies exactly what we want each worker to do. If a worker crashes the coordinator logs the event and starts a new one to replace it. We can scale the number of workers up or down as necessary and since the logic for a job is specified in a simple callback module we can create new types of jobs very easily.</p>
<p>The results of our work have been very satisfying. Device interactions are now fast and reliable. Our largest datacenter, with just fewer than 7,000 customer network devices, backs up in 39 minutes with very few errors. With the added transparency we know not only when a device fails to communicate, but we also know why. All device interactions are logged with details of what happened. This has proven to be an invaluable diagnostic and auditing tool.</p>
<p>We have made some bold technology decisions over the last couple of years to meet the challenges we faced. However, these decisions were not taken lightly. We had to make a convincing argument to management and then prove the technology with prototypes and working code. The decisions have proven to be the right ones and we are now ready to meet the next generation of automation challenges within Rackspace.</p>
<p><em>Phil Toland presented this topic at a talk at the Erlang Factory at the end of March as a case study for how Rackspace uses Erlang. Read Phil&#8217;s previous post, <a title="Overview of the Erlang Programming Language | Rackspace Blog" href="http://www.rackspace.com/blog/overview-of-the-erlang-programming-language/" target="_blank">Overview of the Erlang Programming Language</a>, and if you are interested in working on Erlang at Rackspace, check out the <a title="Erlang Jobs | Rackspace" href="http://jobs.rackspace.com/search?q=erlang" target="_blank">relevant job postings</a>.<br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rackspace.com/blog/how-rackspace-is-using-erlang/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Overview of the Erlang Programming Language</title>
		<link>http://www.rackspace.com/blog/overview-of-the-erlang-programming-language/</link>
		<comments>http://www.rackspace.com/blog/overview-of-the-erlang-programming-language/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 15:30:05 +0000</pubDate>
		<dc:creator>Phil Toland</dc:creator>
				<category><![CDATA[Tips for Devs and Sys Admins]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Programming language]]></category>

		<guid isPermaLink="false">http://www.rackspace.com/blog/?p=15902</guid>
		<description><![CDATA[Racker developer Phil Toland talks about the Erlang programming language, its history and some of the advantages that it has compared to other languages.]]></description>
				<content:encoded><![CDATA[<p>My father used to be an auto mechanic. Every so often the Cornwell or Snap-On tool truck would come by his garage and he would wander through it like a kid in a candy store. To this day he has large rolling toolboxes full of the mysterious implements of car repair. Each tool was useful in some situation where it made his job easier in some cases, and doable in others.</p>
<p>I am a software developer and I collect programming languages as my father collected tools. I once went to the local library and checked out old manuals for COBOL and FORTRAN; not because I wanted to write any code with them (perish the thought!) but because I wanted to know what makes them tick. I originally approached the <a title="Erlang | Wikipedia" href="http://en.wikipedia.org/wiki/Erlang_(programming_language)" target="_blank">Erlang</a> programming language with the same sense of curiosity and detachment. There wasn&#8217;t a lot of information about Erlang out in the wild at the time and it wasn&#8217;t clear to me what Erlang might bring to the table.</p>
<p>Then in 2007 an interesting thing happened. I was attending RailsConf in Portland, Ore. and the Pragmatic Programmers had announced that they were publishing <a title="Programming Erlang | Pragmatic Bookshelf" href="http://pragprog.com/book/jaerlang/programming-erlang" target="_blank">Programming Erlang</a> by Joe Armstrong, the father of Erlang. There was quite a lot of chatter in the halls and before talks about this weird &#8220;new&#8221; programming language. The attendees of RailsConf 2007 represented early adopters and enthusiasts who would be comfortable exploring little known languages. It was becoming clear that Erlang might complement Ruby development nicely, being strong in the areas where Ruby lacked and vice versa. I bought the book when it was released and was very intrigued.</p>
<p>Erlang was developed in the 1980s as a programming language to be used in telephony equipment, an environment where reliability is a far greater concern than raw computational speed. In order to achieve high reliability, Erlang uses lightweight processes that are completely isolated from each other. These independent processes communicate by passing messages back and forth. If a process fails, it does not disrupt the entire system.</p>
<p>There is a sophisticated supervision framework that can detect when a process crashes and react appropriately by, for example, restarting the process that crashed.  A nice side effect of this architecture is that Erlang scales very well across multiple cores in a single server or across multiple servers in a cluster. The lightweight processes in Erlang do not share anything, so the process you are passing messages to can be located on the same machine running on a different core or on another machine in the cluster entirely.</p>
<p>Perhaps the most famous Erlang project is the AXD301 ATM switch developed at Ericsson in the late 1990&#8242;s. The code for the switch consisted of over a million lines of Erlang code and reportedly reached nine &#8220;9&#8243;s of uptime. While using Erlang doesn&#8217;t automatically guarantee that level of reliability, it is a glimpse of what is possible. Concurrency and reliability are baked into Erlang in a way that is different than most other languages I have worked with. This leads developers to think differently about application architecture, especially when it comes to error handling and failures within a large, distributed system.</p>
<p>In 2008, I was given the opportunity to put Erlang to the test in an application I was building for my employer at the time. On that project I worked on a small team consisting of myself and two other developers and we were able to deliver a solid system in a relatively short amount of time. Erlang allowed us to focus on the business problem and not the incidentals. I have chosen to work with Erlang ever since then because it is both powerful and empowering.</p>
<p>Many of today&#8217;s most interesting problems in software development are also the most challenging. Concurrency in a multicore world and reliability when applications are growing ever larger and ever more complex must rank up there, along with naming and cache invalidation, as some of the most challenging problems in modern software development. Erlang is a pragmatic programming language aimed squarely at those problems. These traits make Erlang an excellent choice for building backend systems and APIs. For Example, the <a title="Riak Overview | Basho" href="http://basho.com/products/riak-overview/" target="_blank">Riak</a> and <a title="CouchDB | Apache" href="http://couchdb.apache.org/" target="_blank">CouchDB</a> databases are both implemented in Erlang as well as the <a title="RabbitMQ | Official Website" href="http://www.rabbitmq.com/" target="_blank">RabbitMQ</a> message queue. The <a title="Webmachine | Basho" href="http://wiki.basho.com/Webmachine.html" target="_blank">Webmachine</a> library makes writing RESTful APIs a snap.</p>
<p>It is cliche these days to suggest that programmers should use the right tool for the job. However, another saying popular among programmers is that when all you have is a hammer every problem looks like a nail. Therefore, if developers are to use the best tool for the job they need to have a full toolbox. Erlang is a tool that deserves a place in every developer&#8217;s toolbox. While Erlang is not a tool that is appropriate for every situation, in the situations where it is a good fit, Erlang can make a developer&#8217;s job much easier, and in some cases doable.</p>
<p><em>Phil will be speaking <a title="Phil Toland | Erlang Factory Conference" href="http://www.erlang-factory.com/conference/SFBay2012/speakers/PhilToland" target="_blank">March 30th at the Erlang Factory Conference</a> in the Bay Area, so be sure to stop by and meet him. Love programming in Erlang and looking for a job? We&#8217;re hiring! <a title="Jobs | Rackspace" href="http://jobs.rackspace.com/search?q=erlang" target="_blank">Check out the openings</a> that we have here at Rackspace.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rackspace.com/blog/overview-of-the-erlang-programming-language/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Content Delivery Network via Rackspace Cloud Files: c3414940.r40.cf0.rackcdn.com

 Served from: www.rackspace.com @ 2013-05-19 00:29:46 by W3 Total Cache -->