A Tour of the Infrastructure behind Wolfram|Alpha

Chris Williamson

Director, Systems Engineering and IT at Wolfram Research

Introduction

As one might expect Wolfram|Alpha has a significant amount of infrastructure powering its sites.  This talk will lead attendees on a tour of the features, components, and achievements of the infrastructure and how Wolfram|Alpha delivers massive amounts of computation and data to its users.

Computed by Wolfram Mathematica

Common language amongst a large and diverse group of developers

Computation, graphics, and general software engineering

Full software development environment consisting of powerful tools such as Wolfram Workbench

JLink = Java meets Mathematica

Java offers a well established community that actively develops many useful and well designed tools

JLink allows Mathematica to harness the tools provided through Java

JLink allows users of Mathematica to call Java from Mathematica

JLink also allows users to call Mathematica from Java

Wolfram|Alpha uses Java tools for connecting to databases, logging, sending mail, and many other things

Jlink is the key compoent that allows Wolfram|Alpha can take advantage of these tools without having to reinvent the wheel

Launching Wolfram|Alpha onto the web using webMathematica

webMathematica uses JLink to launch Mathematica kernels and frontends in Tomcat

webMathematica provides tags for calling Mathematica code and processing the results into HTML

Most importantly webMathematica provides tools for managing multiple Mathematica kernel life cycles

Challenges!

Wolfram|Alpha computation takes time

Wolfram|Alpha computation takes CPU power

Wolfram|Alpha computation and data lookups require memory

The answer to time is AJAX

Computation is best split up in the browser because it allows more feedback to go to the user

When a computation is processed, it is broken up into several pods

AJAX is shorthand for asynchronous JavaScript and XML

AJAX uses HTML over HTTP requests to load pods asynchronously after the initial input is processed

The answer to more CPU is more servers

One Mathematica kernel generally uses the entirety of one CPU core as it runs

So a webMathematica kernel pool is configured to have one kernel for each CPU

If it takes one kernel to host one request, then many kernels are required to host a large amount of requests.

Since one server generally doesn't have a large number of CPUs, more than one server is required to handle the many requests.

KeepAliveD and LVS are used to cluster multiple webMathematica machines.

At launch time we had over 1600 kernels running on multiple clusters.

The answer to more memory is database servers

Wolfram|Alpha processes a huge amount of data that could not possibly all be loaded into memory

MySQL databases were chosen to house the Wolfram|Alpha databases because they are fast, scalable, and affordable

The databases are efficient enough that they may be shared amongst the webMathematica servers using a cluster

KeepAliveD and LVS are used to cluster the read-only interfaces required for Wolfram|Alpha inputs

Data is deployed to Wolfram|Alpha database servers using replication technology provided by MySQL

Cluster-based scaling

KeepAliveD monitors each server in a cluster and keeps track if it is functional

When a request is directed to the cluster LVS chooses a functional server to process the request

If KeepAliveD determines a server is not functional, it is removed from the cluster and will not be used to process requests

Clustering allows the use of multiple servers to add more power, but it also provides more failover

Using multiple webMathematica or database servers allows the cluster to survive if one server in the cluster fails

Additional clusters may also be integrated where appropriate

Wolfram|Alpha has a cluster of Apache servers for hosting static content and managing requests to the compute nodes

Wolfram|Alpha also has a services cluster for code with special needs

Location-based scaling using Round Robin DNS

Round Robin DNS provides a way for exposing multiple IP addresses to users for a given site

Different Wolfram|Alpha clusters may be configured for each IP address

The IP addresses are returned in a different order each time

This keeps load on the different clusters reasonably balanced

In addition the clusters may exist physically in different geographical areas.

Having servers located in different geographical areas provides redundancy against network issues and help with latency issues

Questions

Any questions?

Thanks for coming!