#78 Eliminate non necessary syscalls when streaming data


For every DSI read transaction afpd issues a sequence of syscalls that goes roughly like this:

  • fstat()
  • gettimeofday()
  • sendfile() or send()
  • time()

Ideally we would remove all but sendfile()/send(). The fstat() checks the fork 's size before issuing the sendfile, gettimeofday() is used in readt() which is used in the DSI receive code.
Further investigation showed that time() is used in the FCE code when checking for pending events, regardless wheterh FCE listeners are configured.


  • Ralph Böhme

    Ralph Böhme - 2013-04-18

    Implemenented in [3e3b84] .. [2d4c0b].

    Last edit: Ralph Böhme 2013-04-18
  • Ralph Böhme

    Ralph Böhme - 2013-04-18
    • status: open --> closed
    • Group: -->
  • Ralph Böhme

    Ralph Böhme - 2013-04-23

    Unfortunately the fstat() had to be put back. It still doesn't solve the fundamental non-solvable problem that between fstat() and sendfile() the file size may have changed in which case we will have sent a DSI header indicating a payload size taken from fstat() but we have less actual data as payload. It really sucks and is not solvable for sendfile() because we send the DSI header before the data.
    At least putting the fstat() back makes it happen sort of less frequently.


Log in to post a comment.