Good idea to separate out performance tests. Then we can also fail if some threshold is exceeded. (Currently it just prints something to System.out. As if we would notice a problem there in the firehose of other messages...)
At the moment all this test does is insert tons of records and then check that they're all there. I actually don't see much point in doing that in the first place, and I don't think we lost anything by reducing the number of records. I'm a bit miffed by Gary's "This is getting silly" comment. The build time for the project is now down from 8 to 5.5 minutes. You're welcome, bro! On Sun, May 18, 2014 at 7:44 AM, Matt Sicker <[email protected]> wrote: > That's a good idea actually. We could make some new tests based on current > ones that do larger scale stress testing. This would be a good metric for > day to day development to see if performance is better or worse. I wonder > how hard this would be to set up with jenkins. > > > On 17 May 2014 16:34, Gary Gregory <[email protected]> wrote: > >> 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 >> >> >> -------- Original message -------- >> From: Matt Sicker >> Date:05/17/2014 15:44 (GMT-05:00) >> To: Log4J Developers List >> 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 >> >> >> 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 <[email protected]> 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: [email protected] >>> Date:05/17/2014 11:28 (GMT-05:00) >>> To: [email protected] >>> 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 <[email protected]> >> > > > > -- > Matt Sicker <[email protected]> >
