I’m trying to build a REST api directly in kdb. Unfortunately, -30!(::) for deferred response does not seem to be available for use in the .z.ph handler. Is there any way around this? I can’t see a way to implement a load balanced system without being able to make use of -30!(::) and I’d like to avoid setting up a REST api in another language in front of the kdb system. The error one gets when trying to use deferred sync is ‘Nothing to defer. Handle 11 was not expecting a response msg’
2 Answers
2An update on this. The existing system we had consisted of a load balancer process (using deferred sync) in front of workers. Since deferred sync is not possible with http queries, we will remove the q load balancer process and allow nginx to load balance directly across the workers
@mauricemoore you can create a REST_GW (N q procs), to scale up/down. They can share the same port using socket sharing.
Socket sharding with KDB-X and Linux | KDB-X and q documentation - KDB-X Documentation
These REST GWs would do the blocking on client requests, and can connect to your q GW, which handles (-30!) -> workers