Azure Service Fabric


1)  What is Azure Service Fabric?

Ans: Azure Service Fabric is a distributed systems platform which eases the work of deploying, packaging and managing reliable and scalable microservices. It also handles noteworthy problems related to the development of cloud applications.

 

Service Fabric represents the next-generation platform for building and managing these enterprise-class, tier-1, cloud-scale applications running in containers.

 

2) What is node in Azure Service Fabric?

Ans: A Service Fabric cluster is a network-connected set of virtual or physical machines into which your microservices are deployed and managed. A machine or VM that’s part of a cluster is called a node. Virtual machine scale sets are an Azure compute resource that you use to deploy and manage a collection of virtual machines as a set. Every node type that is defined in an Azure cluster is set up as a separate scale set.

 

3) What is a Cluster in Service Fabric?

Ans: A Service Fabric cluster is a network-connected set of virtual or physical machines into which your microservices are deployed and managed. A machine or VM that is part of a cluster is called a cluster node. Clusters can scale to thousands of nodes.

 

4) How does Service Fabric relate to containers?

Ans:Containers offer a simple way to package services and their dependencies such that they run consistently in all environments and can operate in an isolated fashion on a single machine. Service Fabric offers a way to deploy and manage services, including services that have been packaged in a container.

 

5) What are the Advantages of Azure Service Fabric?

·       Fast deployment times as creation of virtual machines are time consuming while in service fabric its quick to deploy in clusters.

·       High density hosting as we can deploy large number of applications to smaller number of VMs.

·       Ability to run in any environment or in any operating systems. Not mandatory to be in Azure, can run in on-premises also.

·       Distributed application management.

 

6) What is a MicroService?

Microservice applications are composed of small, independently versioned, and scalable customer-focused services that communicate with each other over standard protocols with well-defined interfaces

Service Fabric is agnostic on how you build your service, and you can use any technology. However, it does provide built-in programming APIs that make it very easy to build microservices.

 

7) What are the types of microservices are available?

Types of MicroServices:

Stateless Microservices:

Stateless microservices (protocol gateways, web proxies, etc.) do not maintain a mutable state outside of any given request and its response from the service. Azure Cloud Services worker roles are an example of a stateless service.

Stateful Microservices:

Stateful microservices (user accounts, databases, devices, shopping carts, queues, etc.) maintain a mutable, authoritative state beyond the request and its response. Today’s Internet-scale applications consist of a combination of stateless and stateful microservices.

 

8) Is fabric a PaaS service?

Beyond just spinning up a cluster of IaaS VMs, Azure Service Fabric is a full “custom PaaS” system. It also allows you to easily scale and manage your micro-services that are hosted within that “custom PaaS” service as well. Azure Service Fabric is a full “custom PaaS” system.

 

9) What is cloud computing?

It is the use of servers on the internet to “store”, “manage” and “process” data. The difference is, instead of using your own servers, you are using someone else’s servers to do your task, paying them for the amount of time you use it for.

 

10) What is Azure Cloud Service?

Cloud service can convey a multiple web application in Azure, characterizing a number of parts to disseminate handling and permit adaptable scaling of your application. A cloud service comprises of a minimum of one web pars as well as specialist parts, each with its own particular application documents and design.The fundamental favourable position of cloud service is the capacity to help more complex multi-level structures.

 

11) Explain Cloud Services vs Service Fabric?

Applications and infrastructure:In Cloud Services we deploy applications as Virtual Machines where the code is coupled to an instance. There is no difference between an application and VM definition here as both are considered as one, while in Service Fabric we just deploy our applications into existing virtual machines where the service is completely decoupled from the underlying infrastructure.

Application architecture :

We might be having a lot of external service dependencies in cloud service architecture like tables, storage and cache. The service fabric can also follow the same by just replacing the cloud service deployment with the service fabric stateless services in a simple migration with minimal code change or use stateful features by writing some custom services.

Communication and workflow :

The communication between different tier in case of cloud service and service in case of Service Fabric happens commonly in two models: direct and via an external durable storage. In cloud services tiers communicate directly by selecting the instance of the VM role and connecting to the endpoint directly, while in service fabric we just connect to a service.

12) What is Service type in Azure Service Fabric?

  A service type is a coding unit or a configuration which runs independently. An application type can have one or more service types. For example, Queue Service.

 

13) What is Application type in Azure Service Fabric?

The application type is a collection of one or more service types or we can describe them as a collection of microservices.

 

14) What is service fabric Explorer?

Service Fabric Explorer (SFX) is an open-source tool for inspecting and managing Azure Service Fabric clusters. Service Fabric Explorer is a desktop application for Windows, macOS and Linux

 

15) What are the different programming models supported by Azure Service Fabric?

·       Reliable Services

·       Reliable Actors

·       Containers

·       ASP.NET Core

·       Guest Executables

16) What is Reliable Services?

Reliable Services in Azure Fabric are services addressing single or multiple business concerns. However they are different from the normal web services that we usually develop. By design they are reliable, scalable, highly available and consistent as they are hosted on multiple nodes, partitions and replicas in a cluster.

Reliable services can easily access rest of Service Fabric APIs and due to this they can discover other services with ease, communicate with other services, can do health reporting and much more.

 

17) What is Reliable Actors?

Reliable Actors are based on Actor programming model

An actor has three primary components,

·       Code to achieve business functionality

·       Storage to persist Service state

·       Communication system or a mailbox queue to store messages sent by other actors that it will process.

To achieve parallel processing the client can talk to multiple actors. Though the actors can run in parallel, each actor can process the messages it has received in its queue sequentially.

 

In case of Azure Service Fabric the actors are denoted as Virtual Actors. They are not explicitly created or destroyed in the memory rather they get activated or created when the first call or invocation is made. The actor object gets destroyed when it is not used for some period of time.

The Reliable Actor model is based on top of Reliable Stateful Service model. A Virtual Actor consists of Reliable Stateful Service that addresses the need to have code and a persistant state. The communication part is handled using Service Remoting.

 

18) What is Container?

Azure Container Instances is a service that enables a developer to deploy containers on the Microsoft Azure public cloud without having to provision or manage any underlying infrastructure. Service Fabric is Microsoft’s container orchestrator for deploying microservices across a cluster of machines.

 

19) What is an Application package in Azure Service Fabric?

The collection of service code packages and the configuration files combined for a particular application. These are the physical files that are deployed, and they are simply in a file and folder format layout. For example, an application package for an email application could contain a queue service package, a front-end service package, and a database service package.

 

20) What are the benefits of using container with Service Fabric?

Compared to virtual machines, containers have the following advantages:

 

·       Small: Containers use a single storage space and layer versions and updates to increase efficiency.

·       Fast: Containers don’t have to boot an entire operating system, so they can start much faster–typically in seconds.

·       Portability: A containerized application image can be ported to run in the cloud, on premises, inside virtual machines, or directly on physical machines.

·       Resource governance: A container can limit the physical resources that it can consume on its host.

 

21) Explain the advantages of the container over virtual machines.

 Below are the advantages of the container over virtual machines.

1. Smart: Use a single storage space and layer versions to increase efficiency

2. Fast: Start faster as no need to boot an operating system

3. Portability: Application image can be ported to run on the cloud, virtual machines, premises or physical devices

4. Resource Governance: Resources can be limited consumed by the host.

 

22) What is Azure Fabric?

Azure Service Fabric is a distributed systems platform that simplifies the packaging, deployment, and management of scalable and reliable microservices and containers. Service Fabric also addresses the significant challenges associated with the development and management of cloud native applications.

 

23) What is an Azure service fabric cluster?

 

A Service Fabric cluster is a network-connected collection of virtual or physical machines where your microservices will be deployed and managed. A cluster node is a machine or virtual machine that is part of a cluster. Clusters have the ability to scale to thousands of nodes.

24) What is difference between Kubernetes and Service Fabric?

Azure Service Fabric is a distributed systems platform that simplifies the packaging, deployment, and management of scalable and reliable microservices. Kubernetes, on the other hand, is defined as "managing a cluster of Linux containers as a single system to accelerate development and simplify operations".

 

25) Explain the Microservices architecture on Azure Service Fabric?

Ans:

This reference architecture demonstrates a microservices architecture that has been deployed to Azure Service Fabric. It represents a basic cluster configuration that can serve as a starting point for the majority of deployments.

The architecture is composed of the following components:

Service Fabric cluster

A network-connected collection of virtual machines (VMs) where your microservices are deployed and managed.

Virtual machine scale sets

You can use virtual machine scale sets to create and manage a group of identical, load-balanced, autoscaling VMs. It also includes the domains for faults and upgrades.

 

Nodes

The nodes are the VMs in the Service Fabric cluster.

Node types

A node type is a virtual machine scale set that deploys a group of nodes. There is at least one node type in a Service Fabric cluster. One node type must be assigned as the Primary node type in a cluster with multiple node types.

Services

A service is a self-contained function that can be started and stopped independently of other services. Instances of services are deployed to cluster nodes. In Service Fabric, there are two types of services:

·       Stateless service

A stateless service does not keep track of its own state. State is written to and retrieved from an external store, such as Azure Cosmos DB, if state persistence is required.

·       Stateful service

The service state is stored within the service itself. Many other stateful services implement this using Service Fabric's Reliable Collections.

Service Fabric Explorer

The Service Fabric Explorer open-source tool is used to inspect and manage Service Fabric clusters.

Azure Pipelines

Pipelines is a component of Azure DevOps Services that automates build, test, and deployment processes. Third-party CI/CD solutions, such as Jenkins, are also available.

Azure Monitor

Azure Monitor gathers and stores metrics and logs, such as platform metrics for Azure services in the solution and application telemetry.

Azure Key Vault

Store any application secrets which are being used by the microservices, like connection strings, in Key Vault.

Azure API Management

API Management serves as an API gateway, accepting client requests and routing them to your services.


26. How do we deploy Microservices to Azure?

 

Docker, Azure Subscription, Azure CLI, and kubectl (Kubernetes command-line tool) are all needed to deploy your microservices.

 

Now we can follow below steps to deploy your microservices:

 

1. To deploy your microservices, you must first create an Azure Container Registry in the same location as your services and link it to a resource group. Container instances that will be deployed to a Kubernetes cluster will be managed by your registry.

2. Use the az group create command to create a resource group. Replace [location] with a region which is compatible with AKS and available for your subscription.

az group create -l [location] -n guideGroup

3. Create an Azure Container Registry using the Azure az acr command. Replace [registry-name] with a unique Azure container registry name which contains 5-50 alphanumeric characters. The az acr check-name -n [registry-name] command can be used to see if a registry name already exists.

az acr create -g guideGroup -n [registry-name] --sku Basic --admin-enabled

4. You must log in to your Azure Container Registry using the Azure CLI to push Docker images to your registry.

az acr login -n [registry-name]

5. Build and Uploading images to a container registry.

Package the microservices: mvn package

6. download or update to the latest Open Liberty Docker image:

docker pull openliberty/open-liberty:full-java11-openj9-ubi

 

7. build and containerize the application:

docker build -t system:1.0-SNAPSHOT system/.

docker build -t inventory:1.0-SNAPSHOT inventory/.

 

8. tag your container images with your registry.:

docker tag system:1.0-SNAPSHOT [registry-server]/system:1.0-SNAPSHOT

docker tag inventory:1.0-SNAPSHOT [registry-server]/inventory:1.0-SNAPSHOT

 

9. push your images to the registry:

docker push [registry-server]/system:1.0-SNAPSHOT

docker push [registry-server]/inventory:1.0-SNAPSHOT

 

10. Creates an AKS cluster guideCluster with the resource group guideGroup.

az aks create -g guideGroup -n guideCluster

 

11. Deploy your microservices to Azure Kubernetes Service: deploy the resources defined in the kubernetes.yaml file

kubectl create -f kubernetes.yaml

 

check the pods status:

kubectl get pods

 

12. Make requests to the microservices:

Explore the system service's information to determine its EXTERNAL-IP address:

kubectl get service/system-service

 

27) How to test your microservice in Azure?

Ans:

To test your microservices, use the Mavenfailsafe:integration-test, replacing [system-EXTERNAL-IP] and [inventory-EXTERNAL-IP].

mvn failsafe:integration-test -Dsystem.ip=[system-EXTERNAL-IP] -Dinventory.ip=[inventory-EXTERNAL-IP]

 

28) What are the most important aspects of securing your application on Azure Service Fabric?

Ans:

Below are some most important aspects of securing your application on Service Fabric:

Virtual network

To allow or reject network traffic, Network Security Groups (NSGs) can be added to subnets. While calling external Azure Services from the cluster, utilise Virtual Network service endpoints if the Azure service supports them.

For example, if you're storing data with Cosmos DB, configure the Cosmos DB account with a service endpoint that only allows access from a specific subnet. See using virtual networks to access Azure Cosmos DB resources.

 

Endpoints and interservice communication

To keep interservice communications secure, follow these steps:

·       Enable HTTPS endpoints.

·       Create a secure link between the reverse proxy and the services.

·       You can offload authentication to an API gateway if you're utilising one.

Secrets and certificates

In Azure Key Vault, you can keep secrets like connection strings to data stores.

Data at rest protection

If your services save data on data disk attached to the virtual machine scale sets of the Service Fabric cluster, you must encrypt the disk.

 

29) Define Azure Service Fabric.

Azure Service Fabric is termed as a stage for distributed systems that eases the work of deploying, packaging, and managing reliable and scalable microservices. It also handles noteworthy problems related to the development of cloud applications.

30) Define Service Fabric Cluster.

Service Fabric Cluster can be described as a shared pool of machines. These clusters can have thousands of machines and can expand their areas globally.

 

31) Describe the importance of application instances in Azure Service Fabric.

Application instance in Azure Service Fabric can be run as a separate process even though they are on the same Fabric Service node. One can have as many application instances of any type as they want in a cluster. Each application instance will have a specific name in a cluster and independently managed and versioned from the rest application instances of the same or different type. Moreover, resources and security isolation can be defined by them.

 

32) Define cluster in Azure Fabric Service

A cluster can be described as a collection of virtual/physical machines that are connected by a network. On these machines only, application instances are getting deployed.

 

33) Define node in Azure Fabric Service

A node in a cluster is an addressable unit. It has unique IDs and placement properties. The cluster can be formed as different nodes.

 

34) Does a cluster have any minimum size limit? If yes, what and why?

Yes. Azure supports a minimum of 5 nodes for the production environment for a Service Cluster. For dev/test environments, Azure supports three nodes of the cluster. This minimum node requirement exists as Azure runs a collection of Stateful Services. These services are directly dependent on consistency. And this strong consistency is directly dependent on the ability of any service to obtain a quorum for an update to the state of them. Quorum amounts to the majority of replicas for a given service.

 

35) Define Service type in Azure Service Fabric.

A service type is a coding unit or a configuration that runs independently. An application type can have one or more service types. For example, Queue Service

 

36) Define Service instance in Azure Service Fabric.

The service instance can be defined as code which instantiated for each service type. Every service instance is associated with a specific application instance and will have a unique name.

 

37) Define application package in Azure Service Fabric

Application packages are composed of service code packages and configuration files of a particular application. For example, an email application package is a combination of a front-end service package, queue service package, and database service package.

 

38) Explain MicroService.

MicroService applications are formed of scalable, compact, stand-alone, and customer-focused services, which converse with each other using standard protocols and well-defined interfaces.

 

39) Describe different types of MicroServices.

Below are two types of MicroServices:

1. Stateless Microservices – they don’t continue to keep an inconsistent state outside of any request and its response from the service. For example, Azure Cloud Services worker roles, web proxies, etc.

2. Stateful Microservices – They continue to keep an inconsistent state beyond the request and its response from the service. For example, Shopping carts, queues, etc.

 

Today’s Internet-scale applications composed of a combination of stateless and stateful microservices.

 

40) Define Application type in Azure Service Fabric.

The application type is a collection of one or more service types or we can describe them as a collection of microservices.

 

41) Brief about Programming models available in Azure Service Fabric.

To build applications in Azure Service Fabric, we have two programming models:

1. Reliable Services: An API to develop stateful and stateless services using StatelessService and StatefulService .NET classes and save state in .NET collections like dictionary and queue.

2. Reliable Actors: An API to build stateless and stateful objects using the virtual actor programming model that is suitable for applications with different independent units of state and compute.

 

42) How the Nodes in Service Fabric behave in case of OS updates?

As of now, nodes in Azure Service Fabric don’t receive OS updates automatically. Azure doesn’t support automatic OS updates in nodes of Service Fabric.

 

43) Is it feasible to turn off the cluster during weekends/night for saving money?

No, it is not at all a feasible option. If we turn off the cluster during weekends/nights when we restart them afterward, almost all the nodes will obtain a brand-new host and in turn, makes the system unrecoverable.

 

44) What is a Container?

The container is an individual component that can be run independently and as an isolated instance to gain the benefits of virtualization which an OS gives. It provides a varying environment for the application to run with different types of isolation.

 

45) Explain the advantages of the container over virtual machines.

Below are the advantages of the container over virtual machines.

1. Smart: Use a single storage space and layer versions to increase efficiency

2. Fast: Start faster as no need to boot an operating system

3. Portability: Application image can be ported to run on the cloud, virtual machines, premises or physical devices

4. Resource Governance: Resources can be limited consumed by the host.

 

46) Which two metrics affect resource governance that is supported in Service Fabric?

Two metrics affects resource governance, supported in Service Fabric:

 

1. CPU: metric name - servicefabric:/_CpuCores

2. Memory: metric name - servicefabric:/_MemoryInMB

These two metrics map total cluster capacity and how much load a node can bear.



No comments:

Post a Comment