Skip to content

Commit 558b8cb

Browse files
committed
feat: add virtual threads support for gRPC server
- Add VirtualThreadGrpcServerCustomizer to enable virtual threads when spring.threads.virtual.enabled=true - Add comprehensive tests for virtual threads functionality - Update documentation with virtual threads configuration examples - Add example configuration in application-grpc-server-boot-starter-example.yaml Closes #118
1 parent c25d232 commit 558b8cb

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

grpc-boot-autoconfigure/grpc-server-boot-autoconfigure/src/main/resources/application-grpc-server-boot-starter-example.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
spring:
2+
threads:
3+
virtual:
4+
enabled: true # enable virtual threads (Java 21+)
5+
16
grpc:
27
server:
38
enabled: true # whether to enable grpc server

website/docs/20-server/10-autoconfiguration.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,23 @@ grpc:
145145
enabled: true
146146
```
147147

148+
## Virtual Threads Support
149+
150+
Starting from version [3.5.3.2](https://github.com/DanielLiu1123/grpc-starter/releases/tag/v3.5.3.2), gRPC server supports virtual threads when using Java 21+.
151+
152+
When `spring.threads.virtual.enabled` is set to `true`, the gRPC server will automatically use virtual threads to handle requests, providing better performance for I/O-bound operations.
153+
154+
```yaml
155+
spring:
156+
threads:
157+
virtual:
158+
enabled: true
159+
```
160+
161+
:::info
162+
Virtual threads are only available in Java 21+. This feature will be ignored on older Java versions.
163+
:::
164+
148165
## Configurations
149166

150167
Full configuration is available in the [`GrpcServerProperties`](https://github.com/DanielLiu1123/grpc-starter/blob/main/grpc-boot-autoconfigure/grpc-server-boot-autoconfigure/src/main/java/grpcstarter/server/GrpcServerProperties.java).

0 commit comments

Comments
 (0)