OK, here are some figures. I have been trying to get the performance measurement code out of my employers testing framework. Now I am using 2 Linux/x86 machines with JDK1.4.0, The figures are quite amazing, so I am suspecting something is wrong. First run is using the original 1.2beta4, next my patched version: Clientside:
ole@sniper:~/down> java -cp tmp/jakarta-log4j-1.2beta4/dist/lib/log4j-1.2beta4.jar:$CLASSPATH -Dlog4j.configuration=log.xml LogTest Benchmark no 1 running... msec: 36423 Logs/sec: 411.8551464733822 Benchmark no 2 running... msec: 34961 Logs/sec: 429.0781156145419 Benchmark no 3 running... msec: 34919 Logs/sec: 429.5942037286291 Benchmark no 4 running... msec: 34969 Logs/sec: 428.9799536732535 Benchmark no 5 running... msec: 34929 Logs/sec: 429.47121303215096 Benchmark no 6 running... msec: 34957 Logs/sec: 429.12721343364706 Finishing beating.. ole@sniper:~/down> java -Dlog4j.configuration=log.xml LogTest Benchmark no 1 running... msec: 5827 Logs/sec: 2574.3950574909904 Benchmark no 2 running... msec: 5259 Logs/sec: 2852.4434303099447 Benchmark no 3 running... msec: 4905 Logs/sec: 3058.3078491335373 Benchmark no 4 running... msec: 5383 Logs/sec: 2786.736020806242 Benchmark no 5 running... msec: 4791 Logs/sec: 3131.079106658318 Benchmark no 6 running... msec: 5198 Logs/sec: 2885.9176606387073 Finishing beating.. ole@sniper:~/down> Serverside: java -cp log4j-org.jar org.apache.log4j.net.SocketServer 5000 ./socketServer.lcf . and java -cp log4j-1.2beta4.jar org.apache.log4j.net.SocketServer 5000 ./socketServer.lcf . This is about 6 times faster, formerly I was using a Sun as server which might make some difference. The test repeats a few times to let hotspot do some work. LogTest.java and the configuration files are attached. The machines are running Linux 2.4.19 and are 700/733 MHz They are connected via a 100 Mbit switched network. When both client and server are on the same machine I get a similar ratio. Approx. 1600 with Externalizable and 360 with Serializable. BR Ole Dalgaard On tir, 2002-03-26 at 22:47, Ceki Gülcü wrote: Can you please supply more details about your performance tests? How fast are the machines? How are they connected? What happens when the client and server are on the same machine? Can you provide actual figures? Thank you. Ceki
import org.apache.log4j.*; import org.apache.log4j.net.*; public class LogTest { public static void main(String[] args) throws Exception { class LogTester extends Thread { private Logger logger = null; private Class[] classes = null; public LogTester(Class[] classes) { super(); this.classes = classes; } public void run() { NullPointerException npe = new NullPointerException("Test"); for(int i = 0; i < 1000; i++) { for(int j = 0; j < classes.length; j++) { logger = Logger.getLogger(classes[j]); logger.fatal("fatal=[" + i + "]"); logger.error("error=[" + i + "]"); logger.debug("debug=[" + i + "]"); logger.info("info=[" + i + "]"); logger.warn("warn=[" + i + "]"); } } logger.error("error=[TEST]", npe); } } Class[] classes = new Class[] { java.lang.System.class, javax.swing.JLabel.class, org.apache.log4j.LogManager.class }; LogTester log = null; for(int o=1; o<7; o++) { System.out.println("\nBenchmark no "+o+" running..."); long timer = System.currentTimeMillis(); for(int i = 0; i < 3; i++) { log = new LogTester(classes); log.start(); } try { log.join(); } catch(InterruptedException ie) { // ignore } long timer2 = System.currentTimeMillis(); System.out.println("msec: "+(timer2-timer)); System.out.println("Logs/sec: "+(15001*1000.0)/(timer2-timer)); } System.out.println("Finishing beating.."); } }
# ------------------------------------------------------------------- # This config file is intended to be used by a SocketServer that logs # events received from various clients on the console. # ------------------------------------------------------------------- log4j.rootCategory=DEBUG, A1 log4j.category.org.apache.log4j.net=DEBUG log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender log4j.appender.A1.file=logfile.log log4j.appender.A1.datePattern='.'yyyy-MM-dd log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{3} %x - %m%n
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="A1" class="org.apache.log4j.net.SocketAppender"> <param name="RemoteHost" value="sniper"/> <param name="Port" value="5000"/> <param name="LocationInfo" value="false"/> </appender> <category name="java.lang"> <priority value="DEBUG"/> </category> <category name="javax"> <priority value="DEBUG"/> </category> <category name="org.apache"> <priority value="DEBUG"/> </category> <root> <priority value="debug"/> <appender-ref ref="A1"/> </root> </log4j:configuration>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>