Documentation of the perfserver tool used for example.test
.
The perfserver tool is used server-part of the performance-test
To perform the test the perfclient send various service request to the perfserver. The perfclient is written in C and finally create a report.
All context created, are connected using the pymqmsgque protocoll and build together a flat-like structure.
The GOAL for this setup is:
client → server → client
round-trip.#+ #: -*- coding: utf8 -*- #: #: @file NHI1/example/py/perfserver.py #: @brief perfserver.py - 18 Aug 2024 - aotto1968 #: @copyright (C) NHI - #1 - Project - Group #: This software has NO permissions to copy, #: please contact AUTHOR for additional information #: @version 633c99b943854f56f10720c0377e41fcb3b1260e #: @date Sun Aug 18 14:30:16 2024 +0200 #: @author aotto1968 <aotto1968@t-online.de> #: import sys from pymkkernel import * from pymqmsgque import * # run the new command using the given tracer class perfserver(MqContextC): # factory startup def __init__(self, tmpl=None): self.ConfigSetServerSetup(self.ServerSetup) super().__init__() def ECOU(self): self.SendSTART() self.SendBUF(self.ReadBUF()) self.SendRETURN() def ECOI(self): self.SendSTART() self.SendI32(self.ReadI32()) self.SendRETURN() def ECUL(self): self.SendSTART() self.SendI8(self.ReadI8()) self.SendI16(self.ReadI16()) self.SendI32(self.ReadI32()) self.SendDBL(self.ReadDBL()) self.ProxyItem(self) self.SendRETURN() def RDUL(self): self.ReadI8() self.ReadI16() self.ReadI32() self.ReadDBL() self.ReadBUF() def RDUC(self): self.ReadSTR() self.ReadSTR() self.ReadSTR() self.ReadSTR() self.ReadSTR() def STDB (self): self.SendSTART () self.StorageOpen (self.ReadSTR()) self.SendRETURN () def STDC (self): self.SendSTART () self.StorageClose () self.SendRETURN () # [BufferStream-Create-TLS] def BUST (self): bus = MkBufferStreamC.CreateTLS( "perfserver-BUST" ) while self.ReadItemExists(): bus.WriteBUF(self.ReadBUF()) bus.PosToStart() self.SendSTART() while bus.ReadItemExists(): self.SendBUF(bus.ReadBUF()) self.SendRETURN() # [BufferStream-Create-TLS] # [BufferList-Create-TLS] def BFLT (self): bfl = MkBufferListC.CreateTLS( "perfserver-BFLT" ) while self.ReadItemExists(): bfl.AppendBUF(self.ReadBUF()) self.SendSTART() for i in range(bfl.Size()): self.SendBUF(bfl.IndexGet(i)) self.SendRETURN() # [BufferList-Create-TLS] def BINT (self): self.ReadBIN () def STRT (self): self.ReadSTR () def NTHT (self): pass def MARK (self): self.DbgL(self.ReadSTR()) def ServerSetup(self): self.ServiceCreate("ECOU",perfserver.ECOU) self.ServiceCreate("ECOI",perfserver.ECOI) self.ServiceCreate("ECUL",perfserver.ECUL) self.ServiceCreate("RDUL",perfserver.RDUL) self.ServiceCreate("RDUC",perfserver.RDUC) self.ServiceCreate("STDB",perfserver.STDB) self.ServiceCreate("STDC",perfserver.STDC) self.ServiceCreate("BUST",perfserver.BUST) self.ServiceCreate("BFLT",perfserver.BFLT) self.ServiceCreate("BINT",perfserver.BINT) self.ServiceCreate("STRT",perfserver.STRT) self.ServiceCreate("NTHT",perfserver.NTHT) self.ServiceCreate("MARK",perfserver.MARK) if __name__ == "__main__": # [factory-item] # create the "perfserver" factory… and the object srv = MqFactoryC.Add(perfserver).New() # [factory-item] try: srv.LinkCreate(sys.argv) srv.ProcessEvent(MqWaitOnEventE.FOREVER) except Exception as ex: srv.ErrorCatch(ex) finally: srv.Exit()