Definitely use syslog.  To see how much logging is costing you without changing code, you can simply route to /dev/null via syslog.  Btw, w/ local logging, you may not see it in the cpu usage - more likely in the i/o wait.  In my experience, logging to a remote syslog-ng server over udp has very little impact on the app, almost like logging to /dev/null (which in turn is like not logging at all).  <div>
<br></div><div>Are you by chance on AWS/EC2 ?  If so, please contact me to discuss possible design partnership.  <br><div><br></div><div>m</div><div><br><div><br></div><div><br><br><div class="gmail_quote">On Fri, Apr 9, 2010 at 11:57 AM, Jason J. W. Williams <span dir="ltr">&lt;<a href="mailto:jasonjwwilliams@gmail.com">jasonjwwilliams@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Paul,<br>
<br>
Is is sporadic? (the CPU burst) If so, you may be seeing the log<br>
rotation code kicking...and it&#39;s probably blocking your app too until<br>
it completes.<br>
<br>
I&#39;ve got a couple patches to fix the blocking issue:<br>
<br>
<a href="http://twistedmatrix.com/trac/ticket/4372" target="_blank">http://twistedmatrix.com/trac/ticket/4372</a><br>
<br>
The patch which eliminates old log rotation will probably get rid of<br>
your CPU problem too.<br>
<font color="#888888"><br>
-J<br>
</font><div><div></div><div class="h5"><br>
On Fri, Apr 9, 2010 at 2:35 AM, Paul Goins &lt;<a href="mailto:general@vultaire.net">general@vultaire.net</a>&gt; wrote:<br>
&gt; There may not be a clear answer to this problem, and the answer may or<br>
&gt; may not be Twisted-specific.  I&#39;m just trying to fish for ideas here.<br>
&gt;<br>
&gt; The server I&#39;m working on suffers from extremely high CPU time spent in<br>
&gt; the logging functions.  I&#39;m spending between 30 and 40% of all CPU time<br>
&gt; just in twisted.python.log.msg.<br>
&gt;<br>
&gt; Describing the environment:<br>
&gt;<br>
&gt; We use DailyLogFiles for file rotation along with the<br>
&gt; PythonLoggingObserver to allow for logLevel support.  (Of course, this<br>
&gt; gives us significant overhead from Python&#39;s complex logging<br>
&gt; architecture; maybe we should drop this...)<br>
&gt;<br>
&gt; On a 1000 request test of this server, we generate 58,274 calls to<br>
&gt; t.p.log.msg.  There&#39;s room for cleanup, but there&#39;s lots of pressure to<br>
&gt; keep many of the log calls we have for forensic purposes, so we can only<br>
&gt; cut this back so far.<br>
&gt;<br>
&gt; Anyway, does anyone have any ideas for speedups?  Any stories from<br>
&gt; experience especially?  Shots in the dark are welcome.  ;-)<br>
&gt;<br>
&gt; -<br>
&gt; Paul Goins<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Twisted-Python mailing list<br>
&gt; <a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
&gt; <a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
&gt;<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br></div></div></div>