Cubes

Windows Azure Cache Extension Library (WACEL) supports a simple, easy-to-use OLAP cube that quickly answers multi-dimensional analytical (MDA) queries. You don’t need to manage any supporting infrastructures – simply new-up a Cube when you need one! With this initial version, the Cube data structure supports:
  • Automatic aggregation along multiple dimensions.
  • Drill-down analysis along any dimensions.
  • Query for point data, or slice data in any directions.
  • Automatically generated Time dimension with finest granularity down to 5 minutes.
  • Retrieve results in milliseconds!

Get Started - a quick example

In this example, we'll create a Cube for analyzing web logs. The Cube keeps track of number of responses grouped by HTTP status codes. The cube allows you to quickly query for summarized data by days, months, and the whole year, and it also allows you to quickly query for a series of data such as number of responses per day in January.


1. Create a new Cube with a Time dimension and a flat “Statuses” dimension, which includes several HTTP status codes as its members.

Cube cube = Cube.SimpleCube;
cube.AddDimension(Dimension.CreateFlatDimension("StatusCode", "200", "404", "500"));

2. Insert some data. There are multiple ways to add data to a Cube, but the easiest way is to simply use dynamic objects. The following code sets data at three different points in the cube. Note that for the Time dimension, you can either use a string value to identify a Time coordinate, or simply use DateTime, which will be automatically translated into the right coordinate based on the dimension granularity.

cube.Update(
    new {Time = "Jan1", StatusCode="200", Value = 100.0},
    new {Time = "Jan23", StatusCode="200", Value = 123.0},
    new {Time = DateTime.Now, StatusCode = "500", Value = 155.0});

3. Now your Cube is ready to be queried! For example, to get January summary for status code 200, this is all you need to do:

var value = (double)cube.Query(new { Time = "Jan", StatusCode = "200" }).Value;

You can also drill-down from the top. For example, to get all data points in January for status code 200, you can do:

var datapoint = cube.Query(new { Time = "Jan", StatusCode = "200" });
var children = cube.Drilldown(datapoint, "Time");
foreach (var child in children)
    var value = child.Value;

That's all! Isn't that simple?

Last edited Nov 4, 2013 at 6:09 PM by Haishi, version 5