comparison of different syslog implementations

Discussion in 'Perl Misc' started by Rainer Weikusat, Jul 9, 2013.

  1. NB: This includes Sys::Syslog because 'it is part of Perl' and doesn't
    include Net::Syslog because it is - like Sys::Syslog - really an
    alternate syslog client implementation (according to its
    documentation), something I'm not really interested in because I want
    to use the C libary syslog support.

    Timing in this text come from NYTProf running through the 'startup'
    phase of a particular program (logs about ~330 messsages on the
    verbosity level where it is used 'in production').


    Sys::Syslog
    -----------

    (AFAIK) 'pure Perl' heavy-weight and feature-rich 'syslog client'
    which talks 'syslog protocol' to a syslog server reachable via 'some
    kind of socket connection'.

    The central message logging routine looks like this:

    sub msg
    {
    local $@ if $@;
    syslog('notice', @_);
    }

    It needs to localize $@ because the syslog routine uses eval (AFAIK,
    for various tests). On average, it ran for 180us per call.


    Unix::Syslog
    ------------

    'Mostly-XS' interface to the syslog routines in the C library. Message
    formatting done via sprintf-call in Perl wrapper routine. Supports %m
    in the same way as Sys::Syslog (using the same line of code,
    actually). The syslog constants are provided as hand-written XS
    functions which need to be executed whenever the value of such a
    'constant' is needed.

    The central message logging routine looks like this:

    sub msg
    {
    syslog(LOG_NOTICE, $_[0], @_[1 .. $#_]);
    }

    This way of passing arguments is necessary because the syslog-routine
    has a prototype of $$@ which implies that it can't work with an array
    of arguments encompassing both the format string and the 'data bits'.
    On average, it ran for 70us per call, about 2.57 times the speed of
    the Sys::Syslog-based routine.


    'syslog weekend project'
    ------------------------

    'Minimal' XS-only (for the working code) interface to the syslog
    routines in the C library. Message formatting is done via perlapi
    call from the XS-code. Does not support %m because the cost of doing
    so is IMHO not sensible, compared to the marginal inconvenience of
    having to use %s and "$!" as formatting argument for that. The syslog
    constants are 'real' Perl constants (no runtime calls to anything
    involved) created based on the h2xs 'constant support code' (which
    also does runtime functions calls).

    The central message logging routine looks like this

    sub msg
    {
    syslog(LOG_NOTICE, @_);
    }

    On average, it ran for 54us per call, about 3.33 times the speed of
    the Sys::Syslog routine and about 1.23 times the speed of the
    Unix::Syslog routine.
     
    Rainer Weikusat, Jul 9, 2013
    #1
    1. Advertising

  2. Rainer Weikusat, Jul 9, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Naresh Agarwal
    Replies:
    2
    Views:
    3,590
    Brad BARCLAY
    Jan 8, 2004
  2. Replies:
    2
    Views:
    6,200
    Chris Uppal
    Jun 20, 2006
  3. leroy isaac
    Replies:
    1
    Views:
    523
    James Willmore
    Oct 29, 2004
  4. Bad Dog
    Replies:
    0
    Views:
    257
    Bad Dog
    Aug 9, 2007
  5. Replies:
    1
    Views:
    100
    Randy Webb
    Sep 16, 2005
Loading...

Share This Page