-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implement non-blocking IO operations #1
Comments
In the upcoming version 0.1.0 release, I believe the only place we need to involve EM is in the pipe handling between Grack and Git. Regular files such as .idx files are handled by the app container (Puma, Thin, etc.) directly. Grack itself does not attempt to stream them, so it's up to the container to behave efficiently. It looks like http://www.rubydoc.info/github/eventmachine/eventmachine/EventMachine.popen may get us pretty close. Unfortunately, the method is documented as being unsupported on Windows. We could fall back to the current logic there, but that would be a bit surprising for consumers of the library. Another tack would be to wrap the chunk handling in the write and read segments of the pipe processing such that we basically yield to EM after handling each chunk. This would get pretty complicated from what I can tell and would still be vulnerable to blocking in the communication with Git. I think the only benefit would be to possibly prevent EM starvation when copying Git's response to the socket. I'm not sure how much evented IO on the pipe between Grack and Git would get us in the end. Git in this context is working with local data on the filesystem and may not realistically block. The socket into which we copy the Git response is much more likely to block, and that's where we'll encounter EM when run under a container such as Thin. IOW, we should test that this feature is even necessary. |
Agreed. I have little experience with eventing and such, but if there's anything I can do to help out, please let me know!
If we mark this clearly in the README, I think EM support on all platforms other than Windows is worth the trouble -- provided that it is necessary at all. |
This should be done on the adapter level. @brodock suggests implementing EventMachine support for the ordinary git adapter:
For Java, some other implementation is likely necessary.
The text was updated successfully, but these errors were encountered: