Socket 'recv' being slow

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

Here's the situation:

There's a server, implemented in Java, that I must create a C++ client for.
Actually, it's just the API that needs to be done, to enable customers to
create their own client in C++. There's already such API implemented in Java
and C#.

Actually, the C++ API already exists too, but we found a bug when we started
to test for heavy charge. Basically, the C++ API, which connects to the
server through Winsock, is about 5 times slower than the C# or Java ones.

After a bit of investigating I found that calls to the 'recv' function
takes between 100 milliseconds and 250 milliseconds. In comparison, the Java
API equivalent socket call takes less than 30 milliseconds, often less than
one millisecond.

I can tell you that the exact same algorithms are used in C++, C# and Java.
The 'recv' is also called the exact same amount of times. Also, the 'send'
call is just as fast in C++.

Because I am not an experienced Winsock programmer, I thought maybe
something was wrong with my implementation, so I tried to use the Boost
library, which has socket implementation. It did not change a thing, it's
still slow to read on the socket.

Another information that can be useful is that this problem only exists when
connecting to a remove server. If the server is local, it has the same speed
than the Java and C# implementations, maybe even faster.

Finally, we also have a SOAP implementation of the client API. This one is
also faster than the C++ socket API. If you use the SOAP API locally though,
it becomes slower.

I hope my problem is a simple one. Basically, I would guess that it has
something to do with socket options or something like that. By the way, we're
using TCP/IP.

Also, the code has to be Linux compatible. It has been tested on Linux
machine and it's just as slow as on a Windows machine.

Thanks,
chuby.qc
.



Relevant Pages

  • Re: simple web programming options
    ... And that I have seen from CGI/FCGI, Java ... PHP seems to provide the best API of ready-to-use ... doing CGIs specifically and scripted access to databases. ... I recommend PHP highest for language. ...
    (comp.programming)
  • Non destructive read of socket
    ... Is it possible to do a non-destructive read on a socket in Java? ... MSG_PEEK flag. ... I am implementing an API in Java which needs to send a "are you alive" ...
    (comp.lang.java.programmer)
  • Re: Shortage of qualified Java programmers
    ... library of Java is what you have computers for -- not people. ... every detail of the API. ... to figure out how a Comparator works given the Javadocs. ... programmers written by Bill Venners. ...
    (comp.lang.java.programmer)
  • Re: Shortage of qualified Java programmers
    ... candidates are very hard to come by in the Atlanta area. ... that a candidate will list every Java technology in the world on his ... API test.) ... questions might be too easy for programmers with 3+ years Java experience. ...
    (comp.lang.java.programmer)
  • Krb5 native and JGSS messages
    ... authenticate to the server with Kerberos. ... Java is to use the org.ietf.jgss API. ... ones used by the native MIT API? ...
    (comp.protocols.kerberos)