Re: How to time speed of "write" on unix socket?
Re: How to time speed of "write" on unix socket?
- Subject: Re: How to time speed of "write" on unix socket?
- From: Larry Gerndt <email@hidden>
- Date: Sun, 25 Jan 2004 15:10:26 -0800
>
> I'm in the process of benchmarking my app's performance, and one of the
>
> areas I looked at was transmission speed (my app is a client which sends data
>
> to a host server using a unix socket). Since my socket is set for blocking,
>
> I assumed all I had to do time transmission speed was check ::UpTime before
>
> and after the socket "write" call. However, the interval I'm reading is way
>
> smaller than it could possibly be (for example, 55 uSec to write 17Kbytes).
>
> This makes me think that all my "write" is really doing is writing to the
>
> local TCP buffer, is that correct? If so, how do I measure the socket's
>
> actual transmission speed to the host? Thanks in advance.
>
Since TCP guarantees end-to-end reliability and includes built-in flow
>
control, you don't really know when a specific data segment has been sent (or
>
repeated) until you receive an acknowledgment from the other end. It might
>
make more sense to measure end-to-end performance.
>
>
Next, if you want to measure "application" versus network performance,
>
consider using the loopback address to connect to a server on the same host as
>
the client. You can either develop a stub server for the purpose of measuring
>
traffic, or use sysctl to examine your TCP connection statistics.
>
>
If you choose the stub server approach, you time-stamp when each packet
>
arrives using the SO_timestamp option. By measuring when successive packets
>
arrive and the amount of data they contain, you can get a pretty handle and
>
the effective data rate.
Thanks for the ideas. By the way, I just want to confirm that I now have
the correct understanding about what "write" does on a blocking socket: It
will only block if the local TCP output buffer is full. Otherwise, it
simply copies the data to the TCP output buffer and returns. Is that
correct?
--
Larry Gerndt
AIM Handle: SonOfTheSonOfMan
Let the truth be told though the heavens fall -- James Garrison
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.