Flavorus considered hosting its service with a company that offers a cloud solution for websites. However, Flavorus did some basic testing using that model, and its engineers determined that the solution couldn’t handle the scale of traffic required. “The hosting company offers scalable commodity hardware in that they have a server and run virtual machines in the cloud,” says Reichardt. “You can host a traditional website in the cloud, but the application itself doesn’t scale. That’s a problem when you have the amount of traffic we were facing.”
Instead, Flavorus chose to host its ticket application on the Windows Azure platform. Developers can use Windows Azure to host, scale, and manage web applications on the Internet through Microsoft data centers. The platform includes a set of development tools, services, and management systems familiar to Flavorus. The company builds solutions by using the Microsoft .NET Framework, software that provides a comprehensive programming model and set of application programming interfaces for building applications and services. “We’re a .NET shop and I’m a .NET programmer,” says Reichardt. “Microsoft solutions are much more rich and easy to program.”
Sharding the Data
In early February 2011, Flavorus started working closely with product representatives for the Windows Azure platform. At first, the company wrote its ticketing application—which was built by using Microsoft SQL Server 2008 data management software—for a traditional single-instance database in Microsoft ASP.NET, a web application framework for building dynamic websites, web applications, and web services. It evaluated storage options on the Windows Azure platform and found that Microsoft SQL Azure, a cloud-based relational and self-managed database service, was the fastest option for its performance needs.
Flavorus used the .NET Framework to rework the ticket-processing application—which the company calls Jetstream—to run on Windows Azure, the Microsoft cloud services development, hosting, and management platform. The Jetstream application is very simple: it collects the customer’s data and reserves a ticket, while a dynamic webpage calls a database and processes the customer data.
It was easy for Flavorus to port its solution to the Windows Azure platform. The company developed and tested its initial application from February 7 to February 20 and then ran the initial high-volume tests on February 21 and February 22.
The first volume tests on the Windows Azure platform failed. One SQL Azure database did not provide enough computational capacity to process large numbers of tickets and high user traffic. The database automatically restricted connections when the load was exceeded. For its ticketing application, Flavorus needed to scale beyond what a single SQL Azure database could provide.
The company decided to adopt sharding in SQL Azure to take advantage of the massive scale that a SQL Azure cluster provides. Sharding is a horizontal partitioning technique that spreads data across multiple databases. To this end, the company could turn its single-database ticketing service into an application with data that is split across multiple SQL Azure database servers (Figure 1).
The company was able to scale its on-premises, single-database solution into a sharded solution within two weeks. By doing this, Flavorus gained higher availability by engaging many databases. “By using sharding with SQL Azure, we can have tons of customers on the site at once trying to buy tickets,” says Reichardt. “If any one of the database servers goes down, it doesn’t really matter.”
Flavorus realized that the ticketing application was ideal for sharding because the tickets are all the same. “With sharding, you can put a few tickets on each database if you want,” says Reichardt. “It doesn’t matter which database the ticket is on. You just need to distribute the load. It’s a beautiful thing.”
From February 22 to February 24, Flavorus ran initial high-volume tests using sharding. The ticketing application was able to handle a large amount of ticket sales but hit a limit because of how Internet Information Services 7.5, the default web server role on the Windows Azure platform, handles traffic. To get around this limitation, the company had to rewrite the data-dependent routing logic.
For debugging purposes, Flavorus needed to access logs to troubleshoot issues with the compute nodes and databases. “I was able to retrieve the logs and track down the line of code that was causing the web servers to have difficulty managing connections to the databases,” says Reichardt.
From March 2 to March 24, Flavorus ran tests using the new logic, gradually increasing the number of sharding instances. By March 25, Reichardt was running volume tests with 7,000 general-admission tickets available in each of the 550 SQL Azure databases. During load testing, he successfully sold 150,000 tickets in 10 seconds. “When we reached that speed, we realized we could fulfill ticketing for any festival in the United States,” says Reichardt. “The Jetstream application literally scaled as I added servers. We were ready to go.”
A few days before event tickets went on sale, Flavorus learned that the promoters wanted to sell eight ticket types at different prices. To accommodate this request, the company sharded the ticket data into eight groups of servers, with each group serving a specific ticket type. For example, it used 20 databases for the VIP tickets and 400 databases for the most popular tickets—the general-admission, three-day tickets. Flavorus allocated ticket data by using projections based on the previous year’s ticket sales. “Sharding gives us infinite flexibility in terms of sending traffic to different databases,” says Reichardt. “It was an eye-opening experience for us in terms of SQL Azure capabilities.”
Launching Jetstream in the Cloud
To deploy Jetstream to production on the Windows Azure platform, Reichardt simply ran a command in the Microsoft Visual Studio 2010 Professional development system, and the application—which comprises 1,391 lines of code—launched in the cloud. He then assigned the application and data to the required number of web servers and database servers.
Tickets went on sale for the event on April 23, and Jetstream worked flawlessly. To support the spike in first-day ticket sales, Flavorus used the Windows Azure platform to host 750 web role instances of the Jetstream application and 550 SQL Azure databases. The application wrote chunks of customer data to multiple sharded SQL Azure databases in parallel. Jetstream was live for two days, after which the company returned the event data to its on-premises servers and continued selling tickets. “For an on-sale event, we really need scalability for a small amount of time—about two hours,” says Reichardt. “About half an hour before sales start, traffic ramps way up. Then you get the latecomers who go to the website to find out if tickets are still available.”
The company continues to use its on-premises environment for day-to-day ticketing sales. It offers the Jetstream service only for customers promoting large-scale events. “By using the cloud model, we can isolate the ticket sales of one event,” says Reichardt. “We can run Jetstream on demand and point the ticket-sales traffic to that application. It doesn’t affect any of the other events on our website. Then, we can shut down Jetstream and pull the data back into our system to process it—with no interruption in service.”