Skip to content

Commit

Permalink
opt: bring down the maxBytesTransferET and defer write in ET mode (#…
Browse files Browse the repository at this point in the history
…606)

* opt: don't write data immediately when there is data pending in ET mode

* opt: bring down the maxBytesTransferET from 4MB to 1MB
  • Loading branch information
panjf2000 authored May 30, 2024
1 parent ef2f817 commit cda1839
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions connection_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ func (c *conn) write(data []byte) (n int, err error) {
// of network packets.
if !c.outboundBuffer.IsEmpty() {
_, _ = c.outboundBuffer.Write(data)
if isET {
err = c.loop.write(c)
}
return
}

Expand Down Expand Up @@ -193,9 +190,6 @@ func (c *conn) writev(bs [][]byte) (n int, err error) {
// of network packets.
if !c.outboundBuffer.IsEmpty() {
_, _ = c.outboundBuffer.Writev(bs)
if isET {
err = c.loop.write(c)
}
return
}

Expand Down
2 changes: 1 addition & 1 deletion eventloop_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (el *eventloop) read0(itf interface{}) error {
return el.read(itf.(*conn))
}

const maxBytesTransferET = 1 << 22
const maxBytesTransferET = 1 << 20

func (el *eventloop) read(c *conn) error {
if !c.opened {
Expand Down

0 comments on commit cda1839

Please sign in to comment.