← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/reduce-tftp-logging into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/reduce-tftp-logging into lp:maas.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~jtv/maas/reduce-tftp-logging/+merge/120758

In the twisted-based TFTP server, the file bootstrap.py logs a message for every datagram (yes, including ack) that is received for a session.  This was bogging down our TFTP downloads.

I discussed with Gavin, and I played with using the python logging framework underneath the twisted logging framework, so that log levels would be respected (twisted's logging framework supports log levels but does not honour them).  But that filters out the debug crud pretty much all the way at the back of a long, long chain of logging-related functions.  There's no guarantee that it'd help performance at all — Robie notes that python's logging framework can be painfully slow.

We also considered having some kind of debug flag for the tftpd logging code, but that's adding new infrastructure in somebody else's code.  Upstream would have every right to dislike whatever way we did it, and come up with a better way that would cause conflicts with our patches.

And so in the end, all there is is this silly little change.  I filed it as an upstream “issue” (github's weasel-worded euphemism for bug) to bring it to the author's attention: https://github.com/shylent/python-tx-tftp/issues/7

(You may notice that there's an identical log message elsewhere in the code, which I originally thought was producing the excess.  But a test with a large file showed the one in bootstrap.py to be the culprit.)


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/reduce-tftp-logging/+merge/120758
Your team MAAS Maintainers is requested to review the proposed merge of lp:~jtv/maas/reduce-tftp-logging into lp:maas.
=== modified file 'contrib/python-tx-tftp/tftp/bootstrap.py'
--- contrib/python-tx-tftp/tftp/bootstrap.py	2012-07-03 12:11:41 +0000
+++ contrib/python-tx-tftp/tftp/bootstrap.py	2012-08-22 13:18:39 +0000
@@ -169,7 +169,6 @@
             self.transport.write(ERRORDatagram.from_code(ERR_TID_UNKNOWN).to_wire())
             return# Does not belong to this transfer
         datagram = TFTPDatagramFactory(*split_opcode(datagram))
-        log.msg("Datagram received from %s: %s" % (addr, datagram))
         if datagram.opcode == OP_ERROR:
             return self.tftp_ERROR(datagram)
         return self._datagramReceived(datagram)


Follow ups