Skip navigation
Need for Speed: How Groupon Migrated to Node.js

Need for Speed: How Groupon Migrated to Node.js

Groupon might seem like a place where application development happens fast. But engineers weren't able to move quickly enough, prompting the company to make a major architectural move over the past year to Node.js.

Groupon-Sean-McCullough-Nod

SAN FRANCISCO - Because it's still a relatively young company, Groupon might seem like a place where application development happens fast. But engineers weren't able to move quickly enough, prompting the company to make a major architectural move over the past year.

"To change one color throughout the entire Groupon.com webpage, that was estimated to take three months to do," said Groupon engineer Sean McCullough said at the Node Summit on Tuesday. "We weren't able to iterate at the speed that we needed to."

Engineers looked at a slew of alternatives to the Ruby on Rails web application framework that Groupon had used since its inception in 2008. They checked out PHP and the Twisted framework written in Python, among other options. They selected the popular Node.js server-side JavaScript runtime. It can scale fairly easily, and lots of developers are already familiar with JavaScript, McCullough said.

But getting Node.js running in production wasn't a straight shot.

After developers hacked together their first application in Node - an email form - load tests showed high memory utilization. And during tests, the site went down for two hours. After the testing stopped, the outage ended, too, McCullough said. Groupon traced the problem to a load balancer that was handling test and development systems as well as production systems. That configuration should never have happened in the first place, but the Node testing highlighted it and sparked an outage.

The incident proved that issues certainly can come up during such tinkering. "We never had to worry about the outgoing connection pool in Ruby," McCullough said. "That was a new problem for us."

Once the team had overcome the obstacles with its first Node application and put it into production, the time came to create another one. This time, it was a more complex page that contained current deals and a user authentication feature. And it got about 10 times as much traffic as the first Node-based page. The plan was to launch the new version in about three months, but the move took twice as long.

Despite the early hiccups, "at some point we were like, 'I think this Node thing is going to work,'" McCullough said. The company directed developers to stop building on the company's longstanding code base written with Ruby on Rails and port features over to Node. Now almost all web traffic hits the new platform.

"We're able to serve much higher traffic," McCullough said. Before the change to Node, a Starbucks deal was so popular that it brought the site down. "The next time, that didn't happen," McCullough said. On top of that, he said, pages now take less time to load for end users.

And indeed, it's become easier for developers to tack on new features now, according to a Groupon engineering blog post on the move.

Other companies have run across benefits of using Node.js, and now that Joyent has announced commercial support for it, more companies could feel compelled to follow Groupon's lead.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish