grpc / grpc/grpc-java

netty: Writes can starve reads, causing DEADLINE_EXCEEDED

オープン
#8,912 コメント 6 件 リアクション 0 件 担当者 1 名 GitHub で見る

@sergiitk がすでに取り組んでいます。

2022年5月31日 から。

netty performance
主要言語
Java
スター
12.1k
フォーク
4k
平均マージ
2日 17時間
マージ済み PR(30日)
37

説明

### What version of gRPC-Java are you using?
`1.44.0`

### What is your environment?

A client and server communicating over localhost.

Operating system: `Mac OSX`
JDK: `11.0.9`

### What did you expect to see?
Client in this [branch](https://github.com/tommyulfsparre/grpc-half-close/tree/netty-okhttp-slow-start) not failing the majority of RPCs with `DEADLINE_EXCEEDED` when using Netty for transport.

### What did you see instead?

The majority of call fails with `DEADLINE_EXCEEDED` using `Netty` whereas using `OkHttp` doesn't .

### Steps to reproduce the bug

This (hacky) [reproducible](https://github.com/tommyulfsparre/grpc-half-close/tree/netty-okhttp-slow-start) might indicate a potential problem where the periodic flushing of the [WriteQueue](https://github.com/grpc/grpc-java/blob/master/netty/src/main/java/io/grpc/netty/WriteQueue.java#L122) doesn't happen frequently enough. This causes latency leading to `DEADLINE_EXCEEDED` during startup. Switching to `ÒkHttp` for **this** particular case does not cause any RPCs to fail.

On the wire with Netty multiple RPCs are batched and sent togheter whereas with `ÒkHttp` they are immediately dispatched.

Here is a screenshot from Perfmark using Netty:

![permark](https://user-images.githubusercontent.com/2462159/153612117-ab742c54-fc11-4702-9ce5-e18b91d1891c.jpg)

is this a known issue or am I doing something fundamentally wrong in the reproducer?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。