Skip to content

WIP #873 Remove Sync and added StripedLock#1710

Closed
tynyttie wants to merge 2 commits intoapache:mainfrom
tynyttie:accumulo_Ticket#873
Closed

WIP #873 Remove Sync and added StripedLock#1710
tynyttie wants to merge 2 commits intoapache:mainfrom
tynyttie:accumulo_Ticket#873

Conversation

@tynyttie
Copy link
Copy Markdown
Contributor

When tested, I did not notice any performance benefits.

Copy link
Copy Markdown
Member

@ctubbsii ctubbsii left a comment

Choose a reason for hiding this comment

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

It looks like the Guava Striped lock is marked as @Beta, which means that it is risk for us to use without potentially introducing dependency problems with different versions of Guava that users could end up having on their class path. This is less of a risk with Hadoop 3 and server-side code, but it's still something we probably want to avoid. It might not be a good idea to use Striped from Guava at this time, especially if you're not seeing performance improvements for doing so (though, it's not clear how you're testing for that).

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;

import com.google.common.util.concurrent.Striped;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like this is @Beta.

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.

Just as a note, it appears it has been in beta since 2012, v 13.0 (now v 30.0 is released). I don't expect it to leave beta anytime soon.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It doesn't seem that long ago since we were using version 11 of Guava, because that's what Hadoop was using. Guava moves fast. The beta methods can change quickly and can quickly become incompatible with other libraries that require specific versions of Guava. I still think this is unsafe.

More importantly, if there's no observable performance benefit, it's not worth the risk.

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.

I would avoid Guava striped locks because its beta. I have used this pattern w/o Guava using an array of locks like :

Copy link
Copy Markdown
Contributor

@milleruntime milleruntime Nov 9, 2020

Choose a reason for hiding this comment

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

Use of Beta can be dangerous as we have been previously burned by it. I did some work to remove uses of Beta code in Accumulo. See https://issues.apache.org/jira/browse/ACCUMULO-4702
I would listen to this important declaration:

If your code is a library itself (i.e. it is used on the CLASSPATH of users outside your own control), you should not use beta API

@ctubbsii ctubbsii linked an issue Sep 18, 2020 that may be closed by this pull request
@keith-turner
Copy link
Copy Markdown
Contributor

@tynyttie what type of test did you run? Was there concurrent bulk import operations running?

@ctubbsii
Copy link
Copy Markdown
Member

ctubbsii commented Apr 4, 2022

Closing outdated PR due to comment on original ticket: #873 (comment)

@ctubbsii ctubbsii closed this Apr 4, 2022
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.

Look into using a Striped lock for bulk load zookeeper checks.

5 participants