Closed ysmiraak closed 2 years ago
Hey, thanks for reporting this. I somehow missed the introduction of this flag, it looks very useful. Do you use core.async yourself to invoke Datahike's query here?
Do you use core.async yourself to invoke Datahike's query here?
i'm using pathom and fulcro, with a setup similar to this. the async query calls are made by pathom.
This is unfortunate and not so easy to resolve because on the JVM we compile away most of core.async, but bottom out on these ones in the storage layer. I have to think about it. A radical solution would be for us to provide our own core.async fork, but this is not a lightweight fix.
i found this
the blocking effect is unfortunate but acceptable for me.
if there can be no lightweight solution, maybe close this issue?
@whilo what are your thoughts on this?
I think we either need to fork core.async to make sure that our code is not interfering with async application code or we need to go all in on non-blocking core.async and try to make the hitchhiker-tree async variant on the JVM as fast as the non-async one. The latter we have already tried together with @mpenet and it was not easy to achieve the same performance.
This is a call to >!! or <!! inside a go block causing this, which effectively blocks an internal go dispatch thread, so clearly bad practice from whatever is doing that, this doesn't require forking core.async. There should never be any blocking IO inside go blocks, if this happens somewhere this should be fixed.
these 2 are not looking good, I copied that code from the original when we moved the files around :/
https://github.com/replikativ/hitchhiker-tree/blob/master/src/hitchhiker/tree/bootstrap/konserve.cljc#L74 https://github.com/replikativ/hitchhiker-tree/blob/master/src/hitchhiker/tree/bootstrap/konserve.cljc#L114
Yes, this was done deliberately and while being aware of the problem because all in core.async
was failing us performance-wise in the hitchhiker-tree, while all our storage layer exposes core.async
abstractions (and is actually now written in asynchronous java.nio
). We might be able to use another blocking mechanism there, but I think it would be better if we could make core.async work instead.
Ok, I (re)evaluated all the options (changing core.async to detect blocking calls and spawn threads, using JVM green thread solutions and implementing synchronous IO for our storage layer) and I think we need to implement synchronous storage IO in konserve and purge all blocking calls from the codebase (including surface API). Honestly I am fairly disappointed by the JVM ecosystem to still not have high performance native coroutine/fiber support after over 10 years of success of node.js and go-lang (not to speak of better, but less popular languages such as Haskell or Erlang). We basically have to bend core.async to a hybrid programming model/language with Clojure macros for abstractions which actually belong into the VM, because core.async has a non-trivial overhead.
This should now be fixed with the bump to the new konserve and hitchhiker-tree release in 0.6.1521
. @ysmiraak if not please reopen this issue!
with
-Dclojure.core.async.go-checking=true
i sometimes get this error.i can't consistently reproduce this, but the stack trace points to some code in hitchhiker tree.
if anyone knows how to go around this problem, i'd be thankful!
(i'm using version 0.3.5)