开发者

Writing High Performance Server. Which method?

if you would need to write a high performance server how would you do it?

  • Using asynchronous blocking epoll / kqueue? But how to handle the blocking System call epoll / kqueue here? Perhaps with a Main thread which uses worker Threads which perform the blocking epoll/kqueue ?
  • Usi开发者_StackOverflow社区ng libevent? Does it even differs from epoll/kqueue as it only capsulates different mechanisms like select, epoll, kqueue etc?
  • Or instead using asynchronous blocking epoll/kqueue using Asynchronous non blocking libaio? But does it even support Sockets or just Disk IO?

Thank you for your answers.


I would use libevent.

It uses the best available mechanism on the target platform, whatever that mechanism may be; so, without changes, your program will use kqueue on BSD, epoll(4) on Linux, and whatever else is best on whatever else might exist, while still falling back to select(2) on old platforms, and somehow it also works on Windows.

Magical software. :)


I would use boost::Asio
It uses best non blocking IO per system

  • epoll for linux
  • kqueue for NIX like
  • overlapped I/O on Windows

It can handle other streams as well (COM, files).
Concept is simple create io_service class and write handle (event like) classes to manage stream.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜