Client-Server redesign #4505
sake92
started this conversation in
Development
Replies: 1 comment 1 reply
-
This is really the crux of the issue. The core challenge here is how to effectively implement fine grained locking for parallel topological evaluation of the task graph. Too coarse grained and we lose all benefits, too fine grained and we start getting race conditions A minor challenge is making the client smart enough to make Everything you else you described is accurate, and relatively straightforward. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Disclaimer:
I am not the most knowledgeable person in this area, just want to spark a discussion so we can have a better dev experience with Mill.
This is kind of continuation of the "Fine-grained parallelism" discussion #3714
Current status
Execution mode
In the current world (correct me if I'm wrong), we have 2 modes of calling Mill:
The interactive mode is mostly needed for interactive apps that use terminal IO.
This is not the best experience, because users need to know in advance which mode they need to use.
If you accidentally use the client-server mode for running an interactive app, you will get surprising results.
I made a comparison with other JVM build tools here: https://github.com/sake92/java-build-tool-daemon-interactive
Only sbt does it fine (tho you can run only one app instance, probably because of their weird JSON protocol, not 100% sure).
Multiple clients
We already have a situation where we need many mill clients:
If the tasks run with no lock, they will step on each other toes.
Hence the global lock added in #3519
Proposal and a POC
Small WIP POC: https://github.com/sake92/mill-client-server-poc
My proposal is to:
The protocol does introduce more complexity, but the benefits are good:
-i
)The server would act as a "kernel", it would do the heavyweight background stuff like compiling, caching, locking etc.
The clients would get messages from server and react to them.
Interactivity
Interactive process execution would happen in the client itself.
This would take the burden off server itself:
Tasks Locking
I am not sure what is the best approach here, don't have much experience with writing concurrent code on this scale/complexity.
But some kind of in-memory locking could be the simplest to start with.
The POC also has a small benchmark for scala-native client vs JVM.
TLDR: it is much snappier (15ms vs 300ms)
Of course, this is just a rough sketch, you can play with the POC to experiment more..
What do you think overall?
Beta Was this translation helpful? Give feedback.
All reactions