theLink 10.0
Loading...
Searching...
No Matches
MqContextC_SlaveApi_CS_API

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

+ Collaboration diagram for MqContextC_SlaveApi_CS_API:

Functions

MqContextC csmqmsgque.MqContextC.SlaveGetMaster ()
  C#: MqContextC ctx.SlaveGetMaster() C-API
opposite function of MqSlaveGetFilter
 
MqContextC csmqmsgque.MqContextC.SlaveGet (int id)
  C#: MqContextC ctx.SlaveGet(int id) C-API
get the slave-context from a master-context
 
MqContextC csmqmsgque.MqContextC.SlaveGetFilter ()
  C#: MqContextC ctx.SlaveGetFilter() C-API
get the filter-ctx or the master-ctx
 
MqContextC csmqmsgque.MqContextC.SlaveGetProxy (int id)
  C#: MqContextC ctx.SlaveGetProxy(int id) C-API
on slave return the master and on master return the slave identified by id.
 
bool csmqmsgque.MqContextC.SlaveCheck (int id)
  C#: bool ctx.SlaveCheck(int id) C-API
check if slave-id is valid
 
void csmqmsgque.MqContextC.SlaveCreate (int id, MqContextC slave)
  C#: ctx.SlaveCreate(int id, MqContextC slave) C-API
create a master/slave link between the master-parent-context and the slave-parent-context …
 
void csmqmsgque.MqContextC.SlaveDelete (int id)
  C#: ctx.SlaveDelete(int id) C-API
Delete a slave object from a master/slave link identified by id. …
 
bool csmqmsgque.MqContextC.SlaveIs ()
  C#: bool ctx.SlaveIs() C-API
is the context a slave-context ? …
 
void csmqmsgque.MqContextC.SlaveWorker (int id, string fct="WORKER", MkBufferListC args=null)
  C#: ctx.SlaveWorker(int id, string fct = "WORKER", MkBufferListC args = null) C-API
create a master/slave link using the image of the ctx object self. …
 
void csmqmsgque.MqContextC.SlaveWorker (int id, string fct="WORKER", params string[] args)
  C#: ctx.SlaveWorker(int id, string fct = "WORKER", MkBufferListC args = null) 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

◆ SlaveCheck()

bool csmqmsgque.MqContextC.SlaveCheck ( int id)
inline

C#: bool ctx.SlaveCheck(int id) C-API
check if slave-id is valid

Definition at line 1754 of file MqContextC.cs.

1754 {
1755 bool __retVal__L = Mq.MqSlaveCheck(hdl, id);
1756 return __retVal__L;
1757 }
csmqmsgque.MqMsgque Mq

◆ SlaveCreate()

void csmqmsgque.MqContextC.SlaveCreate ( int id,
MqContextC slave )
inline

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

Definition at line 1760 of file MqContextC.cs.

1760 {
1761 IntPtr slave_hdl = MqContextC.getOBJ("MqContextC",slave);
1762 MkErrorE errVal = Mq.MqSlaveCreate(mkrt, hdl, id, slave_hdl);
1763 MkErrorC.Check(hdl, errVal);
1764 }
static void Check(IntPtr ctx, MkErrorE err)
MkErrorE

◆ SlaveDelete()

void csmqmsgque.MqContextC.SlaveDelete ( int id)
inline

C#: ctx.SlaveDelete(int id) C-API
Delete a slave object from a master/slave link identified by id. …

Definition at line 1767 of file MqContextC.cs.

1767 {
1768 MkErrorE errVal = Mq.MqSlaveDelete(mkrt, hdl, id);
1769 MkErrorC.Check(hdl, errVal);
1770 }

◆ SlaveGet()

MqContextC csmqmsgque.MqContextC.SlaveGet ( int id)
inline

C#: MqContextC ctx.SlaveGet(int id) C-API
get the slave-context from a master-context

Definition at line 1728 of file MqContextC.cs.

1728 {
1729 IntPtr ctx_out;
1730 MkErrorE errVal = Mq.MqSlaveGet(mkrt, hdl, id, out ctx_out);
1731 MkErrorC.Check(hdl, errVal);
1732 return MqContextC.MqContextC_ObjNew(ctx_out);
1733 }

◆ SlaveGetFilter()

MqContextC csmqmsgque.MqContextC.SlaveGetFilter ( )
inline

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

Definition at line 1736 of file MqContextC.cs.

1736 {
1737 IntPtr ctx_out;
1738 MkErrorE errVal = Mq.MqSlaveGetFilter(mkrt, hdl, out ctx_out);
1739 MkErrorC.Check(hdl, errVal);
1740 return MqContextC.MqContextC_ObjNew(ctx_out);
1741 }

◆ SlaveGetMaster()

MqContextC csmqmsgque.MqContextC.SlaveGetMaster ( )
inline

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

Definition at line 1720 of file MqContextC.cs.

1720 {
1721 IntPtr __retVal__L = Mq.MqSlaveGetMaster(hdl);
1722 return MqContextC.MqContextC_ObjNew(__retVal__L);
1723 }

◆ SlaveGetProxy()

MqContextC csmqmsgque.MqContextC.SlaveGetProxy ( int id)
inline

C#: MqContextC ctx.SlaveGetProxy(int id) C-API
on slave return the master and on master return the slave identified by id.

Definition at line 1744 of file MqContextC.cs.

1744 {
1745 IntPtr ctx_out;
1746 MkErrorE errVal = Mq.MqSlaveGetProxy(mkrt, hdl, id, out ctx_out);
1747 MkErrorC.Check(hdl, errVal);
1748 return MqContextC.MqContextC_ObjNew(ctx_out);
1749 }

◆ SlaveIs()

bool csmqmsgque.MqContextC.SlaveIs ( )
inline

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

Definition at line 1773 of file MqContextC.cs.

1773 {
1774 bool __retVal__L = Mq.MqSlaveIs(hdl);
1775 return __retVal__L;
1776 }

◆ SlaveWorker() [1/2]

void csmqmsgque.MqContextC.SlaveWorker ( int id,
string fct = "WORKER",
MkBufferListC args = null )
inline

C#: ctx.SlaveWorker(int id, string fct = "WORKER", MkBufferListC args = null) C-API
create a master/slave link using the image of the ctx object self. …

Definition at line 1779 of file MqContextC.cs.

1779 {
1780 IntPtr args_hdl = MkBufferListC.getOBJ_null_allow(args);
1781 IntPtr fct_cstr = Marshal.StringToHGlobalAnsi(fct);
1782 MkErrorE errVal = Mq.MqSlaveWorker(mkrt, hdl, id, fct_cstr, args_hdl);
1783 Marshal.FreeHGlobal(fct_cstr);
1784 MkErrorC.Check(hdl, errVal);
1785 }
+ Here is the caller graph for this function:

◆ SlaveWorker() [2/2]

void csmqmsgque.MqContextC.SlaveWorker ( int id,
string fct = "WORKER",
params string[] args )
inline

C#: ctx.SlaveWorker(int id, string fct = "WORKER", MkBufferListC args = null) C-API
create a master/slave link using the image of the ctx object self. …

Definition at line 1788 of file MqContextC.cs.

1788 {
1789 // OVERLOAD
1790 SlaveWorker (id, fct, new MkBufferListC(args));
1791 }
void SlaveWorker(int id, string fct="WORKER", MkBufferListC args=null)
C#: ctx.SlaveWorker(int id, string fct = "WORKER", MkBufferListC args = null) → C-API create a ...