[PD-dev] [tcpserver]: bad performance of new version

Roman Haefeli reduzierer at yahoo.de
Mon Apr 27 02:27:22 CEST 2009


hi martin, hi all

i ve been testing the new netpd-server based on the new
[tcpserver]/[tcsocketserver FUDI] now for a while and definitely could
solve some problems, but some new ones were introduced. 

i found, that the most recent version of [tcpserver] peforms quite bad
cpu-wise. this has some side-effects. in netpd, when a certain number of
users are logged in (let's say 16), it can happen, that the traffic of
those clients makes the netpd-server use more than the available
cpu-time. i made some tests and checked, if all messages come through
and if messages delivered by the server are still intact. under normal
circumstances, there is no problem at all. but under heavy load, when
the pd process is demanding more than available cpu time, some messages
are corrupted or lost completely; in the worst case the pd process
segfaults, at the moment of  a client connecting or disconnecting. i
guess, this is due to some buffer under- or overrun between pd and the
tcp stack, but i don't really know.
i wrote a benchmark patch and found out, that not only the new
netpd-server patch performs badly, but quite some portion of bad
performance comes from the new [tcpserver]. the testpatch compares
perfomances of sending data to clients using [tcpserver] and [netserver]
from maxlib. the version of [tcpserver] shipped with current pd-extended
performs slightly better than [netserver] (tested on OS X and linux).
however, the most recent version, that solves the tcp buffer overrun
problem, performs ~11 times worse than [netserver]. is that the trade
off from solving the other issue? or could this theoretically be
improved?

unfortunately, i still don't have a netpd-server running, which can be
considered stable. the current one doesn't crash anymore, because
clients lost network connection, but it crashes, when there is too much
traffic. respectively, it cannot be considered reliable, because it
drops messages under certain circumstances.

@code-maintainers
is anyone maintaining the code of [netserver] or maxlib in general? this
object class still suffers from the 'buffer overrun -> pd hangs'
problem. since the same problem was fixed for [tcpserver], it might not
be too hard to port that fix to [netserver]. i am not able to dig into c
sources, so i wanted to kindly ask here, if someone is interested to do
it.
[tcpsocketserver FUDI] was meant as a replacement for [netserver] in
order to get rid of the pd hangs caused by it. however, now i am not
sure anymore, if this approach was a good idea at all, since the
overhead from implementing FUDI parsing and stuff in pd instead of in c
seems to be enormeous. 

roman
-------------- next part --------------
#N canvas 487 70 836 334 10;
#X obj 113 123 realtime;
#X obj 27 39 t b b b;
#X floatatom 113 146 5 0 0 0 - - -;
#X msg 27 15 bang;
#X obj 46 252 mrpeach/tcpserver 3330;
#X obj 359 32 maxlib;
#X obj 456 253 netserver 3335;
#X obj 46 152 until;
#X obj 517 92 realtime;
#X obj 437 49 t b b b;
#X floatatom 517 115 5 0 0 0 - - -;
#X msg 437 21 bang;
#X obj 456 128 until;
#X msg 46 130 1000;
#X msg 456 106 1000;
#X msg 456 200 broadcast hallo velo zulu melo modulo drama panik lausig
mund freud;
#X msg 46 176 broadcast 104 97 108 108 111 32 118 101 108 111 32 122
117 108 117 32 109 101 108 111 32 109 111 100 117 108 111 32 100 114
97 109 97 32 112 97 110 105 107 32 108 97 117 115 105 103 32 109 117
110 100 32 102 114 101 117 100 59 10;
#X connect 0 0 2 0;
#X connect 1 0 0 1;
#X connect 1 1 13 0;
#X connect 1 2 0 0;
#X connect 3 0 1 0;
#X connect 7 0 16 0;
#X connect 8 0 10 0;
#X connect 9 0 8 1;
#X connect 9 1 14 0;
#X connect 9 2 8 0;
#X connect 11 0 9 0;
#X connect 12 0 15 0;
#X connect 13 0 7 0;
#X connect 14 0 12 0;
#X connect 15 0 6 0;
#X connect 16 0 4 0;
-------------- next part --------------
#N canvas 66 76 455 834 10;
#X obj 167 18 maxlib;
#X obj 13 97 netclient;
#X msg 25 54 connect localhost 3330;
#X msg 13 72 disconnect;
#X obj 13 120 spigot;
#X obj 82 126 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 13 143 print TCP;
#X obj 13 29 sel 0 1;
#X obj 13 9 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#X obj 16 255 netclient;
#X msg 28 212 connect localhost 3330;
#X msg 16 230 disconnect;
#X obj 16 278 spigot;
#X obj 85 284 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 16 301 print TCP;
#X obj 16 187 sel 0 1;
#X obj 16 167 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 18 421 netclient;
#X msg 30 378 connect localhost 3330;
#X msg 18 396 disconnect;
#X obj 18 444 spigot;
#X obj 87 450 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 18 467 print TCP;
#X obj 18 353 sel 0 1;
#X obj 18 333 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 20 602 netclient;
#X msg 32 559 connect localhost 3330;
#X msg 20 577 disconnect;
#X obj 20 625 spigot;
#X obj 89 631 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 20 648 print TCP;
#X obj 20 534 sel 0 1;
#X obj 20 514 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 267 112 netclient;
#X msg 269 87 disconnect;
#X obj 267 133 spigot;
#X obj 337 135 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 281 64 connect localhost 3335;
#X obj 267 155 print NET;
#X obj 273 36 sel 0 1;
#X obj 273 16 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 273 285 netclient;
#X msg 275 260 disconnect;
#X obj 273 306 spigot;
#X obj 343 308 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 287 237 connect localhost 3335;
#X obj 273 328 print NET;
#X obj 279 209 sel 0 1;
#X obj 279 189 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 273 452 netclient;
#X msg 275 427 disconnect;
#X obj 273 473 spigot;
#X obj 343 475 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 287 404 connect localhost 3335;
#X obj 273 495 print NET;
#X obj 279 376 sel 0 1;
#X obj 279 356 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 273 644 netclient;
#X msg 275 619 disconnect;
#X obj 273 665 spigot;
#X obj 343 667 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 287 596 connect localhost 3335;
#X obj 273 687 print NET;
#X obj 279 568 sel 0 1;
#X obj 279 548 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X connect 1 0 4 0;
#X connect 2 0 1 0;
#X connect 3 0 1 0;
#X connect 4 0 6 0;
#X connect 5 0 4 1;
#X connect 7 0 3 0;
#X connect 7 1 2 0;
#X connect 8 0 7 0;
#X connect 9 0 12 0;
#X connect 10 0 9 0;
#X connect 11 0 9 0;
#X connect 12 0 14 0;
#X connect 13 0 12 1;
#X connect 15 0 11 0;
#X connect 15 1 10 0;
#X connect 16 0 15 0;
#X connect 17 0 20 0;
#X connect 18 0 17 0;
#X connect 19 0 17 0;
#X connect 20 0 22 0;
#X connect 21 0 20 1;
#X connect 23 0 19 0;
#X connect 23 1 18 0;
#X connect 24 0 23 0;
#X connect 25 0 28 0;
#X connect 26 0 25 0;
#X connect 27 0 25 0;
#X connect 28 0 30 0;
#X connect 29 0 28 1;
#X connect 31 0 27 0;
#X connect 31 1 26 0;
#X connect 32 0 31 0;
#X connect 33 0 35 0;
#X connect 34 0 33 0;
#X connect 35 0 38 0;
#X connect 36 0 35 1;
#X connect 37 0 33 0;
#X connect 39 0 34 0;
#X connect 39 1 37 0;
#X connect 40 0 39 0;
#X connect 41 0 43 0;
#X connect 42 0 41 0;
#X connect 43 0 46 0;
#X connect 44 0 43 1;
#X connect 45 0 41 0;
#X connect 47 0 42 0;
#X connect 47 1 45 0;
#X connect 48 0 47 0;
#X connect 49 0 51 0;
#X connect 50 0 49 0;
#X connect 51 0 54 0;
#X connect 52 0 51 1;
#X connect 53 0 49 0;
#X connect 55 0 50 0;
#X connect 55 1 53 0;
#X connect 56 0 55 0;
#X connect 57 0 59 0;
#X connect 58 0 57 0;
#X connect 59 0 62 0;
#X connect 60 0 59 1;
#X connect 61 0 57 0;
#X connect 63 0 58 0;
#X connect 63 1 61 0;
#X connect 64 0 63 0;


More information about the Pd-dev mailing list