Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2567

Csharp slow ?

    XMLWordPrintableJSON

Details

    • Question
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.9.2
    • C# - Library
    • None

    Description

      Hello,

      I have a simple csharp server/client for performance tests,
      something like this

      service {
      binary getData();
      }

      which returns a 1MB buffer.(git snapshot from a few days ago).

      A thrift call client->server takes 8ms
      according to stopWatch.Elapsed. The same client->server
      implemented from here(modified of course):

      http://www.java2s.com/Code/CSharp/Network/SimpleTcpClient.htm
      http://www.java2s.com/Code/CSharp/Network/SimpleTcpServer.htm

      takes ~1ms. (Factor 8 faster, than the thrift client/server, all localhost
      connections on windows)

      I tried to narrow it down where the actual problem is, but without
      luck so far.

      • Its not the binary stream creation during unmarshall:

      // pseudocode
      byte[] getData() {
      len=iprot.readi32()
      byte[] x=new byte[len]
      iprot.readAll(x,len);
      return x;
      }

      It looks that its in the thrift c# library classes (TSocket,etc..),
      but up to now I haven't found an explanation for the
      differences.

      Attachments

        1. ArrayAsByte.cs
          3 kB
          Martin Vogt
        2. Client.cs
          2 kB
          Martin Vogt
        3. Server.cs
          1 kB
          Martin Vogt

        Activity

          People

            jensg Jens Geyer
            mvogt1 Martin Vogt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: