KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Query Routing/ Load Balancing / asynchronous callbacks Re: Query Routing/ Load Balancing / asynchronous callbacks

  • simon_watson_sj

    Member
    April 6, 2022 at 12:00 am

    Hi David,

    Thank you for your speedy response! I have tried the load balancer on basic q processes.

    I did the following:

    copy the following files to QHOME:

    • loadBalancer.q
    • service.q
    • gateway.q

    Next, I defined function qmserve in .bashrc  as follows:

    qmserve(){ q loadBalancer.q -p 5001 & q service.q -p 5002 & q gateway.q -p 5003 & q -p 5004 & q -p 5005 }

    and ran

    source .bashrc

    from the command line in the home directory to load up the function.

    I then executed the function qmserve and noted 5 processes starting.

    at q prompt did this:

    gw:{h:hopen x;{(neg x)(`userQuery;y);x[]}[h]}[`:localhost:5003]

    followed by this:

    gw(`EQUITY_MARKET_RDB;"select from trade where date=max date")

    The result was a hanging cursor.

    Looking in the service.q code, what does LB do when it is used in manageConn?

    My thoughts for troubleshooting was that I should load up the processes separately on multiple terminals as using ‘&’ suppresses error returns as I’m sure you will know. An alternative view though is that my final process doesn’t have a ‘&’ so should return errors normally.

    Keen for any thoughts you might have even if it’s on the next steps for my troubleshooting. I wondered if it was worth loading up the scripts in a q startup process wrapped in my qmserve function but then start up my client q process directly on the command line. I don’t think the function wrapper in the bash script should change things but it never hurts to try.

    Simon