tidwall / evio

Fast event-loop networking for Go
MIT License
5.9k stars 492 forks source link

Multi-thread benchmark result(does evio support it)? #20

Closed WhoisZihan closed 6 years ago

WhoisZihan commented 6 years ago

Hi,

I see the feature includes Fast single-threaded event loop, also, there is only benchmark result for a single-thread test.

Does this mean evio should run on single-thread for better performance? Is there such benchmark result in multi-thread environment?

For example, I have 4 cores and am listening on tcp://127.0.0.1:9876, then I have many guests to request this address. Does evio serve in every core with a event loop, or does it work on only one core? I'm not sure if I'm asking the right question because I'm actually not very familiar with go's concurrency control model, but I guess I make my point.

Thanks

tidwall commented 6 years ago

Does this mean evio should run on single-thread for better performance? Is there such benchmark result in multi-thread environment?

Evio is single-threaded, both for performance and simplicity. Which basically means that the event loop runs on the same thread/goroutine as the main() function. As long as you don't launch any background goroutines, your process will remain single-threaded.

I don't know of any multi-threaded benchmarks.

For example, I have 4 cores and am listening on tcp://127.0.0.1:9876, then I have many guests to request this address. Does evio serve in every core with a event loop, or does it work on only one core?

It serves in one core. The other cores will not be used.

WhoisZihan commented 6 years ago

I see, thanks.