Does the Dispatcher SEND or POST TCP messages ?

Home Forums CodeSite Does the Dispatcher SEND or POST TCP messages ?

Viewing 2 reply threads
  • Author
    Posts
    • #2465
      David Rose
      Participant

        I notice that when I’m using CS via TCP rather than Window messages, the CS is much slower at processing. e.g in Windows messages mode, I can send 1000 messages and my app can be off doing something else, whilst the Live viewer is still catching up and displaying the original messages i.e it looks completely asynchronous.
        Whereas when connecting via TCP, it seems that the whole process is synchronous and message two doesn’t get sent to CS dispatcher from my app until message 1 has been displayed.
        Am I correct or is it just the TCP overhead that’s making it look that way ?

        Cheers

        David

         

      • #2466
        David Rose
        Participant

          This is very odd.

          I thought I’d do some experiments this morning by sending a 10000 messages in a controlled environment e.g

          for I := 0 to 10000 do
          codesite.send(csmYellow,’Counter’,i);

          and surprisingly, sending via TCP is actually twice as fast as sending via CopyData.

          So now I’m confused. In my production code, running without Codesite is 10x faster as running with it BUT I also get the speed improvement if I run with CodeSite but simply set the Live viewer to Block Messages.
          I wonder whether simply updating the screen on the Live viewer could be slowing down my machine, such that the main code is affected (this is testing on a low performance machine and about 40,000 messages in the live viewer) ?

        • #2481
          Ray Konopka
          Keymaster

            Hi David,
            I sincerely apologize for the delay in responding to your message. In regards to the dispatching of messages, there are multiple connections that are involved and that may be impacting your observations.

            The connection is between your application code and the CodeSite Dispatcher. Communication on this connection defaults to WM_COPYDATA, but may also be TCP.

            The next connection is between the CodeSite Dispatcher and the ultimate Destination (e.g. Live Viewer, Log File, Remote CodeSite Dispatcher).

            For the Live Viewer, in CodeSite 5, the Dispatcher always uses WM_COPYDATA to send messages to the Live Viewer.

            To send messages to a Remote Dispatcher, the local Dispatcher will of course use TCP to send those messages.

            Where it can get a little confusing is that it is possible to have your logging class send its messages directly to a remote CodeSite Dispatcher using the ConnectUsingTcp(host,port) method.

            So with all of that said, when it comes to measuring performance, it is important to define what is being measured. For example, in your test above with sending 10,000 messages, are you recording the time it takes to send those messages from your application code? Or, are you measuring the time it takes for all the messages to appear in the Live Viewer.

            One of the primary benefits of the Dispatcher is that the work of “dispatching” the messages is offloaded onto the Dispatcher and not your application.

            Ray

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.