AlexStocks / getty

a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Apache License 2.0
886 stars 184 forks source link

Imp: using writev #33

Closed AlexStocks closed 4 years ago

AlexStocks commented 4 years ago

Before v1.12 the fd.Writev of golang have a fatal bug, so I send multiple byte steam packages by merging them. However, the latest golang version v1.14.1 has released, I think getty should use writev now.

there are two funcs which can use writev:

1 session.go:session.WriteBytesArray 2 session.go:session.handleLoop

AlexStocks commented 4 years ago

cc @watermelo

watermelo commented 4 years ago

received~

watermelo commented 4 years ago

WriteBytesArray without writev. image

WriteBytesArray with writev. image

It seems to reduce syscall. @AlexStocks