theLink 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - py - rb - jv - cc
Loading...
Searching...
No Matches
MqContextC_SlaveApi_PY_API

MqContextC - create and manage a slave context … More...

+ Collaboration diagram for MqContextC_SlaveApi_PY_API:

Functions

static OT_ProcRet py_mqmsgque_MqContextC_SlaveGetMaster (MqContextC_ARGS)
  Python: MqContextC ctx.SlaveGetMaster() C-API
opposite function of MqSlaveGetFilter
 
static OT_ProcRet py_mqmsgque_MqContextC_SlaveGet (MqContextC_ARGS)
  Python: MqContextC ctx.SlaveGet(id:MqSlaveE|int32) C-API
get the slave-context from a master-context
 
static OT_ProcRet py_mqmsgque_MqContextC_SlaveGetFilter (MqContextC_ARGS)
  Python: MqContextC ctx.SlaveGetFilter() C-API
get the filter-ctx or the master-ctx
 
static OT_ProcRet py_mqmsgque_MqContextC_SlaveGetProxy (MqContextC_ARGS)
  Python: MqContextC ctx.SlaveGetProxy(id:MqSlaveE|int32) C-API
on slave return the master and on master return the slave identified by id.
 
static OT_ProcRet py_mqmsgque_MqContextC_SlaveCheck (MqContextC_ARGS)
  Python: bool ctx.SlaveCheck(id:MqSlaveE|int32) C-API
check if slave-id is valid
 
static OT_ProcRet py_mqmsgque_MqContextC_SlaveCreate (MqContextC_ARGS)
  Python: ctx.SlaveCreate(id:MqSlaveE|int32, slave:MqContextC) C-API
create a master/slave link between the master-parent-context and the slave-parent-context …
 
static OT_ProcRet py_mqmsgque_MqContextC_SlaveDelete (MqContextC_ARGS)
  Python: ctx.SlaveDelete(id:MqSlaveE|int32) C-API
Delete a slave object from a master/slave link identified by id. …
 
static OT_ProcRet py_mqmsgque_MqContextC_SlaveIs (MqContextC_ARGS)
  Python: bool ctx.SlaveIs() C-API
is the context a slave-context ? …
 
static OT_ProcRet py_mqmsgque_MqContextC_SlaveWorker (MqContextC_ARGS)
  Python: ctx.SlaveWorker(id:MqSlaveE|int32, ?fct:string="WORKER"?, ?args:MkBufferListC...=None?) C-API
create a master/slave link using the image of the ctx object self. …
 

Detailed Description

MqContextC - create and manage a slave context …

The master-slave-link is used to create a mesh of nodes defined by different parent-context. The master control the slave.

The master-slave-link is used to perform the following tasks:

In difference to the client-server-link the master-slave-link connect two independent parent-context in the same process or thread (e.g. node). This leads to the restriction that only the master-context can be a server-context because only one server-context per node is possible.

   node-0   |           node-1/2        |   node-3/4/5
===================================================================

| <- client/server link -> | <- client/server link -> |

             | <-- master/slave link --> |

                           |- client1-0 -|- server3 ...
             |-  server1  -|
             |             |- client1-1 -|- server4 ...
  client0-0 -|
             |-  server2  -|- client1-2 -|- server5 ...

Definition of the "master-context"

Definition of the "slave-context"

Definition of the "worker-context"

Definition of the "slave-id"

Definition of the "LOOPBACK" (0) slave

Performance analyse

The performance-test is created with:
  • pipe
    • Nhi1Exec perfclient.c --parent --wrk ? @ perfserver.c
  • spawn, fork, thread
    • Nhi1Exec -r=uds perfserver.c --spawn|fork|thread
    • Nhi1Exec -r=uds perfclient.c --parent --wrk ?
  • the number of workers are set with the –wrk option
  • the cpu is a xeon with 4/8
  • the performance is calculated as worker-context-created / time-in-sec with a ~2sec (default) measurement period.
performance-test code:
  • The test-setup is done as:
      perfclient                                worker                            perfserver
      ==========                                ======                            ==========
      |
      |- loop --wrk x
        |- MqSlaveWorker(...)               ->  worker[1] 
        |- MqSend(worker[1],"E","STR0..")   ->  PerfWorker_I160(...)
                                                |- loop endless
                                                  |- MqContextCreate(...)
                                                  |- MqLinkCreate(...)      <->   MqContextCreate(...)
                                                  |- MqContextDelete(...)   <->   MqContextDelete(...)
      |- sleep x sec
      |- loop --wrk x
        |- MqSend(worker[1],"C"..,"END0")   ->  PerfWorker_END0(...)
        |                                       |- stop loop
        |- "callback" - add number to all   <-  |- return #context 
performance-test results:
  • results generated using the debug environment
    setup –wrk # worker-context performance info
    pipe 1 2500 1000 the pipe start a new worker-context with spawn
    spawn 1 2500 <1000 same as pipe but use network-protocoll
    fork 1 3800 4000 the fork is faster than spawn
    thread 1 16500 9000 the thread is faster than fork
    pipe 4 8000 4500 the worker scale linear up to number of processors
    spawn 4 7600 <4500 -
    fork 4 23200 11500 -
    thread 4 55500 27500 -
    pipe 8 10000 5500 the additional scaling up to the max hyper-threading does not really help
    spawn 8 9100 <5500 -
    fork 8 23200 11500 -
    thread 8 55500 27500 -

Function Documentation

◆ py_mqmsgque_MqContextC_SlaveCheck()

static OT_ProcRet py_mqmsgque_MqContextC_SlaveCheck ( MqContextC_ARGS )
static

Python: bool ctx.SlaveCheck(id:MqSlaveE|int32) C-API
check if slave-id is valid

Definition at line 3264 of file MqContextC_py.c.

3264 {
3266 OT_SETUP_ONEARG(SlaveCheck_doc)
3267 MQ_SLAVE_ID id = 0;
3268 OT_CHECK_REQUIRED(OT_CHECK_SLAVE_ID (id))
3269 OT_CHECK_NOARGS
3270 OT_retObj_SET_BOL(MqSlaveCheck (hdl, id))
3271 goto end;
3272 error:
3273 OT_retObj_SET_Error
3274 end:
3276}
#define OT_SETUP_hdl
#define SlaveCheck_doc
#define OT_retObj_RETURN
#define error
bool MqSlaveCheck(MQ_CTXN const ctx, MQ_SLAVE_ID const id)
check if slave-id is valid
MK_NUM MQ_SLAVE_ID
a slave identiver

◆ py_mqmsgque_MqContextC_SlaveCreate()

static OT_ProcRet py_mqmsgque_MqContextC_SlaveCreate ( MqContextC_ARGS )
static

Python: ctx.SlaveCreate(id:MqSlaveE|int32, slave:MqContextC) C-API
create a master/slave link between the master-parent-context and the slave-parent-context …

Definition at line 3279 of file MqContextC_py.c.

3279 {
3281 OT_SETUP_VARARGS(2,2,SlaveCreate_doc)
3282 MQ_SLAVE_ID id = 0;
3283 OT_CHECK_REQUIRED(OT_CHECK_SLAVE_ID (id))
3284 MQ_CTX slave = 0;
3285 OT_CHECK_REQUIRED(OT_CHECK_CTX (slave,MK_NULL_NO))
3286 OT_CHECK_NOARGS
3287 MkErrorC_Check(hdl,MqSlaveCreate (hdl, id, slave));
3288 OT_retObj_SET_None
3289 goto end;
3290 error:
3291 OT_retObj_SET_Error
3292 end:
3294}
#define SlaveCreate_doc
#define MK_NULL_NO
#define MqSlaveCreate(...)
PUBLIC data structure for the pymqmsgque-specific-data

◆ py_mqmsgque_MqContextC_SlaveDelete()

static OT_ProcRet py_mqmsgque_MqContextC_SlaveDelete ( MqContextC_ARGS )
static

Python: ctx.SlaveDelete(id:MqSlaveE|int32) C-API
Delete a slave object from a master/slave link identified by id. …

Definition at line 3297 of file MqContextC_py.c.

3297 {
3299 OT_SETUP_ONEARG(SlaveDelete_doc)
3300 MQ_SLAVE_ID id = 0;
3301 OT_CHECK_REQUIRED(OT_CHECK_SLAVE_ID (id))
3302 OT_CHECK_NOARGS
3303 MkErrorC_Check(hdl,MqSlaveDelete (hdl, id));
3304 OT_retObj_SET_None
3305 goto end;
3306 error:
3307 OT_retObj_SET_Error
3308 end:
3310}
#define SlaveDelete_doc
#define MqSlaveDelete(...)

◆ py_mqmsgque_MqContextC_SlaveGet()

static OT_ProcRet py_mqmsgque_MqContextC_SlaveGet ( MqContextC_ARGS )
static

Python: MqContextC ctx.SlaveGet(id:MqSlaveE|int32) C-API
get the slave-context from a master-context

Definition at line 3213 of file MqContextC_py.c.

3213 {
3215 OT_SETUP_ONEARG(SlaveGet_doc)
3216 MQ_SLAVE_ID id = 0;
3217 OT_CHECK_REQUIRED(OT_CHECK_SLAVE_ID (id))
3218 OT_CHECK_NOARGS
3219 MQ_CTX ctx_out;
3220 MkErrorC_Check(hdl,MqSlaveGet (hdl, id, &ctx_out));
3221 OT_retObj_SET_CTX(ctx_out)
3222 goto end;
3223 error:
3224 OT_retObj_SET_Error
3225 end:
3227}
#define SlaveGet_doc
#define MqSlaveGet(...)

◆ py_mqmsgque_MqContextC_SlaveGetFilter()

static OT_ProcRet py_mqmsgque_MqContextC_SlaveGetFilter ( MqContextC_ARGS )
static

Python: MqContextC ctx.SlaveGetFilter() C-API
get the filter-ctx or the master-ctx

Definition at line 3230 of file MqContextC_py.c.

3230 {
3232 OT_SETUP_NOARG(SlaveGetFilter_doc)
3233 OT_CHECK_NOARGS
3234 MQ_CTX ctx_out;
3235 MkErrorC_Check(hdl,MqSlaveGetFilter (hdl, &ctx_out));
3236 OT_retObj_SET_CTX(ctx_out)
3237 goto end;
3238 error:
3239 OT_retObj_SET_Error
3240 end:
3242}
#define SlaveGetFilter_doc
#define MqSlaveGetFilter(...)

◆ py_mqmsgque_MqContextC_SlaveGetMaster()

static OT_ProcRet py_mqmsgque_MqContextC_SlaveGetMaster ( MqContextC_ARGS )
static

Python: MqContextC ctx.SlaveGetMaster() C-API
opposite function of MqSlaveGetFilter

Definition at line 3197 of file MqContextC_py.c.

3197 {
3199 OT_SETUP_NOARG(SlaveGetMaster_doc)
3200 OT_CHECK_NOARGS
3201 MQ_CTX retVal = MqSlaveGetMaster (hdl);
3202 OT_retObj_SET_CTX(retVal)
3203 goto end;
3204 error:
3205 OT_retObj_SET_Error
3206 end:
3208}
#define SlaveGetMaster_doc
MQ_CTX MqSlaveGetMaster(MQ_CTX const ctx)
opposite function of MqSlaveGetFilter

◆ py_mqmsgque_MqContextC_SlaveGetProxy()

static OT_ProcRet py_mqmsgque_MqContextC_SlaveGetProxy ( MqContextC_ARGS )
static

Python: MqContextC ctx.SlaveGetProxy(id:MqSlaveE|int32) C-API
on slave return the master and on master return the slave identified by id.

Definition at line 3245 of file MqContextC_py.c.

3245 {
3247 OT_SETUP_ONEARG(SlaveGetProxy_doc)
3248 MQ_SLAVE_ID id = 0;
3249 OT_CHECK_REQUIRED(OT_CHECK_SLAVE_ID (id))
3250 OT_CHECK_NOARGS
3251 MQ_CTX ctx_out;
3252 MkErrorC_Check(hdl,MqSlaveGetProxy (hdl, id, &ctx_out));
3253 OT_retObj_SET_CTX(ctx_out)
3254 goto end;
3255 error:
3256 OT_retObj_SET_Error
3257 end:
3259}
#define SlaveGetProxy_doc
#define MqSlaveGetProxy(...)

◆ py_mqmsgque_MqContextC_SlaveIs()

static OT_ProcRet py_mqmsgque_MqContextC_SlaveIs ( MqContextC_ARGS )
static

Python: bool ctx.SlaveIs() C-API
is the context a slave-context ? …

Definition at line 3313 of file MqContextC_py.c.

3313 {
3315 OT_SETUP_NOARG(SlaveIs_doc)
3316 OT_CHECK_NOARGS
3317 OT_retObj_SET_BOL(MqSlaveIs (hdl))
3318 goto end;
3319 error:
3320 OT_retObj_SET_Error
3321 end:
3323}
#define SlaveIs_doc
bool MqSlaveIs(MQ_CTXN const ctx)
is the context a slave-context ? …

◆ py_mqmsgque_MqContextC_SlaveWorker()

static OT_ProcRet py_mqmsgque_MqContextC_SlaveWorker ( MqContextC_ARGS )
static

Python: ctx.SlaveWorker(id:MqSlaveE|int32, ?fct:string="WORKER"?, ?args:MkBufferListC...=None?) C-API
create a master/slave link using the image of the ctx object self. …

Definition at line 3326 of file MqContextC_py.c.

3326 {
3328 OT_SETUP_VARARGS(1,99,SlaveWorker_doc)
3329 MQ_SLAVE_ID id = 0;
3330 OT_CHECK_REQUIRED(OT_CHECK_SLAVE_ID (id))
3331 MK_STRN fct = "WORKER";
3332 OT_CHECK_OPTIONAL(OT_CHECK_STRN (fct))
3333 MkBufferListCreateTLS_T(args,10);
3334 OT_CHECK_OPTIONAL(OT_CHECK_BAC (args))
3335 OT_CHECK_NOARGS
3336 MkErrorC_Check(hdl,MqSlaveWorker (hdl, id, fct, args));
3337 OT_retObj_SET_None
3338 goto end;
3339 error:
3340 OT_retObj_SET_Error
3341 end:
3343}
#define SlaveWorker_doc
#define MkBufferListCreateTLS_T(name, num)
const MK_STRB * MK_STRN
#define MqSlaveWorker(...)