Tuesday 29 June 2021

Distributed Caching Options in .NET

There are a number of distributing caching options in .NET.

Ignoring the distributed aspect of our desired cache for the minute we focus on the inbuilt MemoryCache.

For an in-process, in-memory cache, one option is to use MemoryCache (System.Runtime.Caching). Caching data types were introduced in .NET 4. A CacheItemPolicy dictates how long objects remain in the cache and what the eviction policy is.

Some more flexible and specialized options are:

Microsoft.Extensions.Caching.SqlServer

Microsoft.Extensions.Caching.StackExchangeRedis

NCache.Microsoft.Extensions.Caching.OpenSource

From Windows Server 2019 to Windows Server 2022

Windows Server 2022 is now in preview and is planned for release later in 2021. See this article from the Windows Server team. Note that one of the conditions of use is that you do not use a preview server in a production environment. 

The new 2022 Server brings some Azure innovations on-premise.  

This includes Azure Arc which aims at simplified management of hybrid and multi-cloud environments as well as Storage Migration Service which makes it easy to migrate data from older Windows Server installations to Azure or Windows Server 2019/2022.

The secured-core server is key to WS2022 design. This is a response to the rise in cyberattacks on servers targeted for ransomware attacks or bitcoin mining for example.

Firmware protection is one dimension of the security of the new design. There is evidence that ransomware platforms are adding firmware exploitation capabilities.  There have been attacks e.g. on Active Directory Domain Controllers. DMA protection is one of the defence mechanisms utilized.

Virtualization based security (VBS) is one of the pillars of the secure-core server design. Features  included such as Hypervisor-Protected Code Integrity (HVCI) - also part of Windows 10 (which has some known issues with device drivers).

Sunday 27 June 2021

ASP.NET Razor - What is it?

ASP.NET Razor is a (server-side) markup language, that allows you to embed server-based code into web pages (Visual Basic and C#).

Razor syntax is similar to PHP and Classic ASP.

The following Razor code outputs a series of list items.

<ul>

@for (int i=0; i<5; i++) {

<li>@i</li>

}

</ul>

The foreach loop is of course also supported in Razor.

Saturday 26 June 2021

Stateful Services in Service Fabric

Managing state reliably in a distributed system is a challenge. Service Fabric rises to the challenge. The key hazards of a distributed system:

1. Messages can get lost

2. Failure of a node

3. Communication channel stalls

So when a stateful service needs to persist state, it must use a Reliable Collection! SF provides reliable Dictionaries and reliable Queues to serve this end.

Reliable data structures are distributed data structures but can be used as if they are local data structures.

Reliable collections are persisted by a Reliable State Manager component (which is represented by a class in the Microsoft.ServiceFabric.Data namespace which lives in the Microsoft.ServiceFabric.Data.dll in the Azure SDK).

The states are replicated by a Transactional Replicator to secondary replicas for availability and reliability.

Most stateful services inherit from a StatefulService class.


Friday 25 June 2021

Understanding SMB 3.0 For Cloud Storage

SMB 3.0 stands for Server Message Block 3.0.  It was introduced in Windows Server 2012. Azure Files offers serverless file shares using the SMB 3.0 protocol.

Thursday 24 June 2021

Microservices Is About Composing Not Decomposing

Configuring Inbound Ports on your Azure VM

When you create an Azure VM you are defaulted to have port 3389 open for inbound communication. This port is used by the Remote Desktop Protocol (RDP). All Windows boxes are by default RDP servers. They listen on TCP port 3389 and UDP port 3389.

Comparison Corner: Azure Service Fabric versus Kubernetes

 Kubernetes - is an orchestration solution

How Much is a Linux Box on Azure?

An Ubuntu Server D2S in Azure will cost around $70 a month. This is the same for SUSE Linux, or Windows 10 Pro, or Windows Server 2019 Datacenter - Gen1, with 2 vCPUs and 8 Gb memory.

What is the Azure Portal?

 The Azure Portal is the place to manage your Azure subscription. Its URL is portal.azure.com.

What are Av2-Series and B-Series VMs in Azure? What other VM types are there?

The Av2 series of Azure VMs are suited for entry level workloads like Development and Test. Proof of concepts can be run Av2 series VMs.

The B-series of Azure VMs previewed in 2017. 

They are adapted for bursty workloads such as web server that uses very little CPU until some particular request comes in. 

While not utilizing the baseline performance of the CPU, the VM builds up credits.  

When the VM builds up enough credits, you can burst your usage up to 100% of the vCPU for the period of time your application requires the higher CPU performance.

The B-series VMs are available in Windows and Linux variants.

There are quite variety of other types of VMs including DC series, designed to protect confidentiality and integrity of code and data.

Wednesday 2 June 2021

Basic Subsystems of Azure Service Fabric

To understand the architecture of Azure Service Fabric (or A18F) we must first be aware of, and understand, the subsystems underneath it.

First we consider the Transport Subsystem. This provides secure point-to-point communication channels within a Service Fabric cluster and between a Service Fabric cluster and its clients. 

Then you have the Federation Subsystem. This forms the foundation of a unified cluster and comprises provision of failure detection, leader election and consistent routing.

The Reliability Subsystem is really important. This manages state replication, failover and load balancing; necessities in a highly reliable and available subsystem.

Recall:

1. Failover is when a request is redirected to an alternate server

2. Load balancing is about distributing request processing across multiple servers

The Management Subsystem relates to managing applications. It has services to manage application binaries; deploying, updating and deprovisioning applications and monitoring application health.

The Hosting Subsystem is responsible for managing application lifecycles on a cluster node.

The Communication Subsystem is actually strangely named. It is more of a "service discovery" subsystem. With workloads and infrastructure separated, services may migrate from host to host. The naming service provided by the communication subsystem allows clients to discover and connect to service instances.

The Testability Subsystem is perhaps the most interesting.  It can simulate various failure scenarios to help developers find and address design and implementation deficiencies

Tuesday 1 June 2021

Azure Service Fabric Basics

Azure Service Fabric is Microsoft's Platform-as-a-Service (PaaS) offering for developers looking to host scalable and highly available distributed systems.

Microsoft has used it for years to support: 

Skype for Business | Cortana | Intune (a cloud-based MDM -> Mobile Device Management | Azure Cosmos DB amongst other things.

ASF was open-sourced in March 2018.