[
https://issues.apache.org/jira/browse/CASSANDRA-6968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14013511#comment-14013511
]
Sylvain Lebresne commented on CASSANDRA-6968:
---------------------------------------------
I've also looked at reduce test time for the new CQL tests we've added. I've
put my result in CASSANDRA-7327, and it's somewhat orthogonal to this since the
CQL test don't load the SchemalLoader tables anyway, but there is probably a
bunch of things that can be used here nonetheless. There is details in
CASSANDRA-7327 but to sum it up:
* Gossiper.stop() has a hard-coded 2 seconds sleep that's useless for all (or
almost all) tests. In fact, most tests should probably not use Gossiper and
CASSANDRA-7327 adds new announce methods to only "announce" locally and should
allow to not even start gossiper for most tests. Those new calls also skip
flushing schema table all the time which is a pretty substantial time saver. We
should probably use those calls for all unit tests.
* There is probably a substantial amount of time to win by switching the tests
from {{forkmode="perfTest"}} to {{forkmode="once"}}. This might be not entirely
trivial though since there may be a bunch of ways in which the current unit
tests assumes that each class is executed in a fresh JVM. But it might be worth
trying to move the current {{SchemaLoader.loadSchema()}} to a static block (as
in, static for the JVM) and have the {{@AfterClass}} do a cheap {{invalidate}}
of all the ColumnFamilyStore (plus a delete of all the sstables). With that we
might be able to use {{forkmode="once"}} and get an even greater speedup
without even needing to change all the test class to only do their own schema
loading (note that doing so is probably cleaner in practice, but it's more that
it would reduce drastically the size of the patch).
> Reduce Unit Test Times Due to Schema Loading
> --------------------------------------------
>
> Key: CASSANDRA-6968
> URL: https://issues.apache.org/jira/browse/CASSANDRA-6968
> Project: Cassandra
> Issue Type: Test
> Components: Tests
> Reporter: Tyler Hobbs
> Assignee: Lyuben Todorov
> Priority: Minor
> Fix For: 2.1.1
>
>
> Unit tests which extend SchemaLoader take about 6s longer to run than the
> others, on average. We could greatly reduce the time it takes to run the
> tests by improving this.
> None of the tests require everything that SchemaLoader does. We should
> change SchemaLoader into a set of test utilities that are run as needed in
> {{\@BeforeClass}} and {{\@AfterClass}} methods. Additionally, instead of
> running a full cleanup, most tests could simply use a keyspace or column
> family with a unique name (class/method name or perhaps class/method name +
> timestamp).
--
This message was sent by Atlassian JIRA
(v6.2#6252)