The problem with that is the message payload gets read into an allocated buffer that gets passed up into the application. If you try to read more than one payload in a single read(), you end up having to copy the additional messages into their own allocated buffers (or do something along the lines of what Mateusz recommended). The memory copy is expensive.
- Doug On Fri, Apr 30, 2010 at 2:34 PM, conferno <[email protected]> wrote: > Doug. > > Then would it make sense to read() even more than message_size+36, > say, always 65536 ? > > 2010/4/30, Doug Judd <[email protected]>: > > Conferno, > > > > The socket is configured non-blocking, so in this situation it would just > > return a short read and the behavior would fall back to the current > > behavior: read() header -> read() payload. > > > > - Doug > > > > On Thu, Apr 29, 2010 at 1:49 AM, conferno <[email protected]> wrote: > > > >> Doug, > >> > >> How would it work without heavy load, say with interactive session ? > >> > >> The message would not be processed by the server until the next > >> message' header is sent by client, would it ? > >> > >> What if there is a few seconds interval between the messages ? > >> > >> > >> 2010/4/28, Doug Judd <[email protected]>: > >> One idea I've been > >> > meaning to implement is to have the comm layer read an extra 36 bytes > >> > (header size) when reading the payload so that the next header gets > read > >> > along with it. This would cut the number of read requests in half, > >> > under > >> > heavy load. > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Hypertable Development" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<hypertable-dev%[email protected]> > <hypertable-dev%[email protected]<hypertable-dev%[email protected]> > > > >> . > >> For more options, visit this group at > >> http://groups.google.com/group/hypertable-dev?hl=en. > >> > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Hypertable Development" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<hypertable-dev%[email protected]> > . > > For more options, visit this group at > > http://groups.google.com/group/hypertable-dev?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Hypertable Development" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<hypertable-dev%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/hypertable-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Hypertable Development" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hypertable-dev?hl=en.
