Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delegate user query to a separate thread in KDB/Q

Tags:

q-lang

kdb+

Is there a way in KDB/Q to delegate user request to a separate thread? In my server, I have an internal calculation loop that runs at frequent intervals and takes time to finish. While it is running, all user queries are blocked.

How do I delegate calculation to an entirely separate thread? The only way to achieve multithreading I see is using peach/.Q.fc but that doesn't help in this case as I want to process user requests and internal loop in parallel.

like image 598
user236215 Avatar asked Jan 25 '26 05:01

user236215


1 Answers

It sounds to me like you're using a process as a kind of hub here, both as a gateway and an analytics engine - I would suggest sending the internal loop out to a separate process with an asynchronous call and having it in turn asynchronously update anything that you need updated by it back on the main thread, although knowing more about the nature of the loop would be helpful in order to pre-identify any problems with doing so.

See here for more information on IPC in general.

like image 86
Paul Kerrigan Avatar answered Jan 28 '26 00:01

Paul Kerrigan