Clojure Concurrency (2008) [video]
youtube.com
youtube.com
My main problem was with the frustrating debugging experience: Clojure is so concise that breakpoints can be difficult to place, and macros are almost completely off limits. On top of that, figuring out which part of the code would pick up after blocking on a channel was just tiresome. These are the main reasons I decided not to continue with Clojure personally.
I can see that for sure, but don't avoid macros. In fact, I think roll your own debugging and logging are their best use cases.
Great post on this here:
http://eli.thegreenplace.net/2017/notes-on-debugging-clojure...
So, the community and core team is aware of the learning curve hump, and always trying to improve it, but after you get over the learning hump, the challenges of debuging almost go away, and it becomes equal to any other language. At least it did for me, and it was almost an epiphany.
This can be a sign that a construct other than a channel is better suited to the problem at hand. Options include future/deref and promise/deliver.
- REPL-driven development [1]
- Platform-specific debuggers [2] (e.g. IntelliJ debugger on JVM)
- Logging infrastructure
Is their a good rule of thumb for this? In a web app, how much concurrency should one pursue? If a lot, one user can potentially hog all the machine's cores while computing a view function. If a little/zero, then the server is computing view functions slower than it could if it used more then one core or thread per page view.
it's a capacity planning issue which is somewhat related to how you parallelize the work but in the end, roughly `work per request W * number of requests N must be <= worker capacity C * number of workers M` or you will have a growing backlog. i imagine sync vs async resource access affects request timing variance more than it affects the median when the system is saturated but that depends on how resources respond to contention.
so to answer your question - there is no general rule, every system has it's own scaling characteristics, but simpler system is better than complicated one so start with sequential access and measure a lot as you change it.
A few years ago they added the "core.async" package that provides something like the channel-based, CSP concurrency model that you find in the Go programming language. For many problems, this model is a better fit, but all the original concurrency stuff is there too.
https://www.youtube.com/watch?v=tVooR-dF_Ag (ClojureScript Release)
* core.async * pulsar
Also a lot of the stuff just didn't turn out to be as common as anticipated when idiomatic Clojure is used.