In addition, look at allocation. If you can keep the garbage collector
constantly busy it'll use the available CPU cores in the machine. It is
likely to improve the system by quite a lot.
On Tue, Dec 19, 2017 at 11:36 AM Gulácsi Tamás wrote:
> You don't need to use bufio, but you'll need bufferi
You don't need to use bufio, but you'll need buffering to decrement the
count of Read calls (thus, syscalls).
Reusing []byte slices: use a sync.Pool. Or several sync.Pools for different
byte slices.
Vasiliy Tolstov ezt írta (időpont: 2017. dec. 19., K,
11:30):
> If I have something like this, bu
If I have something like this, but I know that client sends fixed sized
message header 48 byte and variable sized body based on data in header, and
want to minimize allocations. Does I need to use bufio?
Now I'm use goleveldb util package for reusable byte slice.
19 Дек 2017 г. 11:22 пользователь
bufio.NewReader
On Mon, 2017-12-18 at 05:11 -0800, Tamás Gulácsi wrote:
> > n, err := sock.Read(buf)
> >
> >
> This will be slow: TCP is a streaming protocol, so this Read can read
> any
> length between 0 (! yes !) and 1024 bytes.
> Use buffering (bytes.NewReader) and some kind of messag
2017. december 18., hétfő 14:11:34 UTC+1 időpontban Tamás Gulácsi a
következőt írta:
>
>
> 2017. december 18., hétfő 13:51:26 UTC+1 időpontban eric.sh...@gmail.com
> a következőt írta:
>>
>> I try to implement a golang tcp server, and I found the concurrency is
>> satisfied for me, but the CPU
2017. december 18., hétfő 13:51:26 UTC+1 időpontban eric.sh...@gmail.com a
következőt írta:
>
> I try to implement a golang tcp server, and I found the concurrency is
> satisfied for me, but the CPU usage is too high(concurrency is 15W+/s, but
> the CPU usage is about 800% in a 24 cores linux m