Translate

Tuesday, 26 May 2020

Microservices Interview Questions & Answers or Microservices Real time Interview Questions & Answers

Microservices Interview Questions & Answers

1)      What is Microservices?

Ans: It is also known as the microservice architecture - is an architectural style that structures an application as a collection of services. That means they can be built by one or more small services and deploy.

 

2)      What are the advantages & disadvantages of Microservices?

Ans: Advantages:

a)      Independent Development: Each functionality you can develop a separate service and you can manage it and control it totally. You can deploy independently each service so no need to deploy entire architecture. If you have change in particular service then can change it and deploy only that service.

b)      Fault Tolerant/Isolation: If particular microservices goes down it does not affect the functionality of other services. Example: I have 50 services/application and that services working parallelly. If one of the applications fails means that can application not dependent on other services. If we take Monolithic architecture, if one service fails means that entire application will break down but in microservices not like that.

c)      Mixed Technology Stack: We have different microservices and independent approach towards to the development. You can go head and implement those technology. It means suppose one service can implement based on java or other services can be implement based on .Net.

d)      Scalability & Productivity: We can implement the small components in Microservices architecture; it is easier to development teams can be scale up or scale down by following requirement specific.

Disadvantages:

a)      Communication between services is complex: Since everything is now an independent service, you have to carefully handle requests traveling between your modules.

b)      More services equals more resources: Multiple databases and transaction management can be painful.

3)      What are the features of Microservices?

Ans:

a)      Decoupling: Your application can be easily decoupled or rather separated to have individual functionality. It means easily developed, maintainability and deployment.

b)      Continuous Deliver: You can release frequently of your application and system can continuously updated and modify.

c)      Responsibility: Every domain or every project is treated as product that means team will take a responsibility of that product then they will bring it live and tested.

d)      Decentralized: Microservices architecture individual component have individual databases. It embraces the concept of decentralized data management. Microservices prefer letting each service manage its own database, either different instances of the same database technology, or entirely different database systems.

e)      Agility: We can go easily build the application and also discard them if they are not needed because since following the decentralized data management.

 

4)      What are the characteristics of the microservices?

Ans:

a)      Organized on Business Capabilities: Splitting up into services organized around business capability.

b)      Smart endpoints and dumb pipes: You have different applications that requires decentralized and that has to be a way of communications basically.

c)    Products not projects: Most application development efforts that we see use a project model: where the aim is to deliver some piece of software which is then considered to be completed. On completion the software is handed over to a maintenance organization and the project team that built it is disbanded..

d)      Decentralized Governance

e)      Decentralized Data Management: Decentralization of data management presents in a number of different ways.

f)       Infrastructure Automation: Many of the products or systems being build with microservices are being built by teams with extensive of CD and CI.

g)      Design for failure:

5)      What are the best practice to design microservices?

Ans:

a)      Separate data storage for each microservices.

b)      Keep code at a similar level of maturity

c)      Separate build for each microservice.

d)      Deploy into containers

e)      Treat servers as stateless

f)       Fast delivery

6)      What is Domain Driven Design (DDD)?

Ans: It is an approach. That helps to collaborate all the teams together and also easy to creation of complex applications. It connects the related pieces of the software into an ever-evolving model.

a)      It focuses of the core domain and domain logic

b)      Find complex designs on models of the domain

c)      Constantly collaborate with domain experts to improve the application model and to resolve any domain-related issues.     

7)      Why there is a need of DDD?

Ans: Mapping to domain, reduce complexity, Testability, Maintainability, Context focused and ubiquitous language (It is used by all team members to connect all the activities of the team with the software). DDD design patterns grouped as strategic design patterns and tactical design patterns of DDD.

 

Context: The setting in which a word or statement appears that determines its meaning. Statements about a model can only be understood in a context.

Model: A system of abstractions that describes selected aspects of a domain and can be used to solve problems related to that domain.

Ubiquitous Language: A language structured around the domain model and used by all team members to connect all the activities of the team with the software.

Bounded Context: A description of a boundary (typically a subsystem, or the work of a specific team) within which a particular model is defined and applicable. Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD's strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their interrelationships.




CQRS: CQRS stands for Command Query Responsibility Segregation. At its heart is the notion that you can use a different model to update information than the model you use to read information. For some situations, this separation can be valuable, but beware that for most systems CQRS adds risky complexity.


 

8)      How does microservice architecture work?

Ans: The main idea behind a microservice architecture is that applications are simpler to build and maintain when broken down into smaller pieces that work seamlessly together. These modules communicate with each other through simple, universally accessible application programming interfaces (APIs).

 


 


9)      What are the pros and cons of Microservices architecture?

Ans:

Pros of Microservices architecture

Cons of Microservices architecture

Each of use different technologies

Increase troubleshooting challenges

Each microservices focuses on single business capability

Increase delay due to remote calls

Support individual deployable units

Increase efforts for configuration and other operations

Allows frequent software releases

Difficulty to maintain transaction safety

Ensure security of each service

Tough to track data across various service boundaries

Multiple services are parallelly developed and deployed

Difficult to move code between services.

 

10)  What is difference between Monolithic, SOA and Microservice architecture?

Ans:

Monolithic: It is an ancient word referring to a huge single block of stone. In software engineering, a monolithic pattern refers to a single indivisible unit. The concept of monolithic software lies in different components of an application being combined into a single program on a single platform. Usually, a monolithic app consists of a database, client-side user interface, and server-side application.

SOA: Service-oriented architecture is essentially a collection of services. These services communicate with each other. The communication can involve either simple data passing or two or more services coordinating some activity. 

Microservices:aka microservice architecture, is an architectural style that structures an application as a collection of small autonomous services modeled around a business domain.

 

Add caption

  


 

11)  What are the key differences between SOA and Microservices architecture?

Ans:

SOA

Microservices Architecture

Follows “share-as-much-as-possible” architecture approach

Follows “share-as-little-as-possible” architecture approach

Importance is on business functionality reuse

Importance is on the concept of “bounded context”

They have common governance and standards

They focus on people, collaboration and freedom of other options

Uses Enterprise Service bus (ESB) for communication

Simple messaging system

They support multiple message protocols

They use lightweight protocols such as HTTP/REST etc.

Multi-threaded with more overheads to handle I/O

Single-threaded usually with the use of Event Loop features for non-locking I/O handling

Maximizes application service reusability

Focuses on decoupling

Traditional Relational Databases are more often used

Modern Relational Databases are more often used

A systematic change requires modifying the monolith

A systematic change is to create a new service

DevOps / Continuous Delivery is becoming popular, but not yet mainstream

Strong focus on DevOps / Continuous Delivery

  

 

 

12)  What are the challenges with Microservice architecture?

Ans:

a)      Inter Service Communication: Microservices will rely on each other and they will have to communicate. A common communication channel needs to be framed using HTTP/ESB etc

b)      Automating the components:

c)      Configuration Management: Configuring these many microservices and having clear architecture for it can be a problem.

d)      Debugging & Monitoring: We have fault isolation, if some application fails it does not affect working of any other application that also means that continuously monitoring these applications.

e)      Cyclic Dependencies: Dependency management different across different services and their functionality is very important and cyclic dependencies can be a headache.

f)       Distributed logging: Different services will have its own logging mechanism, resulting GBs of distributed unstructured data.

13)  What is Cohesion?

Ans: Cohesion refers to the degree to which the elements inside a module being together. Good design has High Cohesion and Low Coupling. Coupling (Inter-Module Concept) refers to the interdependencies between modules, while cohesion (Intra-Module Concept) describes how related the functions within a single module are.

14)  What are different types of Test for Microservices?

Ans: Unit Testing, Exploratory Test, Acceptance Test and Performance testing

15)  What is Conway’s Law?

Ans: Conway's Law applies to modular software systems and states that: "Any organization that designs a system (defined more broadly here than just information systems) will inevitably produce a design whose structure is a copy of the organization's communication structure".

16)  What is End to End Microservices testing?

Ans: Microservices architecture is built with multiple smaller parts that are choreographed dynamically, end-to-end tests provide value by adding coverage of the gaps between the services.

 


 

17)  What is the use of Container in Microservices?

Ans: You can encapsulate your microservice in a container image along with its dependencies, which then can be used to roll on demand instances of microservices without any additional effort. It uses modularity. In single container have code libraries, microservices and database. It means your application works independently.

 



 

18)  What is DRY in Microservices architecture?

Ans: DRY stands for Don’t Repeat Yourself. It promotes concept of code reusability. Due to which people develop libraries and share these libraries. This sharing can result in tight coupling.

19)  What is a Consumer Driven Contract (CDC)?

Ans: CDC is a pattern for developing microservices to be used by external systems. In a microservice, there is a provider that builds it and there are one or more consumers that use the microservice.

 

General approach is for provider to specify its interface in an XML like document. But in

CDC, each consumer of service provides the interface it expects from provider. In this way, a Provider can never introduce a breaking change if it keeps adhering to the CDC.

20)  What is Reactive Extensions in microservices?

Ans: Reactive Extensions is a design approach in which we collect results by calling multiple services and then compile a combined response.

Wednesday, 5 April 2017

What's New in Visual Studio 2017

Visual Studio 2017


Visual Studio 2017 Poster

              Since we launched Visual Studio 2017, many customers already installed and started using Visual Studio 2017, and we’re excited to see what you create. Visual Studio 2017 contains so many new features.

Note : You Can Download Clearly explained Full Poster in PDF  https://aka.ms/vsposter.pdf

Run To Click Debugging in Visual Studio 2017

           
            You have many options when navigating through your code with the debugger in Visual Studio including setting breakpoints, stepping, and using Run to Cursor. In Visual Studio 2017 we have introduced Run to Click, a new way to more easily debug your code – point and click style. You no longer need to set temporary breakpoints or step several times to execute your code and stop on the line you want. You now can get all the benefits of Run to Cursor (Ctrl+Shift+F10) without searching through the context menu or taking your hand off the mouse for a two handed shortcut combination. Run to Click works while debugging in any programming language in VS including C#, VB, C++, and Python.

             This is especially useful if you naturally have one hand on the mouse while debugging to inspect variables with data tips in your code. You can quickly Run to Click a line of code, inspect the variables on that line, and then continue debugging all while keeping focus and attention in that location. Run to Click between the same method, different methods, and within loops!




Special Notes


            Remember that Run to Click will run the execution of your application that you are debugging until that line of code is reached.

  •  If you click on a line of code that won’t be hit, the application with finish executing.
  • If you click on a line of code that resumes the application waiting for additional user input, once that code path is triggered by the input, you will break where you performed the Run to Click.
  • If you Run to Click on a line and the execution path triggers a breakpoint, the debugger will stop at any breakpoints in the path. When you hit “continue” (F5) execution will continue and you will stop on the line where you triggered run to click (just like if you had set a breakpoint on that line).
You can turn off Run to Click from the checkbox Debug/Options/Enable Run to Click.


Announcing New ASP.NET Core and Web Development Features in Visual Studio 2017

              We are pleased to announce updates to our ASP.NET tools, ASP.NET Core tools, Container tools, and frameworks that are shipping as part of the Visual Studio 2017 release today.  We have made significant updates to the web development tools to make them easier for you to use and help make you more productive in your daily web development tasks.

ASP.NET Core Tooling


               Visual Studio 2017 and it’s .csproj tooling is the tooling for ASP.NET Core moving forward. Customers should plan to migrate their applications to the new .csproj tooling.
               With Visual Studio 2017, we have delivered updates that complete the experience for ASP.NET Core developers.  ASP.NET Core is available in the Web and .NET Core sections of new projects:


               The new ASP.NET Core project template screen has some minor updates, and still makes available the choice of three web templates: Empty, API, and Web Application.




             You can now choose to use ASP.NET Core 1.0 or 1.1 using the combo-box at the top of the screen.  Additionally, you can choose to add Container support to your project with the checkbox at the bottom-left of the screen.  This option adds:
  • Docker files to your project for building Container images
  • a Docker Compose project to define how you instance your Containers
  • Multi-project/container debugging support for Containers.


We are now shipping templates with the following features:
  • Bower enabled by default, delivering the bootstrap, jQuery, and jQuery validation libraries and added to the wwwroot/lib folder by default.
  • We removed the package.json file for npm integration
  • We removed gulpfile.js file for JavaScript task processing.
                  Existing projects using npm, grunt, or gulp will continue to enjoy the features we added for those frameworks, including the npm package management experience and the Task Runner Explorer. npm, Gulp, and Grunt features can still be added and enabled on new projects.  We now ship with a bundleconfig.json that activates the simplified resource bundler.  More information about configuring the bundler can be found on the extension’s GitHub wiki.

.NET Core csproj Support


                  Starting with Visual Studio 2017 and the .NET Core SDK 1.0 release, we exclusively support the updated MSBuild file format.  If you have an older project that uses the project.json format, it will be converted to the new format the first time you open it with Visual Studio 2017.
                   In the csproj project file for your project you will notice a dramatic simplification of the project references.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>
<PropertyGroup>
<UserSecretsId>aspnet-MyCoolWebApplication-e119bc96-38e9-44ab-b4d3-d54964ade9b1</UserSecretsId>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
</Project>

In particular, the project file now has the following features activated by default:
  • An “Sdk” attribute on the Project root-element that is set to “Microsoft.NET.Sdk.Web”. This instructs the project system to manage this project with tooling to support an ASP.NET Core project that delivers a web endpoint with appropriate defaults.
  • A collection of “PackageReference” elements. These items are NuGet packages that should be installed and referenced by our project.  The packages.config file is no longer needed.
  • A collection of “DotNetCliToolReference” elements. These items enhance the dotnet command-line tool to give it features necessary to build and manage this project.  In the sample above, it enables the Entity Framework tools and the User Secret manager.

New DotNet New Templates

             The dotnet command-line tool has new templates for the creation of new .NET Core projects.  When you run “dotnet new” now, you will see a selection of templates that you can choose from:


                This now makes it very easy to understand the project templates that are available, and the languages that are supported for each.  Additionally, it is very easy to create your own templates or download other templates to use.  Instructions for building your own templates are on the project templates wiki.  An in-depth walk-through of the dotnet new experience can be found on the .NET Blog.

Debug Your Applications with Google Chrome

               Visual Studio has supported client-side JavaScript debugging with Internet Explorer for a long time.  With Visual Studio 2017, you can now add the Google Chrome browser to the list of supported client-side debuggers.  If you use Google Chrome as your browser at Debug time, you will be able to hit breakpoints and step through the JavaScript and TypeScript code executing in the browser.  More details about this feature are in the client-side debugging announcement blog post.

Container Tooling Updates

            Containers are now easier than ever to use with your projects in Visual Studio 2017.  For your ASP.NET Core projects, you can choose to add Docker container support at project creation time, and you can also add Docker support to your existing projects by right-clicking on the project in the Solution Explorer and choosing the Add – Docker Support menu option.
            To make it easier to work with single and multiple projects, we moved the docker-compose configuration to a separate project in your solution explorer.




              If you want to debug your project inside of the container, set the docker-compose project as the startup project.  You can still set your project as the startup project and debug on your local machine without effecting any containers.
               Since we are using a standard docker-compose file, you are free to add other containers into the mix that should be launched when you debug your solution.  Add your favorite database, load-balancer, or other service images into your docker-compose to allow you to work with those resources while you debug your ASP.NET application. Those additional containers may be written in other languages, but you can still instance them during your debugging session.
               When compiling your code, you can now build your solution directly in a Docker container, representing how your build system can compile your code. Running the following code will volume mount your solution, execute “dotnet restore” and “dotnet publish” in the container, generating the compiled output to place in your optimized Docker images.
docker-compose -f docker-compose.ci.build.yml up

ASP.NET with Windows Container Support

                 We didn’t limit our support for Docker containers to only the ASP.NET Core projects, we’ve added support for ASP.NET (.NET Framework) applications as well.  You can use the same commands to add Windows container support to your favorite ASP.NET Web Forms, MVC, or Web API projects easily.  These applications will launch and run inside of a Windows container that is configured with IIS and the latest version of the .NET Framework.
FROM microsoft/aspnet
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .



                  Before you can run .NET Framework in Windows Containers locally, make sure that you have the latest version of Docker for Windows and that you have switched to Windows Containers using the Docker systray icon.

Publish Your Application

                 When it comes time to publish your application, you will find a greatly improved experience when you choose the Publish action on your project.




You can now choose to publish to the following locations:

  • Azure App Service, including Linux Container Deployments (if Docker is enabled for your ASP.NET Core project).
  • IIS, FTP.
  • A folder.
  • An Azure Virtual Machine.
            If you have your application configured with Docker support, the publish option will allow you to publish your application as a container to your own Azure Container Registry and deploy to Azure App Service Linux using containers.





           Publishing to your own container registry makes it easier for you to re-use your container to deploy new versions or more instances easily.

Recommended Visual Studio Extensions

           There are two extensions that we recommend adding to your Visual Studio 2017 installation to assist with ASP.NET Core application development:


  • The Project File Tools extension provides intellisense for NuGet packages when hand-editing a csproj file
  • The Razor Language Service provides intellisense, syntax highlighting, and tooltip support for ASP.NET Core Razor Tag Helpers in Visual Studio 2017.

        To learn more about ASP.NET Core and Razor Tag Helpers, see the Intoduction to Tag Helpers in ASP.NET Core on the doc.microsoft.com website. To create your own custom Tag Helpers, see Introduction to Authoring Tag Helpers in ASP.NET Core.


        Additionally, the new Web Essentials 2017 extension pack includes both of these extensions and a number of other helpful tools for any web developer.



Thanks For Reading...
Jagan Mohana Rao