You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Todd Lipcon (Code Review)" <ge...@cloudera.org> on 2020/04/23 19:02:07 UTC

[kudu-CR] tablet: avoid locking for Tablet::state checks

Hello Andrew Wong,

I'd like you to do a code review. Please visit

    http://gerrit.cloudera.org:8080/15792

to review the following change.


Change subject: tablet: avoid locking for Tablet::state checks
......................................................................

tablet: avoid locking for Tablet::state checks

Tablet::state_ is frequently checked during the process of applying
writes (eg once per row operation). The handling of this lock was taking
~7% of the CPU on the Apply thread in a tpch_real_world test run. This
patch changes it to use an atomic instead, which should remove that CPU
bottleneck since the state rarely changes.

Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
---
M src/kudu/tablet/tablet.cc
M src/kudu/tablet/tablet.h
2 files changed, 24 insertions(+), 25 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/92/15792/1
-- 
To view, visit http://gerrit.cloudera.org:8080/15792
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
Gerrit-Change-Number: 15792
Gerrit-PatchSet: 1
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Andrew Wong <an...@cloudera.com>

[kudu-CR] tablet: avoid locking for Tablet::state checks

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/15792 )

Change subject: tablet: avoid locking for Tablet::state checks
......................................................................

tablet: avoid locking for Tablet::state checks

Tablet::state_ is frequently checked during the process of applying
writes (eg once per row operation). The handling of this lock was taking
~7% of the CPU on the Apply thread in a tpch_real_world test run. This
patch changes it to use an atomic instead, which should remove that CPU
bottleneck since the state rarely changes.

Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
Reviewed-on: http://gerrit.cloudera.org:8080/15792
Reviewed-by: Alexey Serbin <as...@cloudera.com>
Tested-by: Kudu Jenkins
---
M src/kudu/tablet/tablet.cc
M src/kudu/tablet/tablet.h
2 files changed, 24 insertions(+), 25 deletions(-)

Approvals:
  Alexey Serbin: Looks good to me, approved
  Kudu Jenkins: Verified

-- 
To view, visit http://gerrit.cloudera.org:8080/15792
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
Gerrit-Change-Number: 15792
Gerrit-PatchSet: 6
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <an...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] tablet: avoid locking for Tablet::state checks

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Alexey Serbin, Andrew Wong, Kudu Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/15792

to look at the new patch set (#2).

Change subject: tablet: avoid locking for Tablet::state checks
......................................................................

tablet: avoid locking for Tablet::state checks

Tablet::state_ is frequently checked during the process of applying
writes (eg once per row operation). The handling of this lock was taking
~7% of the CPU on the Apply thread in a tpch_real_world test run. This
patch changes it to use an atomic instead, which should remove that CPU
bottleneck since the state rarely changes.

Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
---
M src/kudu/tablet/tablet.cc
M src/kudu/tablet/tablet.h
2 files changed, 24 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/92/15792/2
-- 
To view, visit http://gerrit.cloudera.org:8080/15792
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
Gerrit-Change-Number: 15792
Gerrit-PatchSet: 2
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <an...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] tablet: avoid locking for Tablet::state checks

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/15792 )

Change subject: tablet: avoid locking for Tablet::state checks
......................................................................


Patch Set 5: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/15792
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
Gerrit-Change-Number: 15792
Gerrit-PatchSet: 5
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <an...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Wed, 27 May 2020 21:53:21 +0000
Gerrit-HasComments: No

[kudu-CR] tablet: avoid locking for Tablet::state checks

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/15792 )

Change subject: tablet: avoid locking for Tablet::state checks
......................................................................


Patch Set 2: Code-Review+2

(1 comment)

http://gerrit.cloudera.org:8080/#/c/15792/1/src/kudu/tablet/tablet.cc
File src/kudu/tablet/tablet.cc:

http://gerrit.cloudera.org:8080/#/c/15792/1/src/kudu/tablet/tablet.cc@927
PS1, Line 927: 
> I actually prefer the explicit load() call since it makes it more obvious w
SGTM



-- 
To view, visit http://gerrit.cloudera.org:8080/15792
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
Gerrit-Change-Number: 15792
Gerrit-PatchSet: 2
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <an...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Wed, 27 May 2020 17:48:07 +0000
Gerrit-HasComments: Yes

[kudu-CR] tablet: avoid locking for Tablet::state checks

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/15792 )

Change subject: tablet: avoid locking for Tablet::state checks
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/15792/1/src/kudu/tablet/tablet.cc
File src/kudu/tablet/tablet.cc:

http://gerrit.cloudera.org:8080/#/c/15792/1/src/kudu/tablet/tablet.cc@927
PS1, Line 927: .load()
nit here and below: maybe drop load() and rely on 'operator T' (https://en.cppreference.com/w/cpp/atomic/atomic/operator_T) ?



-- 
To view, visit http://gerrit.cloudera.org:8080/15792
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
Gerrit-Change-Number: 15792
Gerrit-PatchSet: 1
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <an...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Thu, 23 Apr 2020 23:54:29 +0000
Gerrit-HasComments: Yes

[kudu-CR] tablet: avoid locking for Tablet::state checks

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change. ( http://gerrit.cloudera.org:8080/15792 )

Change subject: tablet: avoid locking for Tablet::state checks
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/15792/1/src/kudu/tablet/tablet.cc
File src/kudu/tablet/tablet.cc:

http://gerrit.cloudera.org:8080/#/c/15792/1/src/kudu/tablet/tablet.cc@927
PS1, Line 927: .load()
> nit here and below: maybe drop load() and rely on 'operator T' (https://en.
I actually prefer the explicit load() call since it makes it more obvious why we're loading into a local variable instead of just using 'state_' directly.



-- 
To view, visit http://gerrit.cloudera.org:8080/15792
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If0dde4d060caa12c1831f3a19b92ecacf3861b64
Gerrit-Change-Number: 15792
Gerrit-PatchSet: 1
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <an...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Wed, 27 May 2020 16:52:42 +0000
Gerrit-HasComments: Yes