Commit Graph

44 Commits

Author SHA1 Message Date
Nicolas Pelletier
b75e3660f4 Speed up file logging for high rate of logging.
During an evaluation of multiple loggers, I saw a slow down when trying to
quickly log more than 100,000 messages to a file:
```javascript
    counter = 150000;
    while (counter) {
        logger.info('Message[' + counter + ']');
        counter -= 1;
    }
```

My detailed test can be found here:
 - https://gist.github.com/NicolasPelletier/4773843

The test demonstrate that writing 150,000 lines straight in a FileStream
takes about 22 seconds until the file content stabilizes. When calling
logger.debug() 150,000 times, the file stabilizes to its final content
after 229s ( almost 4 minutes ! ).

After investigation, it turns out that the problem is using an Array() to
accumulate the data. Pushing the data in the Array with Array.push() is
quick, but the code flushing the buffer uses Array.shift(), which forces
re-indexing of all 149,999 elements remaining in the Array. This is
exponentially slower as the buffer grows.

The solution is to use something else than an Array to accumulate the
messages. The fix was made using a package called Dequeue
( https://github.com/lleo/node-dequeue ). By replacing the Array with
a Dequeue object, it brought the logging of 150,000 messages back down to
31s. Seven times faster than the previous 229s.

There is a caveat that each log event is slightly longer due to the need
to create an object to put in the double-ended queue inside the Dequeue
object. According to a quick test, it takes about 4% more time per call
to logger.debug().
2013-02-13 09:35:02 -05:00
Gareth Jones
3e1a27e522 New version, with colours in pattern layout 2012-12-03 09:59:36 +11:00
Gareth Jones
a9307fd6da fix for issue #100, multiprocess appender and logLevelFilter don't play nicely 2012-11-09 16:02:16 +11:00
Gareth Jones
4739c65c68 Version 0.5.4 2012-10-16 11:54:21 +11:00
Gareth Jones
2bfad6362a Version 0.5.3 2012-09-26 09:49:58 +10:00
Gareth Jones
012b0d5ed7 version 0.5.2 2012-08-14 10:47:25 +10:00
Gareth Jones
40ba24a55d Renamed tests so that vows will pick them up automatically 2012-07-31 14:52:36 +10:00
Gareth Jones
e3a20a1746 bumped npm version 2012-07-04 09:28:56 +10:00
Gareth Jones
ad7e844d68 bumped npm version 2012-06-01 18:13:00 +10:00
Gareth Jones
05d5265554 updated hook.io version, was breaking travis build 2012-05-29 16:59:26 +10:00
Gareth Jones
9a29d6222e changed minimum node version to 0.6 2012-05-29 16:52:50 +10:00
Gareth Jones
38a89dcf3d manually merged TooTallNate's pull request #62 2012-05-29 16:49:12 +10:00
Gareth Jones
c8157cef5c fixed file appender tests 2012-03-22 09:34:41 +11:00
Gareth Jones
cff6928761 bumped npm version 2012-03-20 09:39:56 +11:00
Gareth Jones
d276bbc2f8 Bumped version number, added travis status to readme 2012-02-22 14:37:45 +11:00
Arif Amirani
449893fd24 Added missing dependency on compress-buffer 2012-01-11 16:13:42 +05:30
Gareth Jones
78de73a274 Working version of fully-async log rolling file appender - tests need fixing though 2011-12-19 16:58:21 +11:00
Gareth Jones
e5d0b3348f bumped version 2011-11-24 08:40:12 +11:00
Gareth Jones
a3a0c55322 version 0.4.0 2011-11-21 16:17:46 +11:00
Gareth Jones
154c0dc299 changed web->url in bugs (issue #41) 2011-11-16 08:21:44 +11:00
Danny Brain
a95117c0d3 Add tests for multiprocess file appender 2011-11-03 09:10:02 +11:00
Danny Brain
23a2758a6d Lazy load any new style appenders 2011-10-27 16:25:38 +11:00
Danny Brain
3b77a42706 Added a hookio appender, this allows you to run a 'master' log4js instance and 'worker' so only one process writes to file 2011-10-27 12:38:13 +11:00
Cliffano Subagio
b78fd77015 Add sandboxed-module to dev dependencies. 2011-09-15 11:03:54 +10:00
Gareth Jones
12e71bda4e fixed to work with node 0.5.x 2011-09-15 08:13:04 +10:00
Gareth Jones
53a481d4da Added filtering to appender loader - was choking on .svn files 2011-08-11 16:27:37 +10:00
Gareth Jones
8d7b5513fb bumped version number 2011-07-27 21:22:13 +10:00
Gareth Jones
4f7d73bc97 bumped version number 2011-07-27 10:37:30 +10:00
Gareth Jones
b72182c0cf bumped version number 2011-07-26 09:10:02 +10:00
Gareth Jones
ec21ec63f0 bumped version number 2011-07-21 20:44:04 +10:00
Gareth Jones
925c280c68 check for existence of destroySoon (does not exist in node v0.2.x) 2011-07-21 19:09:22 +10:00
Gareth Jones
aac8ca0eb0 updated npm version number 2011-07-19 09:44:47 +10:00
Gareth Jones
800f0d6bf6 updated npm version number 2011-07-18 09:17:36 +10:00
csausdev
d9bfc5db44 Added devDependencies for npm 2011-04-17 17:29:22 +10:00
Daniel Bell
59f7e0af3c Added connect/express logger. 2011-04-07 10:19:18 +10:00
csausdev
f21fa2bcf8 changed array detection (thanks fkei) 2011-03-04 19:52:48 +11:00
csausdev
079edd19c8 bumped version, added configure(object) to README 2011-01-16 13:24:07 +11:00
csausdev
612d9eeb23 small tweak to exception handling 2010-12-11 21:59:50 +11:00
csausdev
c2f9ccce73 enhanced console.log 2010-12-08 08:53:59 +11:00
csausdev
7d4fdce28f updated npm details 2010-12-06 20:42:14 +11:00
csausdev
c52af1b997 refactoring to allow dependency injection 2010-12-04 20:49:39 +11:00
Gareth Jones
5ffc00c9de appenders can be added to multiple categories at the same time 2010-10-07 15:15:23 +11:00
csausdev
8951600acd updated to work with npm 2010-08-10 21:56:10 +10:00
csausdev
a95c015633 First commit. 2010-01-17 12:08:28 +11:00