grpc / grpc/grpc-rust

Current-thread executor support

Open
#1,501 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

Description

## Feature Request

* Support current-thread executor
* Remove axum dependency

### Crates

* tonic-build
* tonic

### Motivation

I am using tonic in our microservices. But since it assumes multi-threaded runtime, and since we are only using current-thread runtime, Send restriction makes our program very heavy, both for aesthetic, and practical views.

So I suggest to support current-thread executor support.

### Proposal

1. Removal of axum dependency:
* Axum assumes Send. so to achieve current-thread runtime, we should remove axum router.
* Axum is only for routing, and we are using very small part of it. so we don't have any loss if we remove it.

2. Support current-thread version of tonic-build
* We can first start from making the Service trait (?Send). For example, we should use this form of Service trait:
```
#[tonic::async_trait(?Send)]
impl test_server::Test for Svc {
async fn test_request(&self, req: Request) -> Result, Status> {
Ok(Response::new(req.into_inner()))
}
}
```

3. Support the tonic server which can be used with the above generated code
* So we should run that code. No "Send" restriction for the Service trait!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.