Speeding up TCP

S

Sean Warburton

I have a script that opens a TCP socket and then sends an XML request
using SSL over the socket, it then receives an answer back from the
server. The whole send and receive is taking between 160 and 175
milliseconds total (not including opening the socket) but I know others
using PHP and Perl have this down to around 130 milliseconds and I
wonder if Ruby has any tricks up its sleeve that would speed thing up a
little.
 
C

Chuck Remes

I have a script that opens a TCP socket and then sends an XML request
using SSL over the socket, it then receives an answer back from the
server. The whole send and receive is taking between 160 and 175
milliseconds total (not including opening the socket) but I know others
using PHP and Perl have this down to around 130 milliseconds and I
wonder if Ruby has any tricks up its sleeve that would speed thing up a
little.

Show us your code. It's impossible to say that the performance issue is with network and not with other processing you are performing on the data from what little you've said.

Barring that, take a look at the Eventmachine library (available as a gem). It allows you to build clients and servers using non-blocking I/O.

cr
 
B

brabuhr

130ms from the same client to the same server over the same network?
Show us your code. It's impossible to say that the performance issue is with network and not with other processing you are performing on the data from what little you've said.

+1 :)
 
B

Brian Candler

Sean said:
I have a script that opens a TCP socket and then sends an XML request
using SSL over the socket, it then receives an answer back from the
server. The whole send and receive is taking between 160 and 175
milliseconds total (not including opening the socket) but I know others
using PHP and Perl have this down to around 130 milliseconds and I
wonder if Ruby has any tricks up its sleeve that would speed thing up a
little.

Show your code as others have said. Using tcpdump or wireshark, measure
exactly how much of this delay is for the far-end server processing and
responding.

If the far-end server is taking less than 100ms to respond, you could
try the TCP_NODELAY or TCP_CORK socket options on the ruby client side.
 
R

Roger Pack

Sean said:
I have a script that opens a TCP socket and then sends an XML request
using SSL over the socket, it then receives an answer back from the
server. The whole send and receive is taking between 160 and 175
milliseconds total (not including opening the socket) but I know others
using PHP and Perl have this down to around 130 milliseconds and I
wonder if Ruby has any tricks up its sleeve that would speed thing up a
little.

using eventmachine might help.
-rp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,818
Messages
2,569,727
Members
45,664
Latest member
Phil79581

Latest Threads

Top