[syslog-ng] Performance of syslog-ng for Database access (mysql)

Martin Holste mcholste at gmail.com
Tue Jan 18 15:41:15 CET 2011


Make sure that you are preparing the statement outside of the while
loop so instead of
> # Pick up the sql line from the stdinput
> while( my $line = <FILE> ) {
>
>  $sth = $dbh->prepare( $line );
>  $dbh->execute( $line );
>
> }
>

It should look like
$sth = $dbh->prepare('insert into table....');
while( my $line = <FILE> ) {
  $dbh->execute( $line );
}

That saves a lot of CPU cycles.


More information about the syslog-ng mailing list