KX Community

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

Home Forums kdb+ Is this similar to function alias? Re: What is the execution flow of this file

  • rocuinneagain

    Member
    November 16, 2021 at 12:00 am

    TP = Tickerplant (Relays data to subscribers + recovers from logfile after crashes)

    RDB = Realtime Database (Stores data for query)

    RTE = Realtime engine (Performs streaming calculations and stores caches or publishes results)

    (Any process can be customised)

     

    1. Yes

    2. It is acting more like a mixture between a TP,RDB,RTE

    a) It does not store a logfile to recover in case of a crash (tp-logfile –  a TP normally does this)

    b) It stores data indefinitely instead of acting only as a relay. (Unlike a TP, more like and RDB, although an RDB will clear once every 24hrs)

    c) It does not relay data untouched instead only specific data is forwarded (similar to an RTE)

    getSyms – sends like of unique symbols across tables

    getQuotes – sends last row by sym from quote table

    getTrades – sends last row by sym from trade table

    3. Yes

     

    The execution flow is:

    1. FH sends messages to PubSub (lines 18/19) every 100ms

    2. The messages arrive to PubSub and .z.pg evaluates them. This mean upd/insert (pubsub.q line  8 will save the incoming data to quote/trade. PubSub now has some data cached.

    3. The next time the PubSub timer (.z.ts) is triggered (every second) the ‘pub’ function will trigger and send data to subscriptions.

     

    This code is a basic demo so it may have some holes in it’s logic (like never clearing data in PubSub so eventually memory will run out)