Speed up rethinkdb driver issue #107 #108
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After benchmarking the driver I found that the inputStream based method for receiving responses from the server was causing a considerable slow down. Based on that issue I made some non-trivial modifications to rethinkdb.core & rethinkdb.net. Originally I had intended to use a light tcp abstraction clj-tcp. However, my naive attempts to parse messages failed when run in parallel. This was due mainly to the fact that tcp messages are not discreet and must be parsed on a frame by frame basis. So in the interest of time I brought gloss and aleph into the project.
Aleph makes use of manifold and gloss to buffer each frame and encode/decode it. Manifold streams can be coerced into core.async channels if/when it is required meaning that we can use each async mechanism when it is applicable.
I also made one slightly out of scope change to the queries to allow changes to accept parameters, this allows users to provide the squash parameter in a changefeed.
Let me know if you have any concerns, questions etc. This change set does introduce dependencies you may not be comfortable with so, I would be willing to keep this branch in my checkouts until interop with the official driver is complete.