From: Ingo A. <iar...@ya...> - 2011-12-08 09:21:51
|
Matthias! Blocking sending data over the TCP line will stall you application performance, of course. This is by principle a problem of TCP communication. Some information is missing from your mail: * what is the size of your data? small (<1k) or large (>64k)? * what is your connection type/bandwith/round trip time/MTU? * is your master producing a packet per iteration (er even many)? Depending on your specific setup, it might become clear that you just want to send more over the TCP line than what you can. Some things you could do: * use a thread to dispatch the packets blocking to the TCP line. I would, however, think that this will not help much, as it will just keep your master producing and all data will be queued in the send thread instead. You can use a simple thread for that or one of the DLV components in the IPC (if you do not plan to transform some of your data this might be overkill, though the handshake in DLV is quite thread-friendly) * collapse some/many smaller packets into a larger one on application level. Too large will not help * send non-blocking, but keep looking at the return value of VistaConnection::WaitForSendFinish() now and then. This will ensure that your connection will not be flooded (this is what you report in your mail: depending on the OS, when using async transfer and you just put in too many packets, the connection will be dropped (windows is/was especially shaky here). Note that the call to this method is blocking, so it can wait for all data to be transferred, which might not be what you want. * you could fiddle around with the VistaSocket API to set the send/receive buffer size, but if you are using modern OSes, I do not recommend that. The OS nowadays do a pretty good job here. * use more than one MsgChannel and send the packets in an application defined order over each line. Of course you will need another mechanism to ensure the order of receival on the slave side. * also, if you are sending to more than one slave, you transfer the same data more than once. A remedy could be to use some kind of reliable multicast or likely. However, without a more specific outline of your setup/needs, this is all just guessing. Hope it helps a bit, Ingo. On 12/07/2011 07:06 PM, Mat...@dl... wrote: > Hi all, > > I encountered a Problem regarding the TCP connection. > > I am using Vista 1.12.0 from the tag. > > My intention is to create a master/slave setup where the Master is > sending data to the slave via TCP. > > The Master is establishing a TCP connection using the > "VistaConnectionIP" and using a "VistaMessageChannel" with this > connection to transfer the data to the slave. > The Data is written in a "VistaPropertyList" and transfered using the > "WriteMsg (int iMethodToken, const VistaPropertyList > &rList,VistaPropertyList &rAnswer)" method. > The order to send the Data is triggered by an InteractionEvent on the > Master's input devices (60+ events/second). > > The Slave on the other hand is using the MSGPORT to enable the master to > connect to him. The messages ( VistaCommandEvent's) are parsed by a > Class the is derived from the "VistaEventHandler". > > The communication struct is based on the VistaDemo 17 (Alice, Bob). > > > The problem: > > The master is blocked by the "WriteMsg" method. Without this messaging > the master uses to have ~160 frames per second, but when the Messaging > is enabled this is reduced to 10 for 1 slave, 5 for 2 slaves and 3.3 for > 3 slaves. Therefore the Slaves also receive the reduced amount of events. > > I have already tried the following things: > > - Disable the blocking of the connection: > This has lead to the slaves getting only 5 Events and then releasing the > port, so that the connection collapsed. The master went back to ~160 > frames/second, but the slave did not receive any more messages. > > - Disabled setting the answer of the slave > Did not chance anything. > > > Have you any suggestions to avoid this performance loss? > > Thanks for your help. > > Best regards > Matthias > > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist and point of > discussion for anyone considering optimizing the pricing and packaging model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > > > > _______________________________________________ > vistavrtoolkit-general mailing list > vis...@li... > https://lists.sourceforge.net/lists/listinfo/vistavrtoolkit-general |