Skip to main content

Azure Stream Analytics (Day 17 of 31)

List of all posts from this series: http://vunvulearadu.blogspot.ro/2014/11/azure-blog-post-marathon-is-ready-to.html

Short Description 
In only few words, Stream Analytics is a service that allow us to analyze and process a stream of data in real-time. The most important thing here is real-time. This service allow us to process stream an allow us to react based on the events that are happening on the stream.


Main Features 
Capacity
This service is able to analyze millions of events per second. Not per hour or minutes, but per second. For example we can analyze stream generated by Event Hub.
Processing
Stream Analytics comes not only with capacity, but also with computing power. It is able to analyze the stream content, detect different pattern and trigger different actions.
Resiliency 
This is one of the Azure services where resiliency is quaranteed.
No data loss
Once the content reach the stream, the service guarantee to us that no data will be lost. Each bit from the stream will reach the final destination.
Scalability
He have the ability to stream with multiple stream and processing units. In this way we can scale-up as much as we want.
Correlation
There is the ability and support to correlate multiple streams of data. In this way working with multiple stream of data will not increase the complexity of our system.
SQL Syntax
The language used to process data streams is very similar with SQL (subset of SQL). In this way we don’t need to learn a new language, we only need to learn and know functions that are specific to Stream Analytics.
Data timestamp
In a system that analyze data in real-time the concept of timestamp and arrival time can be different based on the ingest source or other rules. Because of this we can specify using a command what column should be used as ‘arrival time’ – the command name is TIMESTAMP BY.
Data types
There are 4 types of data that can be used in Stream Analytics:

  • Bigint
  • Float
  • Datetime
  • Nvarchar(max)

Using this 4 primitive types we can map any kind of data from numbers to strings and dates.
DDL
Data Definition Language is a vocabulary used to define the data structure of Stream Analytics. For example CREATE TABLE is part of DDL vocabulary.
DML
Data Manipulation Language is the vocabulary used to retrieve, process and work with Stream Analytics. Part of DML are “SELECT”, “WHERE”, “GROUP BY”, “JOIN”, “CASE”, “WITH” and so on.
Window
A window in Stream Analytics terminology represent all events in a specific time frame. Using this time windows we can aggregate events, analyze them many more. There 3 types of time windows in Stream Analytics, from the simple ones that are fixed in time, from the one that start only when a specific event or action happen in the system:

  • Tumbling 
  • Hoping 
  • Sliding

Functions
There are a lot of functions that are built in. This functions allow us to do different things from extracting different part of a date time column get substrings or cast to different types.
Don’t forget that when cast is not possible the current version of the service will not throw an expectation. It will only return NULL value.
Low Latency
The latency from the moment when data reach the service until will be processed is extremely short.
REST API
Like for the rest of services from Microsoft Azure, all the service management is made using a simple REST API. Because of this we can create our own management application or portal.

Limitations 
Region Availability
In the preview phase, this service is only available in Central US and West Europe region. In future this service will be available worldwide.
Partition Id
In this preview phase, the data partitioning using ‘partition by’ must be on Partition Id. In the future we will be able to make partitioning on other fields.
Number of aggregation 
The maximum number of aggregation definitions that can be done in a query can be 7.
Job Management
When we need to redeploy or start again a job, we are not able to specify the start point. This mean that we cannot continue with data processing from the point where the last job stopped.
Input from blobs
When we are using blobs as input we should limit the maxim size of each blob to 10MB in this moment. This happens because jobs can have problem consuming large blobs and crash.
Columns Heather and Whitespaces
The system don’t make any kind of trim in the name or columns. This mean that if we specify a space at the beginning or end of a column will generate null entries in the job output.

Applicable Use Cases 
Below you can find some use cases when I would use Stream Analytics.
Analyze sensor events of a smart home system
I would use this service to analyze all the events that are produces by a smart home platform and react to this events. From simple events that notify me that the battery is low to the one that transmit the room temperature or that an open is open or close.
Logs
There are a type of logs that I would send to a stream analytic system and based on their content to trigger different alerts or alarms. Based on this data we could even make predictions.
Smart devices
When I say a smart device I have in mind a smart watch, a smart shoe, a phone or something similar. Why not aggregate all the data into a system that can analyze them and notify parents that the child has temperature or is sick.

Code Sample 
-

Pros and Cons 
Pros

  • Real time (real) capabilities
  • SQL subset language
  • Scalable
  • Multiple input/output sources
  • Different methods to aggregate data

Cons
None, for the use cases where I would like to use this service.

Pricing
When you need to estimates the costs of Stream Analytics you should take into account the fallowing components:

  • Volume of data 
  • Streaming Unit
  • Outbound traffic
  • Ingest mechanism and costs


Conclusion
We should keep an eye on this service and be open to use it when you will need stream analytics in real time. Analyzing a stream in real time is a hard thing if you need SLAs. It is not only CPU power.

Comments

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(

Azure AD and AWS Cognito side-by-side

In the last few weeks, I was involved in multiple opportunities on Microsoft Azure and Amazon, where we had to analyse AWS Cognito, Azure AD and other solutions that are available on the market. I decided to consolidate in one post all features and differences that I identified for both of them that we should need to take into account. Take into account that Azure AD is an identity and access management services well integrated with Microsoft stack. In comparison, AWS Cognito is just a user sign-up, sign-in and access control and nothing more. The focus is not on the main features, is more on small things that can make a difference when you want to decide where we want to store and manage our users.  This information might be useful in the future when we need to decide where we want to keep and manage our users.  Feature Azure AD (B2C, B2C) AWS Cognito Access token lifetime Default 1h – the value is configurable 1h – cannot be modified

What to do when you hit the throughput limits of Azure Storage (Blobs)

In this post we will talk about how we can detect when we hit a throughput limit of Azure Storage and what we can do in that moment. Context If we take a look on Scalability Targets of Azure Storage ( https://azure.microsoft.com/en-us/documentation/articles/storage-scalability-targets/ ) we will observe that the limits are prety high. But, based on our business logic we can end up at this limits. If you create a system that is hitted by a high number of device, you can hit easily the total number of requests rate that can be done on a Storage Account. This limits on Azure is 20.000 IOPS (entities or messages per second) where (and this is very important) the size of the request is 1KB. Normally, if you make a load tests where 20.000 clients will hit different blobs storages from the same Azure Storage Account, this limits can be reached. How we can detect this problem? From client, we can detect that this limits was reached based on the HTTP error code that is returned by HTTP