Skip to content

Commit 8afa12f

Browse files
neildgopherbot
authored andcommitted
http2: deprecate write schedulers
The user-provided write scheduler mechanism provides too much visibility into implementation internals, is difficult to use, and limits our ability to improve performance. Fixes golang/go#67817 Change-Id: Iac02c0902f805b671b4541a5dd7eafe76a6a6964 Reviewed-on: https://go-review.googlesource.com/c/net/+/751640 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
1 parent 38019a2 commit 8afa12f

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

http2/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ type Server struct {
164164

165165
// NewWriteScheduler constructs a write scheduler for a connection.
166166
// If nil, a default scheduler is chosen.
167+
//
168+
// Deprecated: User-provided write schedulers are deprecated.
167169
NewWriteScheduler func() WriteScheduler
168170

169171
// CountError, if non-nil, is called on HTTP/2 server errors.

http2/writesched.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import "fmt"
88

99
// WriteScheduler is the interface implemented by HTTP/2 write schedulers.
1010
// Methods are never called concurrently.
11+
//
12+
// Deprecated: User-provided write schedulers are deprecated.
1113
type WriteScheduler interface {
1214
// OpenStream opens a new stream in the write scheduler.
1315
// It is illegal to call this with streamID=0 or with a streamID that is
@@ -38,6 +40,8 @@ type WriteScheduler interface {
3840
}
3941

4042
// OpenStreamOptions specifies extra options for WriteScheduler.OpenStream.
43+
//
44+
// Deprecated: User-provided write schedulers are deprecated.
4145
type OpenStreamOptions struct {
4246
// PusherID is zero if the stream was initiated by the client. Otherwise,
4347
// PusherID names the stream that pushed the newly opened stream.
@@ -47,6 +51,8 @@ type OpenStreamOptions struct {
4751
}
4852

4953
// FrameWriteRequest is a request to write a frame.
54+
//
55+
// Deprecated: User-provided write schedulers are deprecated.
5056
type FrameWriteRequest struct {
5157
// write is the interface value that does the writing, once the
5258
// WriteScheduler has selected this frame to write. The write

http2/writesched_priority_rfc7540.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
const priorityDefaultWeightRFC7540 = 15 // 16 = 15 + 1
1515

1616
// PriorityWriteSchedulerConfig configures a priorityWriteScheduler.
17+
//
18+
// Deprecated: User-provided write schedulers are deprecated.
1719
type PriorityWriteSchedulerConfig struct {
1820
// MaxClosedNodesInTree controls the maximum number of closed streams to
1921
// retain in the priority tree. Setting this to zero saves a small amount
@@ -55,6 +57,9 @@ type PriorityWriteSchedulerConfig struct {
5557
// NewPriorityWriteScheduler constructs a WriteScheduler that schedules
5658
// frames by following HTTP/2 priorities as described in RFC 7540 Section 5.3.
5759
// If cfg is nil, default options are used.
60+
//
61+
// Deprecated: The RFC 7540 write scheduler has known bugs and performance issues,
62+
// and RFC 7540 prioritization was deprecated in RFC 9113.
5863
func NewPriorityWriteScheduler(cfg *PriorityWriteSchedulerConfig) WriteScheduler {
5964
return newPriorityWriteSchedulerRFC7540(cfg)
6065
}

http2/writesched_random.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import "math"
1010
// priorities. Control frames like SETTINGS and PING are written before DATA
1111
// frames, but if no control frames are queued and multiple streams have queued
1212
// HEADERS or DATA frames, Pop selects a ready stream arbitrarily.
13+
//
14+
// Deprecated: User-provided write schedulers are deprecated.
1315
func NewRandomWriteScheduler() WriteScheduler {
1416
return &randomWriteScheduler{sq: make(map[uint32]*writeQueue)}
1517
}

0 commit comments

Comments
 (0)