What are microservices





















  • Development is simple and direct, centralized management
  • Basically no duplication of development
  • Functionality is local, with no distributed administrative overhead or invocation overhead





  • Low development efficiency: all developers change code in a project, submit code waiting for each other, code conflicts
  • Code maintenance is difficult: The code is functionally coupled and newcomers don’t know where to start
  • Inflexible deployment: Build times are long, and any small changes must rebuild the entire project, which is often a long process
  • Poor stability: A trivial problem that can cause an entire application to fail
  • Poor scalability: Unable to meet the service requirements under high concurrency


















Advantages of microservices architecture




















Weaknesses and challenges of microservices architecture






































  • API Gateway
  • Interservice invocation
  • Service discovery
  • Service fault tolerance
  • Service deployment
  • The data call









First generation microservices framework

Spring Cloud


  • Spring Cloud Config: Centralized external configuration management supported by Git repositories. Configuration resources are mapped directly to the Spring Environment, but can be used by non-Spring applications if needed.
  • Spring Cloud Netflix: Integrates with various Netflix OSS components (Eureka, Hystrix, Zuul, Archaius, etc.).
  • Spring Cloud Bus: An event Bus for associating services and service instances with distributed messaging. Used to propagate state changes (such as configuration change events) across the cluster.
  • Spring Cloud for Cloudfoundry: Integrate your application with Pivotal Cloudfoundry. Provides service discovery implementations, easily protects resources with SSO and OAuth 2, and creates Cloudfoundry service proxies.
  • Spring Cloud – Cloud Foundry Service Broker: Provides a starting point for building a Service Broker that manages a Service in Cloud Foundry.
  • Spring Cloud Cluster: Leadership election and generic state model (based on abstractions and implementations of ZooKeeper, Redis, Hazelcast, Consul).
  • Spring Cloud Consul: Service discovery and configuration management with Hashicorp Consul
  • Spring Cloud Security: support for load-balanced OAuth 2 sleep clients and authentication header relays in Zuul proxy.
  • Spring Cloud Sleuth: Distributed tracing for Spring Cloud applications, compatible with Zipkin, HTrace, and log-based (for example, ELK) tracing.
  • Spring Cloud Data Flow: Cloud-native choreography services for composable microservice applications for modern runtimes. The easy-to-use DSL, drag-and-drop GUI, and REST-API together simplify the overall choreography of microservices-based data pipelines.
  • Spring Cloud Stream: Lightweight event-driven microservices framework for quickly building applications that can connect to external systems. A simple declarative model for sending and receiving messages between Spring Boot applications using Apache Kafka or RabbitMQ.
  • Spring Cloud Stream Application Starters: The Spring Cloud task application launcher is a Spring Boot application, which can be any process, including Spring Batch jobs that don’t run forever, and which terminate/stop after limited time of data processing.
  • Spring Cloud ZooKeeper: Discovers and manages ZooKeeper services.
  • Spring Cloud for Amazon Web Services: Easily integrate hosted Amazon Web Services. It easily integrates AWS services, such as caching or messaging APIs, using Spring’s IDIOMS and APIs. Developers can build applications around managed services, regardless of the infrastructure.
  • Spring Cloud Connectors: Make it easy for PaaS applications to connect to back-end services such as databases and messaging brokers (formerly known as “Spring Cloud” projects) on a variety of platforms.
  • Spring Cloud Starters: As a Spring Boot-based startup project with reduced dependency management (not as a standalone project after Angel.sr2).
  • Spring Cloud CLI: Plug-ins support the rapid creation of Spring Cloud component applications based on Groovy predictions.


Dubbo


  • Remote communication: Provides an abstract encapsulation of a variety of long-connection-based NIO frameworks, including multiple threading models, serialization, and request-response mode of information exchange.
  • Cluster fault tolerance: Provides transparent remote procedure calls based on interface methods, including multi-protocol support, and cluster support for soft load balancing, failure tolerance, address routing, and dynamic configuration.
  • Automatic discovery: Based on registry directory services, service consumers can dynamically find service providers, address transparency, and service providers can smoothly add or subtract machines.









Next-generation microservices: Service Mesh?

Service Mesh








  • An intermediate layer of communication between applications
  • Lightweight Web proxy
  • The application is not aware
  • Decouple application retry/timeout, monitoring, tracing, and service discovery


















Linkerd















  • Load balancing: Linkerd provides a variety of load balancing algorithms that use real-time performance metrics to distribute load and reduce tail latency across the application.
  • Fuses: Linkerd includes automatic fuses that will stop sending traffic to instances deemed unhealthy, giving them a chance to recover and avoid a chain reaction failure.
  • Service discovery: Linkerd integrates with various service discovery backends to help you reduce the complexity of your code by removing ad-hoc service discovery implementations.
  • Dynamic request routing: Linkerd enables dynamic request routing and rerouting, allowing you to set up staging services, Canaries, blue-green deployments with minimal configuration. Cross DC failover and Dark traffic.
  • Number of retries and deadline: Linkerd can automatically retry requests during certain failures and can timeout requests after a specified period of time.
  • TLS: Linkerd can be configured to send and receive requests using TLS, which you can use to encrypt communication across host boundaries without modifying existing application code.
  • HTTP Proxy integration: Linkerd can be used as an HTTP proxy and is widely supported by almost all modern HTTP clients, making it easy to integrate into existing applications.
  • Transparent proxy: You can use the Iptables rules on the host to set up transparent proxies through Linkerd.
  • GRPC: Linkerd supports HTTP/2 and TLS, allowing it to route gRPC requests, and supports advanced RPC mechanisms such as bidirectional flow, process control, and structured data loading.
  • Distributed Tracing: Linkerd supports distributed tracing and measurement instruments that provide uniform visibility across all services.
  • Instrumentation: Linkerd supports distributed tracking and measurement instruments that provide uniform visibility across all services.


Envoy














  • External process architecture: works with applications developed in any language; Fast upgrade.
  • Based on the new C++11 encoding: provides efficient performance.
  • L3/L4 filter: The core is a L3/L4 network agent that can be plugged into the main service as a programmable filter to implement different TCP proxy tasks. Write filters to support tasks such as raw TCP proxy, HTTP proxy, TLS client certificate authentication, and so on.
  • HTTP L7 filters: An additional HTTP L7 filter layer is supported. The HTTP filter is plugged into the HTTP link management subsystem as a plug-in to perform various tasks such as buffering, rate limiting, routing/forwarding, sniffing Amazon DynamoDB, and so on.
  • HTTP/2: In HTTP mode, HTTP/1.1 and HTTP/2 and HTTP/1.1 and HTTP/2 bidirectional proxies are supported. This means that any combination of HTTP/1.1 and HTTP/2 can be bridged between client and target servers.
  • HTTP L7 routing: In HTTP mode, routes and redirection based on the Content Type and Runtime values are supported. Can be used as a front-end/edge proxy for a service.
  • GRPC support: gRPC is an RPC framework from Google that uses HTTP/2 as the underlying multiplexer. GRPC requests and responses hosted by HTTP/2 can use Envoy routing and LB capabilities.
  • Support for MongoDB L7: Obtain statistics and connection records.
  • DynamoDB L7: Obtains statistics and connection information.
  • Service discovery: Supports multiple service discovery methods, including asynchronous DNS resolution and service discovery through REST request services.
  • Health check: Contains a health check subsystem to perform proactive health checks on upstream service clusters. Passive health checks are also supported.
  • Advanced LB: includes automatic retry, circuit breaker, global speed limiting, request blocking, exception detection. Support for request rate control is also planned for the future.
  • Front-end proxy: Can serve as a front-end proxy, including TLS, HTTP/1.1, HTTP/2, and HTTP L7 routes.
  • Excellent observability: Provides reliable statistical capability for all subsystems. Currently supports STATSD and compatible statistics libraries. Statistics can also be viewed through the management port, and a third-party distributed tracking mechanism is supported.
  • Dynamic configuration: Provides layered dynamic configuration apis that users can use to build complex centralized management deployments.


Istio














  • Traffic management: Controlling the flow of traffic between services and API calls to make the calls more reliable and make the network more robust in bad situations.
  • Observability: Understanding the dependencies between services and the nature and direction of traffic between them provides the ability to quickly identify problems.
  • Policy enforcement: Apply organizational policies to interactions between services to ensure that access policies are enforced and resources are well distributed among consumers. Policy changes are made by configuring the grid rather than modifying the application code.
  • Service identity and security: Provide verifiable identities for services in the grid and the ability to protect service traffic so that it can be moved across networks with different levels of confidence.





  • The data panel consists of a set of intelligent agents deployed as side cars to mediate and control all network traffic between microservices.
  • The control panel manages and configures agents to route traffic and enforce policies at run time.









Conduit








contrast





















Kubernetes + Service Mesh = Complete microservices framework


































The resources

  • Introduction to Microservices
  • Pattern: Microservice Architecture
  • Spring Cloud for Microservices Compared to Kubernetes
  • Istio
  • Envoy
  • Linkerd
  • That Microservice thing
  • Istio Chinese document
  • Linkerd Chinese document



Original link:A preliminary study on microservice architecture(By Xu Bei)