Skip to content
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

Consider using kqueue in hypervisor socket implementation #211

Open
djs55 opened this issue May 2, 2018 · 5 comments
Open

Consider using kqueue in hypervisor socket implementation #211

djs55 opened this issue May 2, 2018 · 5 comments

Comments

@djs55
Copy link
Collaborator

djs55 commented May 2, 2018

The core of hyperkit uses kqueue via mevent.c but pci_virtio_sock.c uses plain old select.

If hyperkit is used together with vpnkit in Docker for Mac and large numbers (> 1024) of connections are port forwarded then hyperkit becomes unable to process any more AF_VSOCK connections due to the accepted file descriptor being greater than FD_SETSIZE, see for example

if (fd >= FD_SETSIZE) {

This manifests as errors under load, for example

$ docker ps
Error response from daemon: Bad response from Docker engine

from docker/for-mac#2841

This scalability limit could be removed by switching from select to kqueue (or poll) in pci_virtio_sock.c.

@imavroukakis
Copy link

Hi team, any updates on this would be appreciated

@ijc
Copy link
Collaborator

ijc commented May 10, 2018

At one point we were trying to avoid MacOS-isms in an attempt to keep the option of using Hyperkit on other platforms open in the future. I think we've basically given up on that so a PR to switch to kqueue should be fine.

I had thought that kqueue was callback based, making it a big rewrite to integrate with the current code structure, but it seems that I was mistaken and it should be possible to replace select with kqueue without a lot of non-localised changes.

Have we considered whether multiplexing in vpnkit might be easier though?

@imavroukakis
Copy link

Has there been any more discussion around this ? Would love to see it fixed 😄

@ijc
Copy link
Collaborator

ijc commented Jun 19, 2018

AFAIK nobody has worked on this. PRs are welcome.

@imavroukakis
Copy link

@ijc thanks for the update. I would happily have given this a go but C is not something I'm anywhere near competent in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants