[Verse-dev] Performance

Eskil Steenberg eskil at obsession.se
Thu Jun 9 22:13:12 CEST 2005


Hi

> As far as I understood the callback_update function is the "downstream"
> connection to verse, that gives me all my updates that are arriving from
> verse. Every send command is handled in a direct way and verse directly
> interprets and sends this command out, isn't it?

no its not. if you look at the function "v_noq_send_buf" (used to give a
command to the send queue) you will find v_con_network_listen(); in it. So
any send command can cause verse to listen (if only breafly). In the same
way if you look inside verse_callback_update you will find
v_noq_send_queue being called (probably repeatadly) that will send data.

this is not a bug its a feature:

If you for instance have this code:

verse_send_g_vertex_set_xyz_real32(...);

while(TRUE)
    verse_callback_update(1);

verse will not send the data until it comes to "verse_callback_update".
the verse_send_g_vertex_set_xyz_real32 is just too small to send in one
packet so it gets stored untill ither enough data has been collected to
fill a packet or a user calls "verse_callback_update". if it did send a
vertex everytime you asked it to it would be bad if you had this code:

printf("A\n");
for(i = 0; i < 100000; i++)
    verse_send_g_vertex_set_xyz_real32(...);
printf("B\n");
while(TRUE)
    verse_callback_update(1);

because now you would send out lots of packets with only one command in
each rather the fewer with many comands in each thus saving packet
overhead. We would also run in to other problems with this code, during
the vertex loop the application would have to run acording to how fast you
network connetion is, so A and B may come far apart. So if you wanted to
do this in a interactive app, you would need to break up your loop in
order for you to insert some UI code and stuff in order not to freeze your
app.

Instead during this loop verse sends as much as it can but buffers the
rest and sends it out during the verse_callback_update loop. Also during
the verse_send_g_vertex_set_xyz_real32 loop verse will listen for
incomming stuff, mainly poitive or negative agnolagements (ACK/NAK) that
the stuff beeing sent actiualy gets there. thees messages are used to
clear history buffers and to determain how fast you can send data. if
thees NAKs/ACKs arnt reseved the nerwork trafic james and runs slower and
slower. So obviusly it is important for this to run especialy in a loop
where you send lots of data.

An other feature is that if you have more then one session you only need
to update one of them to keep the others alive. as long as you call
verse_callback_update for one of them the others wont time out. Everything
sent to the other sessions will be stored in verse, so it would make sence
to empty them now and then, but theroreticaly untill the run out of memory
from buffering in comming stuff they will be just fine even if you never
call verse_callback_update to keep them alive.

E



More information about the Verse-dev mailing list