Re: delay on select()
From: Andrei Voropaev (avorop_at_mail.ru)
Date: 12/31/03
- Previous message: Shuqing Wu: "Re: delay on select()"
- In reply to: David Schwartz: "Re: delay on select()"
- Next in thread: Shuqing Wu: "Re: delay on select()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Dec 2003 09:46:55 GMT
On 2003-12-31, David Schwartz <davids@webmaster.com> wrote:
>
> "Andrei Voropaev" <avorop@mail.ru> wrote in message
> news:bsrc0a$jb02$2@ID-205467.news.uni-berlin.de...
[...]
>> Better to use
>> socket options in this case. (Though I'm not sure about being portable
>> here). Anyway. On Linux man 7 tcp lists TCP_NODELAY that
>> allows immidiate sending of data in the TCP buffers, the reverse of it
>> is TCP_CORK that allows to assemble package in system buffers and then
>> send it as one.
>
>
> Instead of setting 'TCP_CORK', just write the data to an intermediate
> buffer instead of the socket. Instead of unsetting 'TCP_CORK', flush the
> buffer to the socket. It will do almost exactly the same thing and have the
> advantage of being fully portable.
Well. I don't want to argue about taste matters. Personally I don't like
to maintain intermidiate buffer, grow, shrink, release it. Then you have
to copy the same stuff twice. First to intermidiate buffer, then into
system buffers. Then Nagle algorithm is still in the play and if your
data is still too short then it won't go away immediately. Using
TCP_CORK I give up portability (which I don't need for most stuff that I
write anyway), but I gain speed a little bit. Again this is the matter
of personal preferences.
>
> Setting TCP_NODELAY won't help you. Setting this flag is promising the
> stack that you will do the coalescing so that it doesn't have to. This is
> only acceptable if you do the coalescing. Someone has to coalesce, otherwise
> you send too many small packets.
Won't help me? In SMPP protocol each PDU is not more than 300 bytes long
and the next one won't come untill the response to the first one
arrived. So small datagrams are inevitable in this case. That is why I
have to turn Nagle off using TCP_NODELAY. And it does help me. :)
I believe everything has its value, but in appropriate places :)
Andrei
- Previous message: Shuqing Wu: "Re: delay on select()"
- In reply to: David Schwartz: "Re: delay on select()"
- Next in thread: Shuqing Wu: "Re: delay on select()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|