logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: Fwd: svn commit: r1595497 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
Date Sat, 17 May 2014 21:34:24 GMT
It would if we had a clear distinction between these kinds of tests which I do not think we
have. I do not want to loose the little stress testing we have out of the default build. I
can see adding more tests or refactoring the current set to get small scale and large scale
stress testing though... where the small scale set stays in the default build.

Gary

<div>-------- Original message --------</div><div>From: Matt Sicker <boards@gmail.com>
</div><div>Date:05/17/2014  15:44  (GMT-05:00) </div><div>To: Log4J
Developers List <log4j-dev@logging.apache.org> </div><div>Subject: Re: Fwd:
svn commit: r1595497 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
</div><div>
</div>I have a better idea regarding the performance tests. We can use JUnit categories
for perf tests and integration tests: https://github.com/junit-team/junit/wiki/Categories

Then we can have a maven profile for running those tests (along with enabling that profile
on the build server). Good idea?


On 17 May 2014 13:12, Gary Gregory <garydgregory@gmail.com> wrote:
This is getting silly.  Why not reduce the loop to 3 then? I think the large loop is there
to test robustness.  How about a compromise?  Keep your changes but allow a command line override
to test all of log4j with more data thrown at it? Different tests could use this factor...

Gary


-------- Original message --------
From: rpopma@apache.org
Date:05/17/2014 11:28 (GMT-05:00)
To: commits@logging.apache.org
Subject: svn commit: r1595497 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java

Author: rpopma
Date: Sat May 17 15:28:29 2014
New Revision: 1595497

URL: http://svn.apache.org/r1595497
Log:
performance improvement: reduce time taken by performance test from 7.5 seconds to 2.5 seconds
(2 tests, gain=10 seconds)

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java?rev=1595497&r1=1595496&r2=1595497&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
Sat May 17 15:28:29 2014
@@ -226,20 +226,20 @@ public abstract class AbstractJdbcAppend
     }

     @Test
-    public void testPerformanceOfAppenderWith10000Events() throws Exception {
+    public void testPerformanceOfAppenderWith1000Events() throws Exception {
         this.setUp("fmLogEntry", "log4j2-" + this.databaseType + "-factory-method.xml");

         final RuntimeException exception = new RuntimeException("Hello, world!");

         final Logger logger = LogManager.getLogger(this.getClass().getName() +
-                ".testPerformanceOfAppenderWith10000Events");
+                ".testPerformanceOfAppenderWith1000Events");
         logger.info("This is a warm-up message.");

         System.out.println("Starting a performance test for JDBC Appender for " + this.databaseType
+ '.');

         long start = System.nanoTime();

-        for(int i = 0; i < 10000; i++) {
+        for(int i = 0; i < 1000; i++) {
             if (i % 25 == 0) {
                 logger.warn("This is an exception message.", exception);
             } else {
@@ -255,9 +255,9 @@ public abstract class AbstractJdbcAppend
         final ResultSet resultSet = statement.executeQuery("SELECT * FROM fmLogEntry ORDER
BY id");

         resultSet.last();
-        assertEquals("The number of records is not correct.", 10001, resultSet.getRow());
+        assertEquals("The number of records is not correct.", 1001, resultSet.getRow());

-        System.out.println("Wrote 10,000 log events in " + elapsed + " nanoseconds (" + elapsedMilli
+
+        System.out.println("Wrote 1,000 log events in " + elapsed + " nanoseconds (" + elapsedMilli
+
                 " milliseconds) for " + this.databaseType + '.');
     }
}





-- 
Matt Sicker <boards@gmail.com>
Mime
View raw message