theLink 10.0
Loading...
Searching...
No Matches
MqContextC_SlaveApi_JV_API

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

+ Collaboration diagram for MqContextC_SlaveApi_JV_API:

Functions

native MqContextC jvmqmsgque.MqContextC.SlaveGetMaster ()
  Java: MqContextC ctx.SlaveGetMaster() C-API
opposite function of MqSlaveGetFilter
 
native MqContextC jvmqmsgque.MqContextC.SlaveGet (int id)
  Java: MqContextC ctx.SlaveGet(int id) C-API
get the slave-context from a master-context
 
native MqContextC jvmqmsgque.MqContextC.SlaveGetFilter ()
  Java: MqContextC ctx.SlaveGetFilter() C-API
get the filter-ctx or the master-ctx
 
native MqContextC jvmqmsgque.MqContextC.SlaveGetProxy (int id)
  Java: MqContextC ctx.SlaveGetProxy(int id) C-API
on slave return the master and on master return the slave identified by id.
 
native boolean jvmqmsgque.MqContextC.SlaveCheck (int id)
  Java: boolean ctx.SlaveCheck(int id) C-API
check if slave-id is valid
 
native void jvmqmsgque.MqContextC.SlaveCreate (int id, MqContextC slave)
  Java: ctx.SlaveCreate(int id, MqContextC slave) C-API
create a master/slave link between the master-parent-context and the slave-parent-context …
 
native void jvmqmsgque.MqContextC.SlaveDelete (int id)
  Java: ctx.SlaveDelete(int id) C-API
Delete a slave object from a master/slave link identified by id. …
 
native boolean jvmqmsgque.MqContextC.SlaveIs ()
  Java: boolean ctx.SlaveIs() C-API
is the context a slave-context ? …
 
native void jvmqmsgque.MqContextC.SlaveWorker (int id, String fct, MkBufferListC args)
  Java: 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 jvmqmsgque.MqContextC.SlaveWorker (int id, String fct, String... args)
  Java: 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 jvmqmsgque.MqContextC.SlaveWorker (int id)
  Java: 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 jvmqmsgque.MqContextC.SlaveWorker (int id, String fct)
  Java: 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. …
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqContextC_SlaveGetMaster (JNIEnv *env, jobject self)
  Java: MqContextC ctx.SlaveGetMaster() C-API
opposite function of MqSlaveGetFilter
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqContextC_SlaveGet (JNIEnv *env, jobject self, jint id)
  Java: MqContextC ctx.SlaveGet(int id) C-API
get the slave-context from a master-context
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqContextC_SlaveGetFilter (JNIEnv *env, jobject self)
  Java: MqContextC ctx.SlaveGetFilter() C-API
get the filter-ctx or the master-ctx
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqContextC_SlaveGetProxy (JNIEnv *env, jobject self, jint id)
  Java: MqContextC ctx.SlaveGetProxy(int id) C-API
on slave return the master and on master return the slave identified by id.
 
JNIEXPORT jboolean JNICALL Java_jvmqmsgque_MqContextC_SlaveCheck (JNIEnv *env, jobject self, jint id)
  Java: boolean ctx.SlaveCheck(int id) C-API
check if slave-id is valid
 
JNIEXPORT void JNICALL Java_jvmqmsgque_MqContextC_SlaveCreate (JNIEnv *env, jobject self, jint id, jobject slave)
  Java: ctx.SlaveCreate(int id, MqContextC slave) C-API
create a master/slave link between the master-parent-context and the slave-parent-context …
 
JNIEXPORT void JNICALL Java_jvmqmsgque_MqContextC_SlaveDelete (JNIEnv *env, jobject self, jint id)
  Java: ctx.SlaveDelete(int id) C-API
Delete a slave object from a master/slave link identified by id. …
 
JNIEXPORT jboolean JNICALL Java_jvmqmsgque_MqContextC_SlaveIs (JNIEnv *env, jobject self)
  Java: boolean ctx.SlaveIs() C-API
is the context a slave-context ? …
 
JNIEXPORT void JNICALL Java_jvmqmsgque_MqContextC_SlaveWorker (JNIEnv *env, jobject self, jint id, jstring fct, jobject args)
  Java: 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 -

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

◆ Java_jvmqmsgque_MqContextC_SlaveCheck()

JNIEXPORT jboolean JNICALL Java_jvmqmsgque_MqContextC_SlaveCheck ( JNIEnv * env,
jobject self,
jint id )

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

Definition at line 2434 of file MqContextC_jv.c.

2434 {
2435 MQ_CTXN hdl = (MQ_CTXN)pObj2Hdl(env,"MqContextC",self);
2436 JavaErrorCheck;
2437 MkRtSetup_X(hdl);
2438 MK_BOOL __retVal__L = MqSlaveCheck(hdl, id);
2439 jboolean __retVal__S = __retVal__L;
2440 return __retVal__S;
2441error:
2442 return 0;
2443}
bool MK_BOOL
#define MkRtSetup_X(x)
const struct MqContextS * MQ_CTXN
class-shortcut for const struct MqContextS *, all const shortcut using the XX_YYYC syntax (only for p...
static bool MqSlaveCheck(MQ_CTXN const ctx, MQ_SLAVE_ID const id)
check if slave-id is valid
PUBLIC data structure for the jvmqmsgque-specific-data

◆ Java_jvmqmsgque_MqContextC_SlaveCreate()

JNIEXPORT void JNICALL Java_jvmqmsgque_MqContextC_SlaveCreate ( JNIEnv * env,
jobject self,
jint id,
jobject slave )

Java: 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 2446 of file MqContextC_jv.c.

2446 {
2447 MQ_CTX hdl = (MQ_CTX)pObj2Hdl(env,"MqContextC",self);
2448 JavaErrorCheck;
2449 MkRtSetup_X(hdl);
2450 MQ_CTX slave_hdl = (MQ_CTX)pObj2Hdl(env,"MqContextC",slave);
2451 JavaErrorCheck;
2452 enum MkErrorE errVal = MqSlaveCreate(hdl, id, slave_hdl);
2453 MkErrorC_Check(hdl, errVal)
2454error:
2455 return;
2456}
MkErrorE
struct MqContextS * MQ_CTX
class-shortcut for struct MqContextS *, all shortcut using the XX_YYY syntax (only for public API) …
#define MqSlaveCreate(...)

◆ Java_jvmqmsgque_MqContextC_SlaveDelete()

JNIEXPORT void JNICALL Java_jvmqmsgque_MqContextC_SlaveDelete ( JNIEnv * env,
jobject self,
jint id )

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

Definition at line 2459 of file MqContextC_jv.c.

2459 {
2460 MQ_CTX hdl = (MQ_CTX)pObj2Hdl(env,"MqContextC",self);
2461 JavaErrorCheck;
2462 MkRtSetup_X(hdl);
2463 enum MkErrorE errVal = MqSlaveDelete(hdl, id);
2464 MkErrorC_Check(hdl, errVal)
2465error:
2466 return;
2467}
#define MqSlaveDelete(...)

◆ Java_jvmqmsgque_MqContextC_SlaveGet()

JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqContextC_SlaveGet ( JNIEnv * env,
jobject self,
jint id )

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

Definition at line 2390 of file MqContextC_jv.c.

2390 {
2391 MQ_CTX hdl = (MQ_CTX)pObj2Hdl(env,"MqContextC",self);
2392 JavaErrorCheck;
2393 MkRtSetup_X(hdl);
2394 MQ_CTX ctx_out;
2395 enum MkErrorE errVal = MqSlaveGet(hdl, id, &ctx_out);
2396 MkErrorC_Check(hdl, errVal)
2397 jobject __retVal__S = MQ(MqContextC_ObjNew)(MK_RT_CALL env,ctx_out);
2398 return __retVal__S;
2399error:
2400 return 0;
2401}
#define MK_RT_CALL
#define MqSlaveGet(...)

◆ Java_jvmqmsgque_MqContextC_SlaveGetFilter()

JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqContextC_SlaveGetFilter ( JNIEnv * env,
jobject self )

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

Definition at line 2404 of file MqContextC_jv.c.

2404 {
2405 MQ_CTX hdl = (MQ_CTX)pObj2Hdl(env,"MqContextC",self);
2406 JavaErrorCheck;
2407 MkRtSetup_X(hdl);
2408 MQ_CTX ctx_out;
2409 enum MkErrorE errVal = MqSlaveGetFilter(hdl, &ctx_out);
2410 MkErrorC_Check(hdl, errVal)
2411 jobject __retVal__S = MQ(MqContextC_ObjNew)(MK_RT_CALL env,ctx_out);
2412 return __retVal__S;
2413error:
2414 return 0;
2415}
#define MqSlaveGetFilter(...)

◆ Java_jvmqmsgque_MqContextC_SlaveGetMaster()

JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqContextC_SlaveGetMaster ( JNIEnv * env,
jobject self )

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

Definition at line 2376 of file MqContextC_jv.c.

2376 {
2377 MQ_CTX hdl = (MQ_CTX)pObj2Hdl(env,"MqContextC",self);
2378 JavaErrorCheck;
2379 MkRtSetup_X(hdl);
2380 MQ_CTX __retVal__L = MqSlaveGetMaster(hdl);
2381 jobject __retVal__S = MQ(MqContextC_ObjNew)(MK_RT_CALL env,__retVal__L);
2382 return __retVal__S;
2383error:
2384 return 0;
2385}
static MQ_CTX MqSlaveGetMaster(MQ_CTX const ctx)
opposite function of MqSlaveGetFilter

◆ Java_jvmqmsgque_MqContextC_SlaveGetProxy()

JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqContextC_SlaveGetProxy ( JNIEnv * env,
jobject self,
jint id )

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

Definition at line 2418 of file MqContextC_jv.c.

2418 {
2419 MQ_CTX hdl = (MQ_CTX)pObj2Hdl(env,"MqContextC",self);
2420 JavaErrorCheck;
2421 MkRtSetup_X(hdl);
2422 MQ_CTX ctx_out;
2423 enum MkErrorE errVal = MqSlaveGetProxy(hdl, id, &ctx_out);
2424 MkErrorC_Check(hdl, errVal)
2425 jobject __retVal__S = MQ(MqContextC_ObjNew)(MK_RT_CALL env,ctx_out);
2426 return __retVal__S;
2427error:
2428 return 0;
2429}
#define MqSlaveGetProxy(...)

◆ Java_jvmqmsgque_MqContextC_SlaveIs()

JNIEXPORT jboolean JNICALL Java_jvmqmsgque_MqContextC_SlaveIs ( JNIEnv * env,
jobject self )

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

Definition at line 2470 of file MqContextC_jv.c.

2470 {
2471 MQ_CTXN hdl = (MQ_CTXN)pObj2Hdl(env,"MqContextC",self);
2472 JavaErrorCheck;
2473 MkRtSetup_X(hdl);
2474 MK_BOOL __retVal__L = MqSlaveIs(hdl);
2475 jboolean __retVal__S = __retVal__L;
2476 return __retVal__S;
2477error:
2478 return 0;
2479}
static bool MqSlaveIs(MQ_CTXN const ctx)
is the context a slave-context ? …

◆ Java_jvmqmsgque_MqContextC_SlaveWorker()

JNIEXPORT void JNICALL Java_jvmqmsgque_MqContextC_SlaveWorker ( JNIEnv * env,
jobject self,
jint id,
jstring fct,
jobject args )

Java: 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 2482 of file MqContextC_jv.c.

2482 {
2483 MQ_CTX hdl = (MQ_CTX)pObj2Hdl(env,"MqContextC",self);
2484 JavaErrorCheck;
2485 MkRtSetup_X(hdl);
2486 MK_BAC args_hdl = (MK_BAC)pObj2Hdl__null_allow(env,args);
2487 JavaErrorCheck;
2488 MK_STRN fct_ptr = (fct?(*env)->GetStringUTFChars(env,fct,NULL):NULL);
2489 JavaErrorCheck;
2490 enum MkErrorE errVal = MqSlaveWorker(hdl, id, fct_ptr, args_hdl);
2491 MkErrorC_Check(hdl, errVal)
2492 if (fct_ptr) (*env)->ReleaseStringUTFChars(env,fct,fct_ptr);
2493error:
2494 return;
2495}
struct MkBufferListS * MK_BAC
const MK_STRB * MK_STRN
#define MqSlaveWorker(...)

◆ SlaveCheck()

native boolean jvmqmsgque.MqContextC.SlaveCheck ( int id)

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

◆ SlaveCreate()

native void jvmqmsgque.MqContextC.SlaveCreate ( int id,
MqContextC slave )

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

◆ SlaveDelete()

native void jvmqmsgque.MqContextC.SlaveDelete ( int id)

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

◆ SlaveGet()

native MqContextC jvmqmsgque.MqContextC.SlaveGet ( int id)

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

◆ SlaveGetFilter()

native MqContextC jvmqmsgque.MqContextC.SlaveGetFilter ( )

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

◆ SlaveGetMaster()

native MqContextC jvmqmsgque.MqContextC.SlaveGetMaster ( )

◆ SlaveGetProxy()

native MqContextC jvmqmsgque.MqContextC.SlaveGetProxy ( int id)

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

◆ SlaveIs()

native boolean jvmqmsgque.MqContextC.SlaveIs ( )

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

◆ SlaveWorker() [1/4]

void jvmqmsgque.MqContextC.SlaveWorker ( int id)

Java: 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 1066 of file MqContextC.java.

1066 {
1067 SlaveWorker (id, "WORKER", (MkBufferListC) null);
1068 }
native void SlaveWorker(int id, String fct, MkBufferListC args)
Java: ctx.SlaveWorker(int id, ?String fct = "WORKER"?, ?MkBufferListC args = null?...

◆ SlaveWorker() [2/4]

void jvmqmsgque.MqContextC.SlaveWorker ( int id,
String fct )

Java: 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 1071 of file MqContextC.java.

1071 {
1072 SlaveWorker (id, fct, (MkBufferListC) null);
1073 }

◆ SlaveWorker() [3/4]

native void jvmqmsgque.MqContextC.SlaveWorker ( int id,
String fct,
MkBufferListC args )

Java: 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. …

+ Here is the caller graph for this function:

◆ SlaveWorker() [4/4]

void jvmqmsgque.MqContextC.SlaveWorker ( int id,
String fct,
String... args )

Java: 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 1061 of file MqContextC.java.

1061 {
1062 SlaveWorker (id, fct, new MkBufferListC(args));
1063 }