[ 
https://issues.apache.org/jira/browse/CAMEL-25882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18143658#comment-18143658
 ] 

Aurélien Pupier commented on CAMEL-25882:
-----------------------------------------

h3. Analysis

I measured a full {{mvn verify -Pit -pl components/camel-cassandraql}} run (80 
tests, one Cassandra container per test class). Of the ~280s of test-class 
time, only ~189s is the tests themselves; the remaining ~90s is setup/teardown.

||Cause||Cost||Evidence||
|Cassandra driver Netty graceful shutdown quiet period on every 
{{CqlSession.close()}} (default {{advanced.netty.io-group.shutdown.quiet-period 
= 2}} and same for {{admin-group}})|~2.0s per test (~160s total over 80 
tests)|Every trivial test took 2.0-2.1s; timing 
{{BaseCassandra.doPostTearDown()}} gave {{session-close ms=2005..2013}}|
|One Cassandra container started per test class ({{static @RegisterExtension}} 
in {{BaseCassandra}} using 
{{CassandraServiceFactory.createLocalService("initScript.cql")}})|~4-7s per 
class, 13 classes (~60-70s)|Container start to "Cassandra server running" is 
~8s for the first class and ~4s for the following ones|
|Session creation + {{TRUNCATE}} + {{BasicDataSet.cql}} in 
{{@BeforeEach}}|~100ms per test|Measured, negligible|

h3. Done in the first PR (https://github.com/apache/camel/pull/29704)

Test-only {{application.conf}} setting the Netty shutdown quiet period to 0. 
Module ITs go from 4:51 to 1:52 min, all 80 tests pass 
({{CassandraKeyValueRepositoryIT}} 66s -> 17s, {{CassandraComponentProducerIT}} 
32s -> 5.7s).

h3. Potential further improvements (not done)

# *Share a single Cassandra container across all test classes* (potential 
saving ~50-60s). {{CassandraServiceFactory.createSingletonService()}} already 
exists but {{BaseCassandra}} uses {{createLocalService("initScript.cql")}} 
instead. This requires applying the init script once and keeping the test 
classes isolated from each other (as {{CassandraKeyValueRepositoryIT}} already 
does with unique keys / dedicated tables), and checking the singleton container 
lifecycle with Failsafe.
# Reuse one {{CqlSession}} per test class instead of one per test (~50ms per 
test, minor).
# Tune the Cassandra container startup (e.g. 
{{-Dcassandra.skip_wait_for_gossip_to_settle=0}}, smaller heap) to shorten the 
3-7s start. Riskier, not tried.

_Note: {{CassandraKeyValueRepositoryIT.testDeleteWithExpectedValueMatching}} 
failed once in the first (unmodified) run, which looks like the flakiness 
already tracked in CAMEL-24290 / CAMEL-26486; not investigated here._

_IBM Bob 2.2.1 on behalf of Aurélien Pupier_

> Improve test time of Cassandra CQL
> ----------------------------------
>
>                 Key: CAMEL-25882
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25882
>             Project: Camel
>          Issue Type: Test
>          Components: camel-cassandraql
>    Affects Versions: 4.24.0
>            Reporter: Aurélien Pupier
>            Assignee: Aurélien Pupier
>            Priority: Minor
>
> it is taking almost [8' on 
> jenkins|https://develocity.apache.org/s/qaf4axq6qn5ss/timeline?details=bw5egmw7tor2k&page=22]
>  (but in // so not the most dramatic)



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to