How to delegate a custom request to a separate thread in KDB / Q
Is there a way in KDB / Q to delegate the user's request to a separate thread? On my server, I have an internal computation loop that runs at frequent intervals and takes time to complete. While it is running, all user requests are blocked.
How can I delegate the computation to a completely separate thread? The only way I can achieve multithreading is using peach / .Q.fc, but that doesn't help in this case as I want to process user requests and the inner loop in parallel.
source to share
It looks to me like you are using a process as a kind of hub here, both a gateway and an analytics engine. I would suggest sending the inner loop to a separate process with an asynchronous call and having it asynchronously update whatever you need to update back to the main thread, although knowledge of the nature of the loop would be helpful to pre-identify any problems with this.
See here for more information on IPC in general.
source to share
It sounds like you want to use negative port mode . There are restrictions on what slave threads can do, but they are not too different from persisting.
source to share