Skip to content

KAFKA-8007: Avoid copying on fetch in InMemoryWindowStore#6335

Merged
bbejeck merged 5 commits intoapache:trunkfrom
ableegoldman:CopylessInMemoryWindowStore
Mar 6, 2019
Merged

KAFKA-8007: Avoid copying on fetch in InMemoryWindowStore#6335
bbejeck merged 5 commits intoapache:trunkfrom
ableegoldman:CopylessInMemoryWindowStore

Conversation

@ableegoldman
Copy link
Copy Markdown
Member

Rewrote the InMemoryWindowStore implementation by moving the work of a fetch to the iterator, and cleaned up the iterators as well.

Blocked by KAFKA-7918

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@ableegoldman
Copy link
Copy Markdown
Member Author

@ableegoldman
Copy link
Copy Markdown
Member Author

WIP planning to flesh out the unit tests given the increased complexity of the iterators, also looking into microbenchmarks to get a sense of the potential improvement here.

@mjsax mjsax added the streams label Feb 27, 2019
@guozhangwang
Copy link
Copy Markdown
Contributor

@ableegoldman is this ready to review now or is still WIP? If yes please feel free to edit the title to include WIP or DO NOT MERGE (you can always edit it back once ready), e.g. #3720

@ableegoldman
Copy link
Copy Markdown
Member Author

Waiting for #6328 to be merged so I can rebase for cleaner review, but yes it is ready

@ableegoldman
Copy link
Copy Markdown
Member Author

Call for review @guozhangwang @mjsax @vvcephei @bbejeck

@guozhangwang
Copy link
Copy Markdown
Contributor

@ableegoldman could you rebase the PR?

@ableegoldman ableegoldman force-pushed the CopylessInMemoryWindowStore branch from 4172c8c to 1bf13c6 Compare March 1, 2019 17:24
@ableegoldman
Copy link
Copy Markdown
Member Author

Rebased (thanks for merging #6328)

Copy link
Copy Markdown
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

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

One minor comment, otherwise LGTM!

final Windowed<Bytes> windowedK = new Windowed<>(key, new TimeWindow(startTimestamp, startTimestamp + windowSize));
return new KeyValue<>(windowedK, value);
long minLiveTime = Math.max(0L, this.observedStreamTime - this.retentionPeriod + 1);
for (final InMemoryWindowStoreIteratorWrapper it : openIterators) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice catch!

InMemoryWindowStoreIteratorWrapper(final Bytes keyFrom,
final Bytes keyTo,
final Iterator<Map.Entry<Long, ConcurrentNavigableMap<Bytes, byte[]>>> segmentIterator) {
this.allKeys = keyFrom == null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To be more strict, should this be keyFrom == null && keyTo == null? I know that today they either are both null or neither are null, but it is future-risk vulnerable if we ever change the apis to allow null values on one side.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fair point, will update

Copy link
Copy Markdown
Member

@bbejeck bbejeck left a comment

Choose a reason for hiding this comment

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

Thanks, @ableegoldman LGTM

@bbejeck
Copy link
Copy Markdown
Member

bbejeck commented Mar 1, 2019

Java 11 failed kafka.api.SaslSslAdminClientIntegrationTest.testMinimumRequestTimeouts
Java 8 failed kafka.api.SaslSslAdminClientIntegrationTest.testMinimumRequestTimeouts

retest this please

@mjsax
Copy link
Copy Markdown
Member

mjsax commented Mar 5, 2019

Test result already deleted. Java8 failed. Java11 passed.

Retest this please.

@bbejeck
Copy link
Copy Markdown
Member

bbejeck commented Mar 6, 2019

Since #6328 is merged, I'm going to merge this one now as well.

@bbejeck bbejeck merged commit 4788863 into apache:trunk Mar 6, 2019
@bbejeck
Copy link
Copy Markdown
Member

bbejeck commented Mar 6, 2019

Merged #6335 to trunk

pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
Rewrote the InMemoryWindowStore implementation by moving the work of a fetch to the iterator, and cleaned up the iterators as well.

Reviewers: Guozhang Wang <wangguoz@gmail.com>, Bill Bejeck <bbejeck@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants