log4net的文件日志打印时间测试

粗略测试log4net的文件日志打印耗费的时间。

一般的PC,amd athlon xp2000+,同时还开着Visual Studio 2005 Team Suit等。
log (length=14,count=100 spent ms=62)表示打印一个长度14的字符串,打印次数100,耗费时间62ms。

一组测试如果打到一个日志文件上,文件大小没有超过5M。
第三组时间耗费很多,主要是RollingFileAppender的maximumFileSize设置太小,测试过程中频繁地创建文件造成的。
第二组比第一组多一个RollingFileAppender,时间耗费增加不到一倍。
感觉log4net性能很不错。


第一组。
ConsoleAppender,FileAppender
2006-08-05 21:45:34,453 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=14,count=100) spent ms=62
2006-08-05 21:45:34,484 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=14,count=1000) spent ms=31
2006-08-05 21:45:34,859 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=14,count=10000) spent ms=375
2006-08-05 21:45:34,859 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=34,count=100) spent ms=0
2006-08-05 21:45:34,890 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=34,count=1000) spent ms=32
2006-08-05 21:45:35,265 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=34,count=10000) spent ms=375
2006-08-05 21:45:35,265 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=129,count=100) spent ms=0
2006-08-05 21:45:35,312 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=129,count=1000) spent ms=46
2006-08-05 21:45:35,734 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=129,count=10000) spent ms=422

第二组。
ConsoleAppender,FileAppender,RollingFileAppender(<maximumFileSize value="10MB" />)
2006-08-05 21:51:58,093 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=14,count=100) spent ms=47
2006-08-05 21:51:58,156 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=14,count=1000) spent ms=62
2006-08-05 21:51:58,765 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=14,count=10000) spent ms=610
2006-08-05 21:51:58,765 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=34,count=100) spent ms=0
2006-08-05 21:51:58,828 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=34,count=1000) spent ms=62
2006-08-05 21:51:59,453 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=34,count=10000) spent ms=625
2006-08-05 21:51:59,453 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=129,count=100) spent ms=0
2006-08-05 21:51:59,531 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=129,count=1000) spent ms=78
2006-08-05 21:52:00,234 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=129,count=10000) spent ms=703

第三组。
ConsoleAppender,FileAppender ,RollingFileAppender(<maximumFi leSize value="10KB" />)
2006-08-05 21:20:03,625 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=14,count=100) spent ms=1703
2006-08-05 21:20:20,953 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=14,count=1000) spent ms=17328
2006-08-05 21:23:14,953 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=14,count=10000) spent ms=174000
2006-08-05 21:23:17,015 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=34,count=100) spent ms=2063
2006-08-05 21:23:38,437 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=34,count=1000) spent ms=21421
2006-08-05 21:27:12,046 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=34,count=10000) spent ms=213610
2006-08-05 21:27:16,500 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=129,count=100) spent ms=4453
2006-08-05 21:28:00,015 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=129,count=1000) spent ms=43516
2006-08-05 21:35:16,734 [1] ERROR Test.SimpleClass [(null)] <(null)> - log (length=129,count=10000) spent ms=436718
 
 

你可能感兴趣的:(XP,测试,null,log4net)