Prev Next

API / Microservices

1. Explain micro service architecture. 2. Explain the benefits of microservices. 3. Some of the challenges with Microservice. 4. Explain spring boot in the context of microservices. 5. What is Docker? 6. What is Dockerfile? 7. What is kubernetes? 8. What are polyglot microservices? 9. What is a service mesh? 10. What is distributed tracing? 11. Explain Trace and Span terminologies in distributed tracing. 12. How do I decompose an application into services? 13. What is Semantic monitoring in Microservices architecture? 14. What is Melvin Conway's Law? 15. What is Spring Cloud? 16. What is a CDC in Microservices? 17. What is PACT in Microservices Architecture? 18. What is a Client Certificate? 19. What is meant by Continuous Integration? 20. What is Blue-Green Deployment Technique? 21. Explain Monolithic vs SOA vs Microservices. 22. What are the best practices to design Microservices? 23. What is Domain-Driven Design (DDD)? 24. Why do we need Domain Derived Design (DDD)? 25. Different types of tests for microservices. 26. What is API Gateway? 27. Difference between Service orchestration and Service Choreography. 28. What is APIGEE? 29. Mention a few of the cross-cutting concerns that we need to implement for any microservice. 30. Drawbacks of using microservices. 31. Main components of Microservices. 32. Explain the importance of reports and dashboards in microservices. 33. Difference between API and microservice. 34. What are the three commonly used tools for Microservices? 35. How does a Microservice architecture work? 36. Different strategies used in Microservices deployment. 37. What does hystrix do? 38. Explain the concept of message-driven microservices using Spring Boot and Apache Pulsar. 39. What are the types of Microservice Communication? 40. What is decentralized in microservices?
Could not find what you were looking for? send us the question and we would be happy to answer your question.

1. Explain micro service architecture.

Microservices are design patterns, a variant of the service-oriented architecture (SOA) architectural style, structures an application as a collection of loosely coupled independent services. In a microservices architecture, services are fine-grained and uses lightweight protocols.

The advantage of decomposing an application into smaller services is to improve modularity, enables the application easier to understand, develop, test, and become more resilient to architecture erosion. It helps to parallelize development by enabling different teams to develop, deploy and scale its respective services/modules independently.

It also allows the architecture of an individual service to emerge through continuous refactoring. Microservices-based architectures enable continuous delivery and deployment.

2. Explain the benefits of microservices.

Modularity of large application into microservices help achieve loose coupling when one module failed keeps other modules unaffected and live. Fault isolation is highly improved.

Modularity also helps developer understand and write code, enables parallelizing developments of different modules.

Continuous integration (CI) and deployments made easier.

Improved scalability.

Bounded context- one micro service doesn't need to understand the implementation of the other.

Promotes the usage of its own technology stack per module, isolated from other modules which has zero impact on other modules.

Application troubleshooting and debugging will be quicker as it is easy to isolate which service to look into.

Containerization such as docker is easy and cloud friendly.

Smaller team.

3. Some of the challenges with Microservice.

Modularity in term of service may lead to duplication of efforts and code.

Application with too many modules make difficult to manage.

DevOps skill set may be required which lead to additonal resource challenge.

4. Explain spring boot in the context of microservices.

Spring boot provides easy means of creating stand-alone applications with minimal or no configurations. Spring boot provides default code and configurations required to start a spring project quickly.

5. What is Docker?

Docker is a container that packages software in a format that can run isolated on a shared operating system. Unlike VMs, containers do not bundle a full operating system, only the libraries, and settings required to make the software work.

This makes for efficient, lightweight, self-contained systems and guarantees that software will always run the same, regardless of where it is deployed.

6. What is Dockerfile?

Dockerfile describes the build process for an image. It is run to automatically create an image. It has all the commands necessary to build the image and run your application.

7. What is kubernetes?

Kubernetes is an open-source container orchestration system for automating deployment, scaling, and management of containerized applications.

8. What are polyglot microservices?

The polyglot microservices is based on polyglot programming, the practice of writing code in multiple languages to capture additional functionality and efficiency not available in a single language.

9. What is a service mesh?

Service mesh is used to describe the network of microservices that make up such applications and the interactions between them.

10. What is distributed tracing?

Distributed tracing systems allows tracking a request through a software system that is distributed across multiple applications, services, and databases as well as through proxies.

Distributed tracing allow us to measure the total time a request took to complete across multiple services. It helps gather timing data needed to troubleshoot latency problems in service architectures.

There are many distributed tracing systems like Zipkin, OpenTracing, etc.

11. Explain Trace and Span terminologies in distributed tracing.

A trace is an end to end latency graph, composing of the different spans.

A span is an individual operation that takes place, In a microservice architecture, a request may pass through a set of different services and each represents one span and altogether represents a trace.

12. How do I decompose an application into services?

We can decompose in several catogories.

  • Split by business functionality - define services corresponding to business capabilities.
  • Self-contained Service - design services to handle synchronous requests without waiting for other services.
  • Services by team.
13. What is Semantic monitoring in Microservices architecture?

Semantic monitoring also known as synthetic monitoring runs certain application's automated tests against the live production system on a regular basis in a specified interval. The results are published into the monitoring service, which triggers alerts in case of any failures. This technique combines automation testing with monitoring in order to detect failing business requirements in production.

Once an issue is detected, it allow faster isolation and bug triaging, thereby reducing the main time required to repair.

14. What is Melvin Conway's Law?

Melvin Conway's law states that the "Organizations which design systems are constrained to produce designs which are copies of the communication structures of these organizations."

15. What is Spring Cloud?

Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems such as configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state.

Coordination of distributed systems leads to boilerplate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns.

16. What is a CDC in Microservices?

CDC (Consumer-Driven Contract) is a pattern for developing Microservices so that external systems can use them.

Consumer-Driven Contracts is an approach to ensure service communication compatibility, in which Consumers and Providers make an agreement about the format of the data they transfer between each other. This agreement forms the so-called Contract.

17. What is PACT in Microservices Architecture?

PACT is an open-source tool to allow testing interactions between service providers and consumers in isolation against a contract.

It is a tool to implement Consumer-Driven contracts (CDC) in Microservices.

By using PACT you can test the consumer-driven contracts between consumer and provider of a Microservice. It is an automated suite to test this interaction that increases the reliability of Microservices integration.

18. What is a Client Certificate?

Client Certificate is a type of digital certificate usually used by client systems for making a request that is authenticated by a remote server. It plays an important role in authentication designs that are mutual and provides strong assurance of the identity of a requester. However, you should have a fully configured back-end service for authenticating your client certificate.

19. What is meant by Continuous Integration?

Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.

20. What is Blue-Green Deployment Technique?

Blue-green deployment is a technique that reduces downtime and risk by running two identical production environments called Blue and Green. At any time, only one of the environments is live, with the live environment serving all production traffic while the other is idle.

As you prepare a new version of your software, deployment and the final stage of testing takes place in an environment that is not LIVE (GREEN). Once you have deployed and fully tested the software in non-live (GREEN), you switch the router so all incoming requests now go to Green instead of Blue (earlier LIVE). Green is now live, and Blue is idle.

This technique can eliminate downtime due to application deployment. In addition, blue-green deployment reduces risk: if something unexpected happens with your new version on Green, you can immediately roll back to the last version by switching back to Blue.

21. Explain Monolithic vs SOA vs Microservices.

Monolithic Architecture: is "like a single and big container" where all the software components of an application are bundled together (tightly coupled). It is usually built as one large system and is one code-base.

SOA (Service-Oriented Architecture): is a group of services interacting or communicating with each other. Depending on the nature of the communication, it can be simple data exchange or it could involve several services coordinating some activity.

Microservice Architecture: It involves structuring an application in the form of a cluster of small, autonomous services modeled around a business domain. The functional modules can be deployed independently, are scalable, are aimed at achieving specific business goals, and communicate with each other over standard protocols.

22. What are the best practices to design Microservices?
  • Separate data store for each microservice,
  • Keep code at a similar level of maturity,
  • Separate build for each Microservice,
  • deploy into containers,
  • treat servers as stateless.
23. What is Domain-Driven Design (DDD)?

DDD focuses on 3 principles.

  • Focus on the core domain and its logic.
  • Find complex designs on models of the domain.
  • Constantly collaborate with domain experts to improve the application model and to resolve any domain-related issues.
24. Why do we need Domain Derived Design (DDD)?

25. Different types of tests for microservices.
  • Unit testing,
  • Exploratory test,
  • Acceptance testing,
  • Performance testing.
26. What is API Gateway?

An API gateway is an API management tool that sits between a client and a collection of backend services. An API gateway acts as a reverse proxy to accept all application programming interface (API) calls, aggregate the various services required to fulfill them, and return the appropriate result.

27. Difference between Service orchestration and Service Choreography.

Service orchestration represents a single centralized executable business process (aka, the orchestrator) that coordinates the interaction among different services. The orchestrator is the sole responsible for invoking and combining the services.

The relationship between all the participating services is described by a single endpoint (i.e., the composite service). The orchestration includes the management of transactions between individual services. Orchestration employs a centralized approach for service composition.

Service choreography is a global description of the participating services, which is defined by the exchange of messages, rules of interaction, and agreements between two or more endpoints. Choreography employs a decentralized approach for service composition.

The choreography describes the interactions between multiple services, whereas orchestration represents control from one party's perspective. This means that a choreography differs from an orchestration with respect to where the logic that controls the interactions between the services involved should reside.

28. What is APIGEE?

Apigee is a platform for developing and managing APIs. By fronting services with a proxy layer, Apigee provides an abstraction or facade for your backend service APIs and provides security, rate limiting, quotas, analytics, and more.

29. Mention a few of the cross-cutting concerns that we need to implement for any microservice.
  • Security - for example, REST APIs must be secured by requiring an Access Token,
  • Externalized configuration - includes credentials, and network locations of external services such as databases and message brokers,
  • Logging - configuring of a logging framework such as log4j or logback,
  • Health check - a url that a monitoring service can "ping" to determine the health of the application,
  • Metrics - measurements that provide insight into what the application is doing and how it is performing,
  • Distributed tracing - instrument services with code that assigns each external request an unique identifier that is passed between services.
30. Drawbacks of using microservices.
  • Communication between services is complex.
  • Debugging problems can be harder.
  • More complicated than most monolithic applications. Microservices involve a lot more moving parts than traditional applications, requiring enormous effort, careful planning, and strategically applied automation to ensure communication, monitoring, testing, and deployment processes run smoothly.
  • Compared to monolithic applications, microservices comes with some significant security challenges due to the sharp increase in the volume of data exchanged between modules.
31. Main components of Microservices.

Some of the main components of micro-services include:

  • Containers, Clustering, and Orchestration
  • IaC (Infrastructure as Code Conception)
  • Cloud Infrastructure
  • API Gateway
  • Enterprise Service Bus
  • Service Delivery
32. Explain the importance of reports and dashboards in microservices.

Monitoring a system usually involves the use of reports and dashboards. Using reports and dashboards for microservices can help with:

  • identify which microservices support which resources.
  • identify which services are impacted whenever changes are made or occur to components.
  • Make documentation easy to access.
  • Review deployed component versions.
  • identify the level of maturity and compliance from the components.
33. Difference between API and microservice.

An API is a contract that provides guidance for a consumer to use the underlying service.

A microservice is an architectural design that separates portions of a (usually monolithic) application into small, self-containing services.

34. What are the three commonly used tools for Microservices?

Wiremock is a free and open Source tool for building mock APIs. Creates stable development environments, helps isolate yourself from flakey 3rd parties and simulate APIs that don't exist yet.

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.

Hystrix, is a library designed to control the interactions between these distributed services providing greater tolerance of latency and failure.

35. How does a Microservice architecture work?

A Microservice application can be simplified into multiple modules that independently perform the single precise standalone task.

  • An application is fragmented into loosely coupled various modules, each of which performs a distinct function.
  • It is distributed across clouds and data centers.
  • Each application module is an independent service/process that can be replaced, updated, or deleted without disrupting the rest of the application. Under microservice architecture, an application can grow along with its requirements.

36. Different strategies used in Microservices deployment.

Multiple Service Instance per Host is used to run single or multiple service instances of the application on a single or multiple physical/virtual hosts.

Service Instance per Host is used to run a service instance per host.

Service Instance per Container is used to run each service instance in its respective container.

Serverless Deployment packages the service as a ZIP file and uploads it to the Lambda function. The Lambda function is a stateless service that automatically runs enough micro-services to handle all requests.

37. What does hystrix do?

Latency and Fault Tolerance: Stop cascading failures. Fallbacks and graceful degradation. Fail fast and rapid recovery. Thread and semaphore isolation with circuit breakers.

Realtime Operations: Realtime monitoring and configuration changes. Watch service and property changes take effect immediately as they spread across a fleet. Be alerted, make decisions, affect change and see results in seconds.

Concurrency: Parallel execution. Concurrency aware request caching. Automated batching through request collapsing.

38. Explain the concept of message-driven microservices using Spring Boot and Apache Pulsar.

Message-driven microservices using Spring Boot and Apache Pulsar leverage the publish-subscribe messaging pattern to enable loosely coupled and scalable communication between microservices. Apache Pulsar acts as the messaging system, and Spring Boot provides the necessary abstractions for consuming and producing messages.

With Pulsar's messaging features and Spring Boot's integration, you can implement event-driven architectures where microservices communicate asynchronously through messages. This ensures decoupling and fault tolerance.

39. What are the types of Microservice Communication?

There are two primary forms of communication between microservices.

Request-Response: One service invokes another service by making an explicit request, usually to store or retrieve data. The service then expects a response: either a resource or an acknowledgement.

Observer: Event based, implicit invocation where one service publishes an event and one or more observers that were watching for that event respond to it by running logic asynchronously, outside the awareness of the producer of the event.

40. What is decentralized in microservices?

A microservices deployment employing decentralized data management would serve the three resource types using three services: one service for user resources, one service for message resources, and one service for friend relationships. In addition each service has its own database. This way each service is independent and decentralized.

«
»
GraphQL Interview Questions

Comments & Discussions