Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public void setMinimumTimeoutForEmptyGroups(long minimumTimeoutForEmptyGroups) {
*/
public void setReleasePartialSequences(boolean releasePartialSequences) {
if (!this.releaseStrategySet && releasePartialSequences) {
setReleaseStrategy(new SequenceSizeReleaseStrategy());
setReleaseStrategy(new SequenceSizeReleaseStrategy(releasePartialSequences));
}
this.releasePartialSequences = releasePartialSequences;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -129,7 +129,6 @@ public void testAggPerf() throws InterruptedException, ExecutionException, Timeo
}

@Test
@Disabled("Time sensitive")
public void testAggPerfDefaultPartial() throws InterruptedException, ExecutionException, TimeoutException {
AggregatingMessageHandler handler = new AggregatingMessageHandler(new DefaultAggregatingMessageGroupProcessor());
handler.setCorrelationStrategy(message -> "foo");
Expand All @@ -152,28 +151,30 @@ public void testAggPerfDefaultPartial() throws InterruptedException, ExecutionEx
store.setMessageGroupFactory(messageGroupFactory);

handler.setMessageStore(store);
handler.setBeanFactory(mock(BeanFactory.class));
handler.afterPropertiesSet();

StopWatch stopwatch = new StopWatch();
stopwatch.start();
for (int i = 0; i < 120000; i++) {
if (i % 10000 == 0) {
for (int i = 0; i < 1200; i++) {
if (i % 100 == 0) {
stopwatch.stop();
logger.warn("Sent " + i + " in " + stopwatch.getTotalTimeSeconds() +
" (10k in " + stopwatch.lastTaskInfo().getTimeMillis() + "ms)");
" (100 in " + stopwatch.lastTaskInfo().getTimeMillis() + "ms)");
stopwatch.start();
}
handler.handleMessage(MessageBuilder.withPayload("foo")
.setSequenceSize(120000)
.setSequenceSize(1200)
.setSequenceNumber(i + 1)
.build());
}
stopwatch.stop();
logger.warn("Sent " + 120000 + " in " + stopwatch.getTotalTimeSeconds() +
logger.warn("Sent " + 1200 + " in " + stopwatch.getTotalTimeSeconds() +
" (10k in " + stopwatch.lastTaskInfo().getTimeMillis() + "ms)");

Collection<?> result = resultFuture.get(10, TimeUnit.SECONDS);
assertThat(result).isNotNull();
assertThat(result.size()).isEqualTo(120000);
assertThat(result.size()).isEqualTo(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you do a modification into a test if you don't enable it back?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I enable it, the value is equal to 1, so I change to 1 but keep it disabled. :)

I think we can also remove handler.setReleasePartialSequences(true); so it will be 12000.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think the may reason behind disabling this test is its timing.
If it is takes like 5 seconds, then it is not OK.
We may indeed remodel it for a smaller number of items to aggregate though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just nit-pick for this line:

assertThat(result).hasSize(1);

However, I worry about about the reasoning behind this test.
Looks like its idea is to demonstrate a performance improvement.
Therefore talking about partial sequence is some kind of copy/paste artifact.
And if we end up just expecting a one item in the end, then it is not about performance for the whole sequence.

So, my conclusion is just to remove that handler.setReleasePartialSequences(true); from this test and enable it back.
Looks like on my laptop this tests takes just only 2,5 seconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I run this method more than 10 times this afternoon, only 1 time very slow, morn than 1min.
cam I still mark it as Disabled, and remove handler.setReleasePartialSequences(true);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!
Let's keep it disabled, but remove the config which is not related to the logic if the test!

assertThat(stopwatch.getTotalTimeSeconds()).isLessThan(60.0); // actually < 2.0, was many minutes
}

Expand Down