Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace array with list #4303

Merged
merged 1 commit into from
Apr 14, 2020
Merged

Replace array with list #4303

merged 1 commit into from
Apr 14, 2020

Conversation

Zelldon
Copy link
Member

@Zelldon Zelldon commented Apr 14, 2020

Description

Replaces inefficient usage of subscription array with an array list. Previous the subscription array was always copied and replaced by a smaller or larger array, when subscriptions where added or removed. With the usage of an array list the resizing is now a bit more efficient. For further information check #4285

Related issues

closes #4285

Pull Request Checklist

  • All commit messages match our commit message guidelines
  • The submitting code follows our code style
  • If submitting code, please run mvn clean install -DskipTests locally before committing

@Zelldon Zelldon requested a review from saig0 April 14, 2020 08:19
Copy link
Member

@saig0 saig0 left a comment

Choose a reason for hiding this comment

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

LGTM 🎈

util/src/main/java/io/zeebe/util/sched/ActorTask.java Outdated Show resolved Hide resolved
@Zelldon
Copy link
Member Author

Zelldon commented Apr 14, 2020

thansk @saig0 I just had to fix a concurrent modification exception, because some subscriptions remove them self on cancel 🤷‍♂️ :D

 Instead of using an array for the actor subscriptions and implementing
 the resizing by our self we using now a datastructure which is widely
 used for that: an ArrayList...

 On tryWait we want to verify the current subscriptions for that case we
 create a copy.

 We check the thread and make sure it is an actor thread on removing and
 adding a subscription.
@Zelldon
Copy link
Member Author

Zelldon commented Apr 14, 2020

bors r+

@Zelldon
Copy link
Member Author

Zelldon commented Apr 14, 2020

I checked with jmc again and saw no indication that to much allocations are happening outside of the TLAB, only ~2% was outside of the TLAB. Unfortunately I saw this thing not always, but I think we should have fixed this with the List.

@zeebe-bors
Copy link
Contributor

zeebe-bors bot commented Apr 14, 2020

Build succeeded

@zeebe-bors zeebe-bors bot merged commit 2f720ee into develop Apr 14, 2020
@zeebe-bors zeebe-bors bot deleted the 4285-actor-subscriptions branch April 14, 2020 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ActorScheduler ineffecient array shrink and growing behavior
4 participants