Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!wellfleet.com!pprindev From: pprindev@wellfleet.com (Philip Prindeville) Newsgroups: comp.protocols.tcp-ip Subject: Re: Nagle algo. in Unix-TCP Message-ID: <8909162241.AA03169@tien.Wellfleet.Com> Date: 16 Sep 89 22:41:35 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 35 > On our own we found that the difficulty was avoided by using the "sendmsg" ca! > to send the two buffers in one call rather than using two "send" calls, one > for each buffer. Later, one correspondent suggested the same. You could also use writev() for doing scatter/gather writes. > _might_ fare better than more. The typical applications programmer has likely > never heard of packets; to him the choice of one "sendmsg" vs. many "sends" > is mainly one of programming convenience, which might well come down in > favor of the latter. In fact, in our case the multiple "send" approach > yields the shortest, cleanest program. Perhaps. But he has heard of "transactions". If one were to assume that one transaction => one write, then The Correct Thing would be done by the operating system. (I believe that UNIX just gathers all the iov descriptors together into an MBUF chain, thus avoiding the dreaded copy.) If this were a disk-based application, you would want transactions to occur atomically, and hence would use writev()s. This way, if the program were interrupted or the system crashed, you would have the best chances of the operation completing. (As opposed to taking a signal between the first and second write.) So "packets" are not conceptually different from "records". > My own suspicion is that there is no clear model, because in general I find > that such is characteristic of Unix. I was raised as a physicist and therefo! > always carry the hope that the rule of parsimony will apply; Learn a few > universal rules, and derive all else from them. I am almost prepared to Unix is based on such a philosophy -- consistency is its watchword [kiss]. Perhaps you were weaned on a more "sophisticated" system, and hence have certain expectations... -Philip