0

tpinit and tptern tuxedo function taking time. Its basically used in every request by client to join and leave the application. we observed heavy slowness when number of request is higher from a multi-threaded client process.

We try to increase the virtual core in machine but still face the same problem.

TPINIT   *   tpinitbuf;
if((tpinitbuf = (TPINIT *)tpalloc("TPINIT",(char *)NULL,TPINITNEED(16))) == (TPINIT *)NULL)
{
    printf("ERROR IS:: %s\n", tpstrerror(tperrno));
    return NULL;
}
tpinitbuf->flags = TPMULTICONTEXTS;
tpinit(tpinitbuf); //this function is taking time. 
tpgetctxt(&ctxt, 0);
tpfree ((char *) tpinitbuf) ; 
retVal=tpcall("MY_SERVICE",(char *)buf1,0,(char **) &buf2,&size,0L);
tpterm(); // this function is taking time.

Ideally tpinit, tpterm should take around 50 milliseconds, but when number of request is high its takes around 1.3 sec.

robsiemb
  • 6,157
  • 7
  • 32
  • 46

1 Answers1

0

Why do you do that? Do tpinit() once for thread and do tpterm() only when the thread terminates. If you create new short-lived threads all the time then switch to using a thread pool.

Think of "joining Tuxedo application" as "connecting to a database" - and connecting/disconnecting does not seem such a great idea anymore.

There is a number of things tpinit() has to do: register itself in the shared memory (takes semaphores to prevent concurrent updates), create a reply queue and register it in the shared memory (so BBL can clean up after crashed processes), lookup service-to-queue mapping, loading plug-ins, etc. Tuxedo could be faster at all of that but if you do that too often it's your own fault, not Tuxedo's.

aivarsk
  • 478
  • 5
  • 7