SmartInspect 3.0: Asynchronous Logging

If you are a .NET, Java or Delphi developer, please take a look at our advanced logging tool SmartInspect.

One of my favorite new features of the upcoming SmartInspect 3.0 is support for asynchronous logging. What asynchronous logging basically does is to move the protocol/connection related operations (such as writing a packet or doing a reconnect attempt) from your application thread into a dedicated logging thread.

One thing to note is that we did not add asynchronous logging to SmartInspect with the main intent of improving the logging performance. We rather added it to reduce the possibility of blocking the application while doing an I/O operation. I/O operations are usually very expensive and can thus be a problematic part of your logging layer, especially in performance-critical applications.

Asynchronous logging can operate in one of two different modes: throttle and non-throttle. The underlying implementation of the asynchronous protocol mode uses a queue to pass packets and connect/disconnect instructions from your application thread to the logging thread. This queue is size-limited (the size can be configured with a protocol option) and the different modes specify what to do when this queue reaches its maximum size. In throttle mode, a protocol waits until there’s room in the queue to add the next packet. In non-throttle mode, a protocol doesn’t wait for the logging thread but rather discards old packets from the queue in order to not block the application.

Which mode is best-suited for your application greatly depends on your specific needs. Basically, if you need a guarantee that all packets are really logged and none is discarded, you should use the throttle mode. On the other hand, if performance is more important and loosing log packets is acceptable, you should go with the non-throttle mode.

Asynchronous logging is especially useful for logging over a network via TCP/IP. When a network problem occurs while you are logging over TCP/IP, the application usually blocks until a timeout is reached. If you are using asynchronous logging, the timeout doesn’t affect your application at all. The separate logging thread and not your application is doing the waiting for the remote machine.

This entry was posted in Delphi, Gurock Software, SmartInspect, SmartInspect 3.0. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Posted July 28, 2008 at 12:25 pm | Permalink

    SmartInspect just keeps getting slicker and slicker. I really wish I had a logging system this nice. One of the downsides of using a LAMP stack.

  2. Posted July 29, 2008 at 11:01 am | Permalink

    Thanks Starr. Who knows, one day we might support PHP and other scripting languages with SmartInspect, too. By the way, congrats to launching ChatSpring. Looks really good!

  3. Posted July 29, 2008 at 9:08 pm | Permalink

    Thanks! It’s been quite an experience. :)

Post a Comment

Your email is never published nor shared.