-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support multiple clients in parallel #383
Comments
A few design alternatives for
The advantage of Option 2.ii (compared to 2.i) is that it prevents name clashes between concurrent clients. As an extra, requests in that case can be idempotent, i.e. replaying a request results in the same ID. A few notes from a discussion with @ehildenb:
|
We should also consider sending structured data as opposed to KORE text like Example for Option 2.ii (session with internal ID): Request: {
"jsonrpc": "2.0",
"id": 1,
"method": "add-rules",
"params": {
"rules": [
["<rule0_lhs>", "<rule0_rhs>"],
["<rule1_lhs>", "<rule1_rhs>"],
"...",
["<ruleN_lhs>", "<ruleN_rhs>"]
]
}
} Response: {
"jsonrpc": "2.0",
"id": 1,
"result": {
"id": "47d3a45f-8aa3-41f0-9111-2fb940423e9b"
}
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "execute",
"params": {
"max-depth": 4,
"...": "...",
"log-timing": true,
"rules": ["47d3a45f-8aa3-41f0-9111-2fb940423e9b"]
}
} |
Pool of solvers implementation: |
Some notes (mostly covered by Tamas above):
|
Proposal:
|
Backend parts:
|
#414 and runtimeverification/haskell-backend#3702 implement a very simple version of concurrent back-ends, which should be safe for multiple clients to connect to without module clashes. This is done by confiding state to the session, which means that every client that connect gets a session where they can add modules and execute within said context. The session is destroyed when the client disconnects. The upside to this is that there is very little change necessary on both the client and server side. The downside is some possible duplication of add module requests, if the pyk front-end maintains several connections which should all have the same state. If this implementation is unsatisfactory and we want to go with the full module IDs proposal, we need to clarify how exactly we distinguish between module names and IDs and will have to modify the kore parser and internalisation procedures, which will be a somewhat more involved change to both code bases. |
As a simplifying assumption, to avoid modifications in the parser, we can let generated IDs be valid module names for now. We'll probably move from KORE text to JSON in the module field eventually, so we can still revisit this assumption then. Would this make implementation simpler? |
Implements the proposal from runtimeverification/hs-backend-booster#383 Namely: `add-module` ------------- * now returns the id of a given module, of the form `m<sha256_of_given_module>` * computes the SHA256 hash of the unparsed module string and saves the internalised module under this key * takes an optional `name-as-id: true` argument which implements the previous behaviour of `add-module` (still returns the new id), i.e. adds the module to the module map under the module name as well as the id. * if the same module is added twice with `name-as-id: true`, the second request will fail with a `Duplicate module` error * if the same module is sent twice with `name-as-id: false` or without `name-as-id`, the second request is idempotent and will succeed As discussed on the issue, the IDs and original names are not disjoint for ease of implementation. the `m` pre-pended to the hash is necessary to make the name a valid kore identifier. I have also not added the `modules` field to other methods as I'm unsure whether this should be replacing the current `module` parameter, which would be a backwards incompatible change to the API that would break a lot of our integration tests, or if it should be an additional field, @tothtamas28? --------- Co-authored-by: github-actions <[email protected]>
Fixes #383 --------- Co-authored-by: devops <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: Jost Berthold <[email protected]>
Currently the
kore-rpc-booster
server is able to handle clients connecting to it and making requests from different processes, but at some point there is a bottleneck where only one connection at a time can make progress, preventing any speedup from using multiple clients to make independent requests in parallel to one server. From what I understood, there are at least 2 issues to be dealt with for this limitation to be overcome: opening multiple z3 processes, and the fact that the servers contain state fromadd_module
, because of which @tothtamas28 had said we might consider different ways of handling the modules that get used in the other request types, e.g. sessions or cookies.The text was updated successfully, but these errors were encountered: