-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wepoll: Use wepoll to light up the epoll backend on Windows #1006
Conversation
Looks very promising! (but I need to read what is wepoll at least briefly) |
The existing epoll backend logic was used to illustrate how much code can be shared between epoll and wepoll backends. wepoll backend can certainly be pulled out into its own module if preferred. |
The diff is pretty small, so I think that the way you go is preferable |
Cc: @ygj6 |
The default backend on Windows can remain as win32 (select) if we want to give the new backend time to bake with opt-in consumers. Changing the default was more of a convenience thing as I was piecing this together. |
I guess that for better adoption default can be changed, in the upstream, anyway most of users will use some ancient version that has select by default |
Some benchmark data gathered with the following command The median of the 25 data points collected by bench is what is reported in the graph. The machines used were ubuntu server 18.04 and Windows Server insider build VMs running on top of Hyper-V. Each VM was allocated 8 VPs and 8192GB memory. Stopped at 10000 total connections out of convenience. On Windows, evutil_socketpair with AF_UNIX fails after 65536 socket pairs due to a limitation with GetTempFileName (which its use in libevent is already a workaround for lack of abstract sockets support). We can work around this limitation, but even then creating many AF_UNIX sockets on Windows is painfully slow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Except small note around dist archive.
FWIW we have some code that uses io ports directly (event_iocp.c), I'm wondering do we need this now, or we can simply suggest wepoll and that's it?
It is enabled for native Windows build. The documentation and CI indicate that this project can be built using Visual Studio Build Tools, so that's what I used to develop and test with. The wepoll backend is included if the project is built using those tools. I was wondering if the released archived dists are only buildable on platforms that support autotools (which would mean buildable on mingw, but not VSBT). I didn't get a clear answer from the other thread. If the above is true, then we certainly need to ensure that wepoll backend is included when building from mingw. |
But you cannot use autotools for this, you are using cmake in this case.
Put it simple, dist archive = I can fix this by myself and do a final rebase (with push force into this PR), if you don't mind? |
libevent is lacking a scalable backend on Windows. Let's leverage the wepoll library until Windows comes up with an epoll/kqueue compete user mode API. - All regress tests pass for standard wepoll - These 2 tests fail intermittently for changelist wepoll, so disabling changelist wepoll for now http/cancel_inactive_server http/stream_in - verify target on Windows runs tests for both wepoll and win32 backends - wepoll backend preferred over win32 backend - wepoll version 1.5.6 v2: cleaner backend abstraction. Disallow wepoll on MinGW/Cygwin. v3: Add wepoll.h to dist v4: Make sure wepoll source files are excluded from cygwin/mingw builds v5: Keep win32 as default backend on windows. v6: Include wepoll in mingw builds. Verified that regress tests pass w/ WEPOLL backend. v7: Enable wepoll on mingw when building with cmake v8: Add wepoll testrunner for autotools test target
Squashed & merged, many thanks! |
Using the same benchmark on my setup, I came to the same conclusion. |
I think we need to observe for a while to see the feedback from the developers. |
In addition, for production applications, we can use popular tools to test, such as |
I guess we cannot consider this as an option, since I think that very few people will try it, and even fewer (or 0) will came back with feedback. I was thinking about more tests using some real use cases (http, bufferevent proxying - see becat, and so on) And once this will be done, we will make it default engine, and I don't that it should take too much time, I would say that not more then month (provided that someone will do these benchmarks) |
I tested
Command:
Command: From the two indicators of throughput and response time, there is no significant change between |
Hello, wepoll author here... Of course I find it interesting to see libevent considering a switch to wepoll. W.r.t. the ab benchmarks posted above: were they run from a windows machine (perhaps from the same machine even?). |
Ok,I will try it |
And What do you think is the better concurrency numbers? |
@ygj6 I think we have a misunderstanding. There are no better/worse concurrency numbers and I'm not suggesting that you should test with a particular one. What I'm saying is that if you use 'ab' (running on windows) to benchmark libevent, 'ab' will become the bottleneck and you're not getting any wiser w.r.t. libevent performance. My suggestion would be to use a different benchmarking tool (one that uses IOCP) or use 'ab' running on a linux system. |
Replace close with evutil_closesocket Caught with PR libevent#1006 (cherry picked from commit 06a1192)
Please keep it as the existing IOCP implementation is good and stable enough (atleast with TCP), your current implementation of wepoll is'nt using acceptex and connectex, APIs that really took advantage of IOCP. The other thing is with the current wepoll implementation, epoll dispatcher is not dispatching any event when server is closing a socket (::closesocket), normally GetQueuedCompletionStatus/eX will return a receive IO with 0 bytes size and this is a good indication that a socket has been closed, the current IOCP implementation is dispatching this event. |
@phit666 good notes, thank you! How about submitting a patch with this notes? |
libevent is lacking a scalable backend on Windows. Let's leverage the wepoll
library until Windows comes up with an epoll/kqueue compete user mode API.
-All regress tests pass for standard wepoll
-These 2 tests fail intermittently for changelist wepoll, so disabling
changelist wepoll for now
http/cancel_inactive_server
http/stream_in
-verify target on Windows runs tests for both wepoll and win32 backends
-wepoll backend preferred over win32 backend
-wepoll version 1.5.6