Fabric stateful services: not exactly what you might expect

2016/02/23

Fabric stateful services: not exactly what you might expect this post will discuss the true nature of Service Fabric’s Stateful Services. at first glance you might thin that Stateful Service’s Reliable Collection is a central shard (partitioned) collection abstraction. in other words convenient API over Key Value database like Azure Table. the reality is quite different. Stateful Services has single primary instance per partition. Scaling out is possible by multiple partition, but the adding partition is not possible at runtime (you will have to redeploy the application). Beyond this, the collection is not shared between partitions....

Service Fabric Concept, Guidelines and Patterns #6-Deadlock

2016/02/20

Service Fabric Concept, Guidelines and Patterns #6-Deadlock this post is part of the Service Fabric’s series which covers Service Fabric’s concept, guidelines and common patterns. at this post we will discuss potential deadlock and good practice for avoiding it.   The idea for this post came while speaking with Jeffrey Richter from the Service Fabric team. When would you get deadlock on Service Fabric’s Actor Model? deadlock occurs when Actor A calls instance of Actor B and different call for Actor B (not recurrent) call the same instance of Actor A. A ---->...

Microsoft.Composition (Portable MEF): Dependency Injection and Service Locator

2016/02/17

Microsoft.Composition (Portable MEF):  Dependency Injection and Service Locator via Convention This post is part of mini series, which complete the full MEF series. this post will go over Microsoft.Composition Dependency Injection and Service Locator using conventions. in the previous post I describe hot to register types using convention, but in real world types often has their own dependencies which should be satisfies (this is why the IoC process also called composition). In order to satisfy those dependencies you can take different approaches: Dependency Injection constructor-based injection The most common way of passing the dependencies is  constructor-based injection where...

TPL Dataflow Starvation Fixed

2016/02/10

TPL Dataflow Starvation Fixed Great news for all TPL Dataflow developers. The old  bug (more than a year since I reported it) was finally fixed at version 4.5.24. now it is safe to use fallback scenario with TPL Dataflow. for example: if you’re having 2 face recognition algorithm: * excellent but slow * fine and fast and you want to use those algorithm on a video streams without getting to much behind. You can limit the Bounded Capacity of the excellent algorithm’s block, link the two algorithm’s blocks to a buffer block. As long as the excellent...

Microsoft.Composition (Portable MEF): Convention

2016/02/06

Microsoft.Composition (Portable MEF): Convention This post is part of mini series, which complete the full MEF series. this post will go over Microsoft.Composition conventions. personally I really like convention over IoC, because it’s lead to better consistency of the code-base’s naming. Convention can be simple as the following code: Code Snippet var conventions = new ConventionBuilder(); conventions.ForType<Logger>().Export<ILogger>(); conventions.ForTypesDerivedFrom<ISetting>()             .ExportInterfaces(t => t == typeof(ISetting)); var configuration = new ContainerConfiguration()     .WithAssembly(typeof(Program).Assembly, conventions);   using (var container = configuration.CreateContainer()) {     container.GetExport<ILogger>(); } As you can see the convention can be strict as in line 2,or more general as in line 3,4.the configuration (line 5,6) define the assembly which the convention relate to. convention can be more...

Microsoft.Composition (Portable MEF): Attribute Model

Microsoft.Composition (Portable MEF): Attribute Model This post is part of mini series, which complete the full MEF series. The original MEF series goes over the version shipped with the .NET framework.This mini series will go over the API of 3rd lightweight (yet efficient) MEF version which consumed via NuGet. This version is following the same concept of the previous changes yet some APIshas been changed. Apart of the APIs refactoring (mostly for better)this MEF version is having much better descriptive Exception (it was really bad on previous versions) The down side of this version is lack of documentation.this mini...