panjf2000 / gnet

🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go.
https://gnet.host
Apache License 2.0
9.7k stars 1.04k forks source link

[Feature]: support configurable I/O space to drain at a time in edge-triggered mode #643

Closed panjf2000 closed 3 weeks ago

panjf2000 commented 1 month ago

Description of new feature

Add a new option that specifies the number of bytes that gnet can read/write up to in one event loop of ET. For the moment, the default is 1MB.

Scenarios for new feature

It would be useful when users need to read/write more (or less) data in one event loop of ET.

Breaking changes or not?

No

Code snippets (optional)

type Options struct {
    ...

    // EdgeTriggeredIOSpace specifies the number of bytes that `gnet` can 
    // read/write up to in one event loop of ET. The default is 1MB.
    EdgeTriggeredIOSpace int
}

Alternatives for new feature

None.

Additional context (optional)

None.