Checking network input processing by Python for a multi-threaded server

Markus Elfring Markus.Elfring at web.de
Mon Apr 29 11:35:59 EDT 2019


Hello,

I constructed another multi-threaded TCP server for my needs
(based on the available software documentation).
https://docs.python.org/3/library/socketserver.html#asynchronous-mixins

I constructed also a corresponding script which should send nine record sets
(which get extracted from a simple JSON file) to this server on my local host
by the software “Python 3.7.2-3.1” (for an openSUSE system).
Related background information can be seen for a discussion topic like
“Data exchange over network interfaces by SmPL scripts”.
https://systeme.lip6.fr/pipermail/cocci/2019-April/005792.html
https://lore.kernel.org/cocci/6ec5b70f-39c3-79e5-608f-446a870f02f3@web.de/

The file name for the client script is passed by a parameter to a command
which is repeated by this server in a loop.
It is evaluated then how often a known record set count was sent.
I got a test result like the following.


elfring at Sonne:~/Projekte/Coccinelle/janitor> time /usr/bin/python3 list_last_two_statements_from_if_branches-statistic-server3.py
"return code"|"received records"|"command output"|incidence
0|9||63
0|5||5
0|13||2
0|10||5
0|11||7
0|8||3
0|7||3
0|14||3
0|6||4
0|12||3
0|4||2

real	1m23,301s
user	0m6,434s
sys	0m1,430s


* How should this data processing approach be adjusted so that the same number
  of records will be handled in a consistent way?

* Which challenges from inter-process communication should be taken better into
  account for the involved programming interfaces (because of multi-threading)?

Regards,
Markus



More information about the Python-list mailing list