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

How to check in AngularJS if a service was register or not

There are cases when you need to check in a service or a controller was register in AngularJS.
For example a valid use case is when you have the same implementation running on multiple application. In this case, you may want to intercept the HTTP provider and add a custom step there. This step don’t needs to run on all the application, only in the one where the service exist and register.
A solution for this case would be to have a flag in the configuration that specify this. In the core you would have an IF that would check the value of this flag.
Another solution is to check if a specific service was register in AngularJS or not. If the service was register that you would execute your own logic.
To check if a service was register or not in AngularJS container you need to call the ‘has’ method of ‘inhector’. It will return TRUE if the service was register.
if ($injector.has('httpInterceptorService')) { $httpProvider.interceptors.push('httpInterceptorService&#…

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.51EF 6.0.2VS2013
It seems that there …

Run native .NET application in Docker (.NET Framework 4.6.2)

Scope
The main scope of this post is to see how we can run a legacy application written in .NET Framework in Docker.

Context
First of all, let’s define what is a legacy application in our context. By a legacy application we understand an application that runs .NET Framework 3.5 or higher in a production environment where we don’t have any more the people or documentation that would help us to understand what is happening behind the scene.
In this scenarios, you might want to migrate the current solution from a standard environment to Docker. There are many advantages for such a migration, like:

Continuous DeploymentTestingIsolationSecurity at container levelVersioning ControlEnvironment Standardization
Until now, we didn’t had the possibility to run a .NET application in Docker. With .NET Core, there was support for .NET Core in Docker, but migration from a full .NET framework to .NET Core can be costly and even impossible. Not only because of lack of features, but also because once you…