1. Foreword In microservice development, there are generally two ways to call between services: Feign and RestTemplate. However, in actual use, especially Feign, there are various restrictions and limitations, such as: HTTP request method, return type, etc. Sometimes it makes you feel that everything is awkward. In microservice projects, calls between services are very common […]
Tag: grpc
gRPC interceptors and metadata
Article directory Introduction Client interceptor case Server-side interceptor case Authentication Introduction Users can pass additional information (i.e. HTTP/2 Header information) by accessing or modifying Metadata, such as authentication information, TraceId, RequestId, etc. Metadata stores data in the form of key-value. The key is a string type and the value is a string array type. The […]
gRPC gateway integrates swagger
1. Gateway integrates swagger 1. In order to simplify the actual combat process, the services exposed by gRPC-Gateway do not use https, but http, but swagger-ui The calling service provided by The service is https, so you need to specify swagger in the proto file to call the service with http. When specifying files will […]
Implementing gRPC load balancing in a kubernetes environment
Foreword I wrote an introductory article about gRPC some time ago, but there was a hole left unfilled at the end: That is, gRPC‘s load balancing problem, because the volume of business requests at that time was not large, and the company did not have this regard for Istio. We are familiar with service grid-like […]
Browsers can directly access Dubbo and gRPC back-end microservices. The first alpha version of Dubbo-js is here!
Author: Cai Jianyi Based on the Triple protocol defined by Dubbo3, you can easily write browser and gRPC-compatible RPC services, and have these services run on HTTP/1 and HTTP/2 at the same time. Dubbo TypeScript SDK [ 1] supports defining services using IDL or programming language-specific methods, and provides a set of lightweight APIs to […]
gRPC proto data verification
1. proto data verification This article will introduce grpc_validator, which can verify the input and output of gRPC data. The code from the previous article is reused here. 1.1 Create proto file and add verification rules Here, a third-party plug-in go-proto-validators is used to automatically generate verification rules. Address: https://github.com/mwitkow/go-proto-validators $ go get github.com/mwitkow/go-proto-validators 1.1.1 […]
Implementing gRPC traffic load balancing in Kubernetes
One of the challenges some users (including me) face when trying to deploy gRPC services into a Kubernetes cluster is achieving proper load balancing. Before we dive into how to balance gRPC, we first need to answer the question of why we need to balance traffic, if Kubernetes already does this job. This article focuses […]
Springboot integrates Grpc to realize communication between services
1. Introduction to Grpc In gRPC, the client applicationcan directly call the method of the server application on a different machine just like calling a local object, allowing you to Make it easier to create distributed applications and services. Similar to many RPC systems, gRPC is also based on the following concept: define a service […]
gRPC Middleware
1. gRPC Middleware go-grpc-middlewareProject address: https://github.com/grpc-ecosystem/go-grpc-middleware gRPC itself can only set up one interceptor, and it would be messy to write all the logic together. This article briefly introduces the use of go-grpc-middleware, including grpc_zap, grpc_auth and grpc_recovery. 1.1 Introduction to go-grpc-middleware go-grpc-middleware encapsulates authentication (auth), log (logging), message (message), Validation (validation), repeat Interceptors such […]
golang grpc–header and trailer metadata transmission
Header and trailer metadata transmission The header and trailer metadata will finally be set to the http header. Used to transmit additional information besides proto definitions. For example, user identity authentication information, proxy information, access token, etc. Collectively called metadata.MD in grpc Metadata construction Metadata data structure // MD is a mapping from metadata keys […]