logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dongsheng Song (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4NET-415) RemoteSyslogAppender may block for ARP resolution + Improvement Strict RFC3164
Date Thu, 09 Jan 2014 08:33:51 GMT

    [ https://issues.apache.org/jira/browse/LOG4NET-415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13866439#comment-13866439

Dongsheng Song commented on LOG4NET-415:

When I send 100k messages via log4net on a super fast machine with 1G link, use Blocking=false
only get 33k mesages:

Use BeginSend can get 50k messages:

using System;
using System.Diagnostics;
using System.Reflection;

using log4net;

class MessageLostTestViaLog4net
    private static void Main()
        log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile));
        ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        const int messageCount = 100 * 1000;

        Stopwatch hpet = Stopwatch.StartNew();
        long t1 = hpet.ElapsedTicks;

        for(int i = 1; i <= messageCount; i++)
            logger.InfoFormat("Message {0} send", i);

        long t2 = hpet.ElapsedTicks;

        Console.WriteLine("Use log4net send {0} messages, use {1:0.000} seconds, please check
messages on the server.",
            messageCount, (t2 - t1) / (double)Stopwatch.Frequency);

> RemoteSyslogAppender may block for ARP resolution + Improvement Strict RFC3164
> ------------------------------------------------------------------------------
>                 Key: LOG4NET-415
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-415
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.13
>         Environment: Any Windows environment
>            Reporter: Jose Luis Pedrosa
>              Labels: RemoteSyslogAppender
>         Attachments: LOG4NET-415.patch, MessageLostTest.cs, MessageLostTest.cs, MessageLostTestAsync.cs,
> Sending UDP packages may block for some time in specific circumstances:
> 1) Next hop in network level 3 can't be resolved by ARP.
> 2) Datagram size exceeds FastSendDatagramThreshold configured size.
> When sending packets bigger than FastSendDatagramThreshold, the OS waits until the packet
is actually sent, if the If the syslog (or the next hop to reach the syslog) is in the same
VLAN/Subnet the OS tries to resolve by ARP the Ip of the configured syslog, this may take
up to 3 seconds, slowing down the whole application, which in some cases can lead to outages
(timeouts, DB locks...).
> Also the fact that each carriage return generates the headers of the packet again, that
can lead to a significant overhead in some scenarios, for instance when loggign HTTP requests
to a remote syslog, every header will go in a different message. Also some logging may require
characters that are now skipped in patch:  https://issues.apache.org/jira/browse/LOG4NET-370
> I'm adding a patch that
> 1) Moves the use of UDPClient to Non blocking sockets, which eliminates the blocking.

> 2) Adds a configuration field to decide if you want Strict RFC Behaviour or not (with
default Strict).
> Please your feedback, thanks in advance
> Jose Luis

This message was sent by Atlassian JIRA

View raw message