-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PutAll ensures all futures finish #200
base: develop
Are you sure you want to change the base?
Conversation
ca512bf
to
bc0b908
Compare
Err(_) => unreachable!(), | ||
} | ||
thread::sleep(Duration::from_millis(1)); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Needs comments to justify waiting time of 1ms, or possibly a better alternative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/daemon.rs の spawner をここまで持ってきて、spawner.spawn で Future を実行する方法もある。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
待つ時間は長くてもそこまで問題にはならなそうで、spawner を持ってくるのは変更が大きそうという理由から、待つ時間を環境変数で設定できるようにします (デフォルトを 100ms くらいにします)
根拠:
- 待つ時間は長くても問題にならない: このコードだと PUT アクセス1個につき1個のスレッドが立つ。このスレッドは PUT が全部終わるのを待って終了するため、PUT アクセスにかかる時間程度までなら待ち時間によらずかかる時間はほぼ一定であるため。
- spawner を持ってくるのは変更が大きそう: Bucket -> Client -> StorageClient -> DispersedClient -> PutAll と順に変更する必要があるため。
- 100ms: 根拠に乏しいが PUT より充分短い時間であるため。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この実装だと、tasque_task_duration_seconds
というメトリクスの quantile クエリがほぼ残りの PUT 由来となります。問題かどうかはよくわかりません。
840ca5e
to
52f72b9
Compare
Types of changes
Please check one of the following:
Description of changes
frugalos_segment::client::PutAll
が、与えられた future を全て確実に実行するようになる。Behavior
frugalos_segment::client::PutAll
が required_ok_count 個の future を成功裡に実行した後、残りの future を捨てる代わりに DefaultCpuTaskQueue に投げるようになる。Purpose
Fixes #175.
PUT リクエストで保存すべきフラグメントが全部保存されない可能性があるという問題があり、今回の変更はそれを部分的に解決する。
この変更により、クライアントに応答を返した後も内部では Put リクエストを実行し続け、仮に失敗した時には
PutAllMetrics
のlost_fragments_total
にカウントされる。今後これに依存する形で以下のような PR を投げる予定。
Checklists
cargo fmt --all
.