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(

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine: threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration: TeamCity .NET 4.51 EF 6.0.2 VS2013 It see

Navigating Cloud Strategy after Azure Central US Region Outage

 Looking back, July 19, 2024, was challenging for customers using Microsoft Azure or Windows machines. Two major outages affected customers using CrowdStrike Falcon or Microsoft Azure computation resources in the Central US. These two outages affected many people and put many businesses on pause for a few hours or even days. The overlap of these two issues was a nightmare for travellers. In addition to blue screens in the airport terminals, they could not get additional information from the airport website, airline personnel, or the support line because they were affected by the outage in the Central US region or the CrowdStrike outage.   But what happened in reality? A faulty CrowdStrike update affected Windows computers globally, from airports and healthcare to small businesses, affecting over 8.5m computers. Even if the Falson Sensor software defect was identified and a fix deployed shortly after, the recovery took longer. In parallel with CrowdStrike, Microsoft provided a too