<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sorry I should have mentioned that I'm using 2.0.5.&nbsp; Thanks for the
pointers so far.&nbsp; Unfortunately, in the intended application cpu is at
a premium so I may not be able to tune my way out of this.&nbsp; In a
standalone log collector this would be more than adequate performance
(in case anyone thought I was being overly critical :) )<br>
<br>
However, I have found a couple of things that helped.&nbsp; I wasn't paying
attention to the compiler output the first time and didn't realize that
I had built a debug binary.&nbsp;&nbsp; Changing that was worth a few % in cpu
use.<br>
<br>
Second, enabling flow-control helped considerably.&nbsp; At this point I am
able to handle about 8000 messages per second while using an average of
about 45% cpu with some periods closer to 60%.&nbsp; The tcp listener I am
using is simply netcat.&nbsp; Some output from top plus my current test
configuration:<br>
<br>
<br>
top - 16:44:26 up&nbsp; 7:48,&nbsp; 5 users,&nbsp; load average: 1.03, 1.02, 0.94<br>
Tasks: 166 total,&nbsp;&nbsp; 3 running, 163 sleeping,&nbsp;&nbsp; 0 stopped,&nbsp;&nbsp; 0 zombie<br>
Cpu0&nbsp; : 14.0%us, 18.0%sy,&nbsp; 0.0%ni, 48.5%id,&nbsp; 4.0%wa,&nbsp; 0.0%hi, 15.5%si,&nbsp;
0.0%st<br>
Cpu1&nbsp; :&nbsp; 9.0%us, 24.5%sy,&nbsp; 0.0%ni, 58.5%id,&nbsp; 0.0%wa,&nbsp; 0.5%hi,&nbsp; 7.5%si,&nbsp;
0.0%st<br>
Mem:&nbsp;&nbsp; 2074688k total,&nbsp; 2020636k used,&nbsp;&nbsp;&nbsp; 54052k free,&nbsp;&nbsp;&nbsp;&nbsp; 1584k buffers<br>
Swap:&nbsp; 4096564k total,&nbsp;&nbsp; 242692k used,&nbsp; 3853872k free,&nbsp;&nbsp; 746772k cached<br>
<br>
&nbsp; PID USER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PR&nbsp; NI&nbsp; VIRT&nbsp; RES&nbsp; SHR S %CPU %MEM&nbsp;&nbsp;&nbsp; TIME+&nbsp; COMMAND<br>
30458 root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15&nbsp;&nbsp; 0&nbsp; 8548 7460&nbsp; 804 R&nbsp;&nbsp; 46&nbsp; 0.4&nbsp; 12:09.62
./syslog-ng-2.0.5/src/syslog-ng -F -v -f ./syslog-ng.conf<br>
30462 rory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15&nbsp;&nbsp; 0&nbsp; 1688&nbsp; 608&nbsp; 512 S&nbsp;&nbsp; 14&nbsp; 0.0&nbsp;&nbsp; 3:02.96 nc -l -p
1028<br>
<br>
<br>
<br>
&nbsp;options {<br>
&nbsp;&nbsp;&nbsp; time_reopen(10);<br>
&nbsp;&nbsp;&nbsp; chain_hostnames(yes);<br>
&nbsp;&nbsp;&nbsp; keep_hostname(no);<br>
&nbsp;&nbsp;&nbsp; gc_idle_threshold(100);<br>
&nbsp;&nbsp;&nbsp; gc_busy_threshold(65535);<br>
&nbsp;&nbsp;&nbsp; use_dns(no);<br>
&nbsp;&nbsp;&nbsp; log_fetch_limit(10);<br>
&nbsp;&nbsp;&nbsp; log_iw_size(10000);<br>
&nbsp;&nbsp;&nbsp; log_fifo_size(100000);<br>
&nbsp;};<br>
<br>
&nbsp;source remote_sources {<br>
&nbsp;&nbsp;&nbsp; udp(ip(0.0.0.0) port(514));<br>
&nbsp;};<br>
<br>
&nbsp;destination event_collector {<br>
&nbsp;&nbsp;&nbsp; tcp("127.0.0.1" port(1028));<br>
&nbsp;};<br>
<br>
&nbsp;log {<br>
&nbsp;&nbsp;&nbsp; source(remote_sources);<br>
&nbsp;&nbsp;&nbsp; destination(event_collector);<br>
&nbsp;&nbsp;&nbsp; flags(flow-control);<br>
&nbsp;};<br>
<br>
<br>
Evan Rempel wrote:<br>
<blockquote cite="mid46A76A93.30309@uvic.ca" type="cite">
  <pre wrap="">You didn't mention the version of syslog-ng.

My 2.0.4 system uses a similar amount of CPU, which means that a single CPU (syslog-ng is single threaded) can only 
handle a sustained rate about 10,000 per second. A lot of that time (as much as 30%) will be the IP stack
doing packet processing. You can use a TCP/IP offload network interface card to basically eliminate this.

The remaining time will have to be addressed by tuning syslog-ng.

The authors have produced a nice section in the syslog-ng manual

<a class="moz-txt-link-freetext" href="http://www.balabit.com/dl/html/syslog-ng-admin-guide_en.html/ch07.html">http://www.balabit.com/dl/html/syslog-ng-admin-guide_en.html/ch07.html</a>

Evan.

Rory wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I'm using syslog-ng as a receiver to relay messages to local processes
and other remote syslog listeners.  I'm not currently using any local
file destinations.  The issue I'm having is that as soon as I start
receiving more than a few hundred messages per second (udp) syslog-ng
uses significant CPU resources, even on an intel core-duo.

At 1000 messages per second with an average message size &lt; 300 bytes
syslog-ng consumes 9-12% CPU.  With an event rate closer to 4000
messages per second the CPU use is 35-30%.  This seems excessive given
that I'm doing no filtering at all.  In a test configuration, I am only
receiving (no log{} clauses at all) and this behaviour is still
demonstrated.  It seems that all the CPU use is related to incoming
packet processing.  The test system is Linux 2.6.20 (Ubuntu) running on
a Core2 dual 2.16GHz.

Once I have completed some profiling I will share the findings but in
the meantime: am I missing something that should be obvious?  Some
searching through the mailing list archives hasn't helped me much.  My
test configuration file:

options {
    time_reopen(10);
    chain_hostnames(yes);
    keep_hostname(no);
    log_fifo_size(65535);
    gc_idle_threshold(100);
    gc_busy_threshold(65535);
    use_dns(no);
 };

 source remote_sources {
    udp(ip(0.0.0.0) port(514));
 };

 destination event_collector {
    tcp("127.0.0.1" port(1028));
 };

# log {
#    source(remote_sources);
#    destination(event_collector);
# };

Thanks,
Rory

_______________________________________________
syslog-ng maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a>
<a class="moz-txt-link-freetext" href="https://lists.balabit.hu/mailman/listinfo/syslog-ng">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a>
Frequently asked questions at <a class="moz-txt-link-freetext" href="http://www.campin.net/syslog-ng/faq.html">http://www.campin.net/syslog-ng/faq.html</a>

    </pre>
  </blockquote>
  <pre wrap=""><!---->

  </pre>
</blockquote>
<br>
</body>
</html>