Skip to content

Commit 25fa9da

Browse files
authored
Update README.md
1 parent db3df52 commit 25fa9da

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# grpc-connection-library
22
grpc-connection-library is a library that supports the gRPC client-server connection interface for the developers to use as a gRPC middleware in the application. The library is written in Golang with a concurrency pipeline design pattern to synchronize the gRPC connection pool system.
33

4-
# Features
4+
## Features
55
- The gRPC connection flow among server/client synchronized using the Ping/Pong services.
66
- gRPC connection library supports connection pool reuse the gRPC client connection instance.
77
- Concurrency Pipeline design pattern synchronizes the data flow among several stages while creating the connection pool.
@@ -10,16 +10,16 @@ grpc-connection-library is a library that supports the gRPC client-server connec
1010
- The grpc-retry policy helps to retry the failure of gRPC connections with backoff strategy.
1111
- The <a href="https://pkg.go.dev/google.golang.org/grpc/grpclog">grpclog</a> will show the internal connection lifecycle that will be useful to debug the connection flow.
1212

13-
# Installation
13+
## Installation
1414

1515
`go get github.com/Deeptiman/go-connection-library`
1616

17-
# Demo
17+
## Demo
1818

1919

20-
# Go Docs
20+
## Go Docs
2121

22-
# Example
22+
## Example
2323
<b>Client</b>:
2424

2525
```````````````````````````````go
@@ -66,7 +66,7 @@ func main() {
6666
}
6767
```````````````````````````````
6868

69-
# gRPC connection Ping/Pong service
69+
## gRPC connection Ping/Pong service
7070
The library provides a Ping/Pong service facility to test the client/server connection flow. The service helps to establish connection health check status.
7171

7272
<b>protos:</b>
@@ -130,12 +130,12 @@ if err != nil {
130130
c.Log.Infoln("GRPC Pong msg - ", respMsg)
131131
`````````````````````````````````
132132

133-
# Concurrency Pipeline for gRPC Connection Pool
133+
## Concurrency Pipeline for gRPC Connection Pool
134134
1. <a href="https://github.com/Deeptiman/grpc-connection-library/blob/master/pool/connection_pool.go#L170">ConnectionPoolPipeline()</a> follows the concurrency pipeline technique to create a connection pool in a higher concurrent scenarios. The pipeline has several stages that use the <b>Fan-In, Fan-Out</b> technique to process the data pipeline using channels.
135135
2. The entire process of creating the connection pool becomes a powerful function using the pipeline technique. The four stages work as a generator pattern for the connection pool.
136136

137-
## Pipeline Stages
138-
### Stage-1:
137+
### Pipeline Stages
138+
#### Stage-1:
139139
This stage will create the initial gRPC connection instance that gets passed to the next pipeline stage for replication.
140140

141141
`````````````````````````````````````````````````go
@@ -159,7 +159,7 @@ This stage will create the initial gRPC connection instance that gets passed to
159159
return connCh
160160
}
161161
`````````````````````````````````````````````````
162-
### Stage-2:
162+
#### Stage-2:
163163
The cloning process of the initial gRPC connection object will begin here. The connection instance gets passed to the next stage iteratively via channels.
164164

165165
`````````````````````````````````````````````````go
@@ -179,7 +179,7 @@ connReplicasfn := func(connInstanceCh <-chan *grpc.ClientConn) <-chan *grpc.Clie
179179
return connInstanceReplicaCh
180180
}
181181
`````````````````````````````````````````````````
182-
### Stage-3:
182+
#### Stage-3:
183183
This stage will start the batch processing using the <a href="https://github.com/Deeptiman/go-batch">github.com/Deeptiman/go-batch</a> library. The MaxPoolSize is divided into multiple batches and released via a supply channel from go-batch library internal implementation.
184184

185185
`````````````````````````````````````````````````go
@@ -198,7 +198,7 @@ connBatchfn := func(connInstanceCh <-chan *grpc.ClientConn) chan []batch.BatchIt
198198
}
199199

200200
`````````````````````````````````````````````````
201-
### Stage-4:
201+
#### Stage-4:
202202
The connection queue reads through the go-batch client supply channel and stores the connection instances as channel case in <b>[]reflect.SelectCase</b>. So, whenever the client requests a connection instance, <b>reflect.SelectCase</b> retrieves the conn instances from the case using the pseudo-random technique.
203203

204204
`````````````````````````````````````````````````go
@@ -220,7 +220,7 @@ connEnqueuefn := func(connSupplyCh <-chan []batch.BatchItems) <-chan batch.Batch
220220
return receiveBatchCh
221221
}
222222
`````````````````````````````````````````````````
223-
### Run the pipeline:
223+
#### Run the pipeline:
224224
`````````````````````````````````````````````````go
225225
for s := range connEnqueuefn(connBatchfn(connReplicasfn(connInstancefn(done)))) {
226226
go func(s batch.BatchItems) {
@@ -235,7 +235,7 @@ for s := range connEnqueuefn(connBatchfn(connReplicasfn(connInstancefn(done))))
235235
}
236236
`````````````````````````````````````````````````
237237

238-
# Batch Processing Item structure in the connection pool
238+
## Batch Processing Item structure in the connection pool
239239

240240
`````````````````````````````````````````````````go
241241
type BatchItems struct {
@@ -244,7 +244,7 @@ type BatchItems struct {
244244
Item interface{} `json:"item"`
245245
}
246246
`````````````````````````````````````````````````
247-
### Scenario:
247+
#### Scenario:
248248
There are <b>12</b> gRPC connection instances stored in <b>3</b> batches.
249249
<table>
250250
<tr>

0 commit comments

Comments
 (0)