cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-7327) Reduce new CQL test time
Date Fri, 30 May 2014 10:46:02 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-7327?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sylvain Lebresne updated CASSANDRA-7327:
----------------------------------------

    Attachment: 0004-Use-forkmode-once-for-cql-test.txt
                0003-Reduce-memtable-static-initialization-time-for-tests.txt
                0002-Don-t-flush-schema-tables-all-the-time.txt
                0001-Don-t-require-Gossiper-for-schema-changes.txt

The first simple win is to not start Gossiper, or more precisely to not stop it since {{Gossiper#stop}}
has a hard-coded 2 seconds sleep (that's 2 seconds per-test-class since we use a per-test
fork mode for junit; I'll come back to this). Note that we could just add some flag to {{Gossiper#stop}}
to skip the sleep for tests, but at least for the CQL tests, it doesn't really make sense
to start Gossiper in the first place. And the only reason we need it is because schema migration
calls {{passiveAnnounce}} that crashes if Gossiper is not started. Anyway, attaching a first
patch that adds a local path for migration that bypass anything related to schema propagation.
I think it's the more logical way to go (and it's somewhat needed for the 2nd patch) and it
allows to skip gossiper altogether.

With that, schema change still take quite a bit of time in large part due to flushing all
the schema tables on every schema change. For testing, we really don't care about that, so
the 2nd patch skip it.

One last thing that takes a non negligible amount of time is the (static) computation of {{Memtable.ROW_OVERHEAD_HEAP_SIZE}}.
Its 10000 iterations take on my box > 800 milliseconds, (again for each test class). For
tests, at least for the CQL tests, we'll live if that estimate is not perfect, so the 3rd
patch greatly reduces the number of iterations. To do so it uses a system property, but I'll
not that I'm happy to change it to something else if people don't like it, it's just convenient
and somewhat consistent with {{ring_delay}}.

With those 3 first patches, the time to run the 2 cql tests drops from 20-22 seconds to 7-8
seconds. Still a bit long to my taste, but much better.

Now, even with that, we still have a bunch of time taken by static initialization (loading
the yaml, initializing the system tables, ....). On my box this takes about 1 second. With
the current junit {{forkmode="perTest"}}, this is 1 second for every test class we have. Plus
the time it takes to start the JVM each time. But CQLTester is already pretty careful to make
sure tests don't interfere (we never reuse the same table name for instance), so using {{forkmode="once"}}
should be good enough. So attaching a 4th patch that adds a bit more post-test cleanup to
CQLTester (to be on the safe side), and use {{forkmode="once"}} for the cql-test ant target.
With that, we get back 1 seconds on the 2 current CQL test (so 6 seconds), which is not huge
for 2 tests but will obviously add up once we'll add more CQL tests.

Note: I've also pushed the four patches [here|https://github.com/pcmanus/cassandra/commits/7327].

> Reduce new CQL test time
> ------------------------
>
>                 Key: CASSANDRA-7327
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7327
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 2.1.0
>
>         Attachments: 0001-Don-t-require-Gossiper-for-schema-changes.txt, 0002-Don-t-flush-schema-tables-all-the-time.txt,
0003-Reduce-memtable-static-initialization-time-for-tests.txt, 0004-Use-forkmode-once-for-cql-test.txt
>
>
> We've introduced CQL tests in the unit test suite and in particular a new CQLTester class
meant for all those test to use. Currently, we have only 2 test classes yet those tests takes
about 20-22 seconds to run on my box. This is way too long.
> This issue is linked to CASSANDRA-6968, but here I'm only focusing on the CQL tests.
Those don't load all the schema from SchemaLoader so are not directly targeted by CASSANDRA-6968.
That said, I think most of what is done here can be backported to the rest of the unit tests
and I'll let that to CASSANDRA-6968.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message