Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

asynchronous benchmarking

Yi S. Ding
2012-06-07
2013-06-03
1 2 > >> (Page 1 of 2)
  • Yi S. Ding
    Yi S. Ding
    2012-06-07

    Hi, has anyone done any benchmarking of boost log in asynchronous mode?  I'm currently seeing it take around 5x more time than std::cout.

     
  • I did some testing but it was long time ago. Yes, async logging is the slowest one, this is expected.

     
  • Yi S. Ding
    Yi S. Ding
    2012-06-07

    OK.  I'd be interested in speeding it up if possible.  Not familiar enough with the internals of the code, but just stepping from stepping through with a debugger it looks like the main issue is the various layers of locking.

    A good asynchronous logger would be really useful for a lot of performance critical code.

     
  • I'm also interested in speeding it up. Inter-thread communication is one part of the problem. Some work has been done in this direction in v2, although no tests were run so far, so I can't tell if there's any improvement. The other part is the necessity to clone some of the attribute values when passing log records between threads. Depending on the use case, this may play bigger or smaller role in the final performance. This restriction is architectural and I don't see a way around it.

     
  • Yi S. Ding
    Yi S. Ding
    2012-06-07

    Cool.  Do you know if the trunk builds cleanly against 1.50 beta 1?  If so, I can try my benchmark on it and see if there's any improvement.

     
  • I can try my benchmark on it and see if there's any improvement.

    This would be great. Thanks in advance.

     
  • Do you know if the trunk builds cleanly against 1.50 beta 1?

    I didn't try but let me know if there are any problems.

     
  • Yi S. Ding
    Yi S. Ding
    2012-06-08

    I tried to build it, and there were two issues: 1) there were two places in async_frontend.hpp where it wouldn't compile because the .move function it was using no longer existed.  I'm building using gcc 4.4.6 and c++0x mode so I just switched those to std::move calls instead.

    2) For some reason the only library that got built was libboost_log_setup.a

     
  • Oleg
    Oleg
    2012-06-15

    Is correct that all mutable attributes are always allocated on the heap and them passed by value to the logging thread? If that's the case, would it be possible to copy attributes of simple types (timestamps, thread id's, etc) by value instead?

     
  • Yi S. Ding
    Yi S. Ding
    2012-06-26

    By the way, is there a maximum queue size in the asynchronous logger?

     
  • Only in v2, if you specify bounded queue policy.

     
  • Yi S. Ding
    Yi S. Ding
    2012-06-29

    I was able to get the trunk to build against 1.50 successfully.  There was one change I had to make (in addition to the move code above) where I had to change system::get_generic_category to system::generic_category)

    Unfortunately, it looks like boost 1.50 + trunk is about 7.5% slower than boost 1.49 + v1 for asynchronous logging.

     
  • Yi S. Ding
    Yi S. Ding
    2012-06-29

    boost 1.50 + v1 takes about the same time to run as boost 1.49 + v1, so it looks like the difference is in v1 vs. trunk.

     
  • Yi S. Ding
    Yi S. Ding
    2012-06-29

    v1 needs the generic_category change as well btw.

     
  • Thank you for the numbers. Could you also describe your environment (compiler, OS, CPU)?

     
  • Also, did you use equivalent async frontends? In v2 you would have to use unbounded frontends to mimic v1.

    Regarding the category change, looks like in 1.50 the deprecated code has been removed. I'll make the change in the code.

     
  • Yi S. Ding
    Yi S. Ding
    2012-06-30

    gcc 4.4.6 (Scientific Linux 6.2) , core i7-2600

    I'll take a look at the unbounded frontend.

     
  • Yi S. Ding
    Yi S. Ding
    2012-06-30

    It looks like by default sinks::asynchronous_sink uses a unbounded_fifo_queue.  Is there something else I should use instead?

     

  • Anonymous
    2012-07-05

    bump for 1.50 compile fixes in trunk.

     
  • Changes committed.

     
  • Mangesh Sawant
    Mangesh Sawant
    2012-08-28

    Hi , want to know how to define bounded queue policy in asynchronous logger to specify maximum queue size.
    Is there any example\documentation for same?
    Also want to know effect of defining bounded queue policy.
    If queue reaches maximum size will logger automaticaly swith from asynchronous to synchronous mode or
    it will stop writing logs.

     
  • See bounded_async_log example in SVN. There are 2 policies of queue overflow behavior: either drop excessive records or block until the backend processes some of the queued records.

     
  • Mangesh Sawant
    Mangesh Sawant
    2012-08-29

    Downloaded sources from  http://svn.boost.org/svn/boost/sandbox/logging/, but could not find _bounded_async_log _example. Please provide link for example.
    Thanks.

     
  • This library is hosted here, on SourceForge and not in the Boost Sandbox SVN.

     
  • Mangesh Sawant
    Mangesh Sawant
    2012-08-29

    Thanks for the information. It seems I have to create my own synk to use bounded_async_log, is it possibleto controll this  feature through setting file ?

     
1 2 > >> (Page 1 of 2)