https://github.com/pennsail/dagor-grpc
This repo is an unofficial go-gRPC implementation of DAGOR, the wechat microservice overload control. It's a part of efforts to compare with our design: Rajomon.
https://github.com/pennsail/dagor-grpc
microservice overload wechat
Last synced: 5 months ago
JSON representation
This repo is an unofficial go-gRPC implementation of DAGOR, the wechat microservice overload control. It's a part of efforts to compare with our design: Rajomon.
- Host: GitHub
- URL: https://github.com/pennsail/dagor-grpc
- Owner: pennsail
- License: apache-2.0
- Created: 2025-03-01T20:52:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-01T21:10:09.000Z (about 1 year ago)
- Last Synced: 2025-03-11T07:53:05.675Z (about 1 year ago)
- Topics: microservice, overload, wechat
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## DAGOR Open Source Implementation
### Overview
`dagor-grpc` is a gRPC interceptor library.
This repository contains an open-source implementation of the **DAGOR** overload control mechanism, which was originally proposed in the paper *"Overload Control for Scaling WeChat Microservices"*. We have followed the algorithm described in the paper to build this implementation.
DAGOR is designed to manage overload in microservices by dynamically adjusting request admission levels based on both business and user priorities. It aims to maintain high throughput during overload situations by shedding excess load collaboratively across microservices.
### Thread Safety
In the DAGOR implementation, we use Go's **`sync.Map`** for concurrent data access to shared resources and **atomic operations** for safely updating request counters, admission levels, and overload indicators. This ensures that the system can handle high-concurrency environments typical in microservice architectures without performance degradation due to locking contention.
## Installation
To install the `dagor-grpc` package, run the following command:
```bash
go get -u github.com/pennsail/dagor-grpc
```
Ensure that you have Go installed and your workspace is correctly configured.
## Usage
### Server Interceptor
To use `dagor` as a server interceptor, refer to the following example:
```go
import (
"github.com/pennsail/dagor-grpc/dagor"
"google.golang.org/grpc"
)
func main() {
serverOptions := []grpc.ServerOption{
grpc.UnaryInterceptor(dagor.UnaryServerInterceptor),
}
server := grpc.NewServer(serverOptions...)
// Register services and start the server
}
```
### Client Interceptor
To integrate `dagor` as a client interceptor, consult the following example:
```go
import (
"github.com/pennsail/dagor-grpc/dagor"
"google.golang.org/grpc"
)
func main() {
clientOptions := []grpc.DialOption{
grpc.WithUnaryInterceptor(dagor.UnaryClientInterceptor),
}
conn, err := grpc.Dial("localhost:50051", clientOptions...)
// Handle the connection and execute client logic
}
```
## Contributing
Contributions from the community are welcome. For more information, please read the [contribution guidelines](CONTRIBUTING.md).
## License
This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details.
```
You can place this content into your `README.md` file in the root directory of your repository. Feel free to adjust it according to your project's specific requirements.