Skip to content

pkg/server/debug: add /debug/pprof/fgprof endpoint #138779

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

Merged
merged 4 commits into from
Jan 10, 2025

Conversation

sean-
Copy link
Collaborator

@sean- sean- commented Jan 9, 2025

Release note (ui change): Add /debug/pprof/fgprof endpoint to
capture off-CPU stack traces. Use of this endpoint will have a
noticeable impact to performance while the endpoint is being triggered.

Epic: none

Release note (ui change): Add /debug/pprof/fgprof endpoint to capture off-CPU
stack traces.  Use of this endpoint will have a noticable impact to performance
while the endpoint is being triggered.
Epic: none
@sean- sean- self-assigned this Jan 9, 2025
@sean- sean- requested review from a team as code owners January 9, 2025 21:44
@sean- sean- requested review from angles-n-daemons and removed request for a team January 9, 2025 21:44
Copy link

blathers-crl bot commented Jan 9, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@sean-
Copy link
Collaborator Author

sean- commented Jan 9, 2025

These modules still need to be mirrored via ./dev generate bazel --mirror

@srosenberg srosenberg self-requested a review January 9, 2025 22:25
Copy link
Member

@srosenberg srosenberg left a comment

Choose a reason for hiding this comment

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

These modules still need to be mirrored via ./dev generate bazel --mirror

Done.

@sean- sean- force-pushed the pkg_server_debug_fgprof branch from ab56f38 to 1b0c53d Compare January 9, 2025 22:30
@sean- sean- force-pushed the pkg_server_debug_fgprof branch from 1b0c53d to 826acce Compare January 9, 2025 22:52
@sean-
Copy link
Collaborator Author

sean- commented Jan 9, 2025

bors r+

@craig craig bot merged commit 3ce8f44 into cockroachdb:master Jan 10, 2025
22 checks passed
@sean- sean- deleted the pkg_server_debug_fgprof branch January 10, 2025 05:12
@sean-
Copy link
Collaborator Author

sean- commented Jan 10, 2025

blathers backport release-24.3

Copy link

blathers-crl bot commented Jan 10, 2025

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 95792de to blathers/backport-release-24.3-138779: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch release-24.3 failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

craig bot pushed a commit that referenced this pull request Jan 14, 2025
137916: roachprod: reduce start-up lag r=tbg a=tbg

On my machine (which is in Europe), this brings `time roachprod --help` from `1.56s` down to to `0.06s` under the following env vars:

```
ROACHPROD_DISABLE_UPDATE_CHECK=true
ROACHPROD_DISABLED_PROVIDERS=azure
ROACHPROD_SKIP_AWSCLI_CHECK=true
```

Under these env vars, my roachprod

- no longer invokes `aws --version` on each start (python, ~400ms)
- no longer inits azure, which is >1s for me
- doesn't list the gs bucket to check for a newer roachprod binary (~800ms; doesn't exist for OSX anyway).

A better way (but one outside of my purview) for most of these would be to add caching for each of these and so to avoid the cost in the common case.

Azure is an exception, as the (wall-clock) profile below shows we're spending most of our time waiting for `GetTokenFromCLIWithParams` to return. It's not clear how to optimize this. (The AWS portion of the flamegraph is `aws --version`).

![image](https://github.com/user-attachments/assets/b4677da6-c5a5-4552-b0d5-462932f1062e)


Epic: none

138283: DEPS: upgrade grpc to v1.57.2 r=tbg a=tbg

See #136278 (comment).

`grpc` has gotten a little worse at allocations, but it's overall similarly fast, perhaps even a little faster in the smaller RPCs we care most about.

<details><summary>Benchmark results</summary>
<p>

```
$ benchdiff --old lastmerge ./pkg/rpc -b -r 'BenchmarkGRPCPing' -d 1s -c 10
old:  3ce8f44 Merge #138561 #138779 #138793
new:  3708ee5 DEPS: add resolve hints and update packages

name                                        old time/op    new time/op    delta
GRPCPing/bytes=____256/rpc=UnaryUnary-24       126µs ± 3%     124µs ± 2%  -1.59%  (p=0.035 n=9+10)
GRPCPing/bytes=___8192/rpc=StreamStream-24     126µs ± 3%     124µs ± 1%  -1.32%  (p=0.011 n=10+10)
GRPCPing/bytes=______1/rpc=UnaryUnary-24       124µs ± 4%     123µs ± 3%    ~     (p=0.315 n=10+10)
GRPCPing/bytes=______1/rpc=StreamStream-24    70.3µs ± 3%    70.8µs ± 2%    ~     (p=0.393 n=10+10)
GRPCPing/bytes=____256/rpc=StreamStream-24    74.5µs ± 3%    75.1µs ± 2%    ~     (p=0.105 n=10+10)
GRPCPing/bytes=___1024/rpc=UnaryUnary-24       123µs ± 6%     120µs ± 4%    ~     (p=0.661 n=10+9)
GRPCPing/bytes=___1024/rpc=StreamStream-24    67.4µs ± 8%    67.4µs ± 6%    ~     (p=0.720 n=10+9)
GRPCPing/bytes=___2048/rpc=UnaryUnary-24       133µs ± 5%     133µs ± 4%    ~     (p=0.986 n=10+10)
GRPCPing/bytes=___2048/rpc=StreamStream-24    73.9µs ± 1%    74.6µs ± 2%    ~     (p=0.234 n=8+8)
GRPCPing/bytes=___4096/rpc=UnaryUnary-24       150µs ± 2%     151µs ± 3%    ~     (p=0.182 n=9+10)
GRPCPing/bytes=___4096/rpc=StreamStream-24    97.4µs ±10%    95.3µs ±10%    ~     (p=0.393 n=10+10)
GRPCPing/bytes=___8192/rpc=UnaryUnary-24       175µs ± 1%     176µs ± 2%    ~     (p=0.720 n=9+10)
GRPCPing/bytes=__16384/rpc=UnaryUnary-24       252µs ± 1%     253µs ± 1%    ~     (p=0.315 n=9+10)
GRPCPing/bytes=__16384/rpc=StreamStream-24     190µs ± 1%     189µs ± 2%    ~     (p=0.497 n=9+10)
GRPCPing/bytes=__32768/rpc=UnaryUnary-24       363µs ± 1%     366µs ± 1%    ~     (p=0.079 n=10+9)
GRPCPing/bytes=__32768/rpc=StreamStream-24     305µs ± 3%     305µs ± 1%    ~     (p=0.579 n=10+10)
GRPCPing/bytes=__65536/rpc=UnaryUnary-24       512µs ± 2%     515µs ± 1%    ~     (p=0.095 n=9+10)
GRPCPing/bytes=__65536/rpc=StreamStream-24     449µs ± 1%     452µs ± 1%    ~     (p=0.059 n=9+8)
GRPCPing/bytes=_262144/rpc=UnaryUnary-24      1.48ms ± 3%    1.48ms ± 2%    ~     (p=0.739 n=10+10)
GRPCPing/bytes=_262144/rpc=StreamStream-24    1.42ms ± 1%    1.41ms ± 2%    ~     (p=0.182 n=9+10)
GRPCPing/bytes=1048576/rpc=UnaryUnary-24      5.90ms ± 2%    5.86ms ± 1%    ~     (p=0.278 n=10+9)
GRPCPing/bytes=1048576/rpc=StreamStream-24    5.81ms ± 2%    5.84ms ± 3%    ~     (p=0.631 n=10+10)

name                                        old speed      new speed      delta
GRPCPing/bytes=____256/rpc=UnaryUnary-24    4.44MB/s ± 3%  4.51MB/s ± 2%  +1.58%  (p=0.033 n=9+10)
GRPCPing/bytes=___8192/rpc=StreamStream-24   130MB/s ± 3%   132MB/s ± 1%  +1.32%  (p=0.010 n=10+10)
GRPCPing/bytes=______1/rpc=UnaryUnary-24     386kB/s ± 4%   391kB/s ± 3%    ~     (p=0.378 n=10+10)
GRPCPing/bytes=______1/rpc=StreamStream-24   682kB/s ± 3%   676kB/s ± 2%    ~     (p=0.189 n=10+9)
GRPCPing/bytes=____256/rpc=StreamStream-24  7.52MB/s ± 3%  7.46MB/s ± 2%    ~     (p=0.100 n=10+10)
GRPCPing/bytes=___1024/rpc=UnaryUnary-24    17.1MB/s ± 6%  17.4MB/s ± 4%    ~     (p=0.645 n=10+9)
GRPCPing/bytes=___1024/rpc=StreamStream-24  31.1MB/s ± 8%  31.1MB/s ± 6%    ~     (p=0.720 n=10+9)
GRPCPing/bytes=___2048/rpc=UnaryUnary-24    31.1MB/s ± 5%  31.2MB/s ± 4%    ~     (p=0.986 n=10+10)
GRPCPing/bytes=___2048/rpc=StreamStream-24  56.1MB/s ± 1%  55.6MB/s ± 2%    ~     (p=0.224 n=8+8)
GRPCPing/bytes=___4096/rpc=UnaryUnary-24    55.1MB/s ± 2%  54.6MB/s ± 3%    ~     (p=0.189 n=9+10)
GRPCPing/bytes=___4096/rpc=StreamStream-24  85.1MB/s ±11%  87.0MB/s ±11%    ~     (p=0.393 n=10+10)
GRPCPing/bytes=___8192/rpc=UnaryUnary-24    93.7MB/s ± 1%  93.5MB/s ± 2%    ~     (p=0.720 n=9+10)
GRPCPing/bytes=__16384/rpc=UnaryUnary-24     130MB/s ± 1%   130MB/s ± 1%    ~     (p=0.305 n=9+10)
GRPCPing/bytes=__16384/rpc=StreamStream-24   173MB/s ± 1%   173MB/s ± 2%    ~     (p=0.497 n=9+10)
GRPCPing/bytes=__32768/rpc=UnaryUnary-24     180MB/s ± 1%   179MB/s ± 1%    ~     (p=0.079 n=10+9)
GRPCPing/bytes=__32768/rpc=StreamStream-24   215MB/s ± 2%   215MB/s ± 1%    ~     (p=0.579 n=10+10)
GRPCPing/bytes=__65536/rpc=UnaryUnary-24     256MB/s ± 2%   255MB/s ± 1%    ~     (p=0.095 n=9+10)
GRPCPing/bytes=__65536/rpc=StreamStream-24   292MB/s ± 1%   290MB/s ± 1%    ~     (p=0.059 n=9+8)
GRPCPing/bytes=_262144/rpc=UnaryUnary-24     353MB/s ± 3%   353MB/s ± 2%    ~     (p=0.447 n=10+9)
GRPCPing/bytes=_262144/rpc=StreamStream-24   369MB/s ± 1%   371MB/s ± 2%    ~     (p=0.182 n=9+10)
GRPCPing/bytes=1048576/rpc=UnaryUnary-24     355MB/s ± 2%   358MB/s ± 1%    ~     (p=0.278 n=10+9)
GRPCPing/bytes=1048576/rpc=StreamStream-24   361MB/s ± 2%   359MB/s ± 3%    ~     (p=0.631 n=10+10)

name                                        old alloc/op   new alloc/op   delta
GRPCPing/bytes=______1/rpc=UnaryUnary-24      16.9kB ± 1%    16.9kB ± 3%    ~     (p=0.579 n=10+10)
GRPCPing/bytes=____256/rpc=UnaryUnary-24      19.8kB ± 2%    19.9kB ± 2%    ~     (p=0.755 n=10+10)
GRPCPing/bytes=____256/rpc=StreamStream-24    7.35kB ± 2%    7.43kB ± 2%    ~     (p=0.052 n=10+10)
GRPCPing/bytes=___1024/rpc=UnaryUnary-24      29.8kB ± 2%    29.8kB ± 1%    ~     (p=0.853 n=10+10)
GRPCPing/bytes=___1024/rpc=StreamStream-24    17.7kB ± 1%    17.7kB ± 1%    ~     (p=0.796 n=10+10)
GRPCPing/bytes=___2048/rpc=UnaryUnary-24      43.2kB ± 1%    43.0kB ± 1%    ~     (p=0.218 n=10+10)
GRPCPing/bytes=___2048/rpc=StreamStream-24    31.0kB ± 0%    31.1kB ± 1%    ~     (p=0.278 n=9+10)
GRPCPing/bytes=___4096/rpc=UnaryUnary-24      73.0kB ± 1%    73.2kB ± 1%    ~     (p=0.393 n=10+10)
GRPCPing/bytes=___4096/rpc=StreamStream-24    61.6kB ± 1%    61.7kB ± 0%    ~     (p=0.573 n=10+8)
GRPCPing/bytes=___8192/rpc=UnaryUnary-24       127kB ± 0%     127kB ± 1%    ~     (p=0.393 n=10+10)
GRPCPing/bytes=___8192/rpc=StreamStream-24     118kB ± 1%     118kB ± 0%    ~     (p=0.796 n=10+10)
GRPCPing/bytes=__16384/rpc=UnaryUnary-24       237kB ± 1%     237kB ± 1%    ~     (p=0.579 n=10+10)
GRPCPing/bytes=__16384/rpc=StreamStream-24     227kB ± 1%     227kB ± 1%    ~     (p=0.481 n=10+10)
GRPCPing/bytes=__32768/rpc=UnaryUnary-24       500kB ± 1%     500kB ± 1%    ~     (p=0.912 n=10+10)
GRPCPing/bytes=__32768/rpc=StreamStream-24     492kB ± 0%     492kB ± 0%    ~     (p=0.968 n=9+10)
GRPCPing/bytes=__65536/rpc=UnaryUnary-24       873kB ± 0%     872kB ± 0%    ~     (p=0.780 n=9+10)
GRPCPing/bytes=__65536/rpc=StreamStream-24     868kB ± 0%     868kB ± 0%    ~     (p=1.000 n=9+9)
GRPCPing/bytes=_262144/rpc=UnaryUnary-24      3.50MB ± 0%    3.51MB ± 0%    ~     (p=0.436 n=10+10)
GRPCPing/bytes=_262144/rpc=StreamStream-24    3.49MB ± 0%    3.50MB ± 0%    ~     (p=0.436 n=10+10)
GRPCPing/bytes=1048576/rpc=UnaryUnary-24      13.5MB ± 0%    13.5MB ± 0%    ~     (p=0.515 n=8+10)
GRPCPing/bytes=1048576/rpc=StreamStream-24    13.5MB ± 0%    13.5MB ± 0%    ~     (p=0.549 n=10+9)
GRPCPing/bytes=______1/rpc=StreamStream-24    4.08kB ± 3%    4.18kB ± 3%  +2.28%  (p=0.008 n=9+10)

name                                        old allocs/op  new allocs/op  delta
GRPCPing/bytes=_262144/rpc=UnaryUnary-24         282 ± 4%       286 ± 4%    ~     (p=0.223 n=10+10)
GRPCPing/bytes=_262144/rpc=StreamStream-24       147 ± 3%       149 ± 3%    ~     (p=0.053 n=9+8)
GRPCPing/bytes=1048576/rpc=UnaryUnary-24         510 ± 2%       513 ± 3%    ~     (p=0.656 n=8+9)
GRPCPing/bytes=1048576/rpc=StreamStream-24       370 ± 6%       377 ± 3%    ~     (p=0.168 n=9+9)
GRPCPing/bytes=____256/rpc=UnaryUnary-24         183 ± 0%       184 ± 0%  +0.71%  (p=0.000 n=8+10)
GRPCPing/bytes=______1/rpc=UnaryUnary-24         183 ± 0%       184 ± 0%  +0.77%  (p=0.000 n=10+8)
GRPCPing/bytes=__32768/rpc=UnaryUnary-24         211 ± 0%       213 ± 0%  +0.95%  (p=0.000 n=10+10)
GRPCPing/bytes=__16384/rpc=UnaryUnary-24         195 ± 0%       197 ± 0%  +1.03%  (p=0.000 n=10+10)
GRPCPing/bytes=___8192/rpc=UnaryUnary-24         184 ± 0%       186 ± 0%  +1.09%  (p=0.000 n=10+10)
GRPCPing/bytes=___2048/rpc=UnaryUnary-24         183 ± 0%       185 ± 0%  +1.09%  (p=0.000 n=10+10)
GRPCPing/bytes=___4096/rpc=UnaryUnary-24         183 ± 0%       185 ± 0%  +1.09%  (p=0.000 n=10+10)
GRPCPing/bytes=___1024/rpc=UnaryUnary-24         182 ± 0%       184 ± 0%  +1.10%  (p=0.000 n=10+10)
GRPCPing/bytes=__65536/rpc=UnaryUnary-24         219 ± 0%       221 ± 0%  +1.10%  (p=0.000 n=10+8)
GRPCPing/bytes=__32768/rpc=StreamStream-24      75.0 ± 0%      77.0 ± 0%  +2.67%  (p=0.000 n=10+10)
GRPCPing/bytes=__65536/rpc=StreamStream-24      83.0 ± 0%      85.3 ± 1%  +2.77%  (p=0.000 n=9+10)
GRPCPing/bytes=__16384/rpc=StreamStream-24      57.0 ± 0%      59.0 ± 0%  +3.51%  (p=0.000 n=10+10)
GRPCPing/bytes=___8192/rpc=StreamStream-24      51.0 ± 0%      53.0 ± 0%  +3.92%  (p=0.000 n=10+10)
GRPCPing/bytes=___4096/rpc=StreamStream-24      49.0 ± 0%      51.0 ± 0%  +4.08%  (p=0.000 n=10+10)
GRPCPing/bytes=___2048/rpc=StreamStream-24      48.0 ± 0%      50.0 ± 0%  +4.17%  (p=0.000 n=10+10)
GRPCPing/bytes=______1/rpc=StreamStream-24      47.0 ± 0%      49.0 ± 0%  +4.26%  (p=0.000 n=10+10)
GRPCPing/bytes=____256/rpc=StreamStream-24      47.0 ± 0%      49.0 ± 0%  +4.26%  (p=0.000 n=10+10)
GRPCPing/bytes=___1024/rpc=StreamStream-24      47.0 ± 0%      49.0 ± 0%  +4.26%  (p=0.000 n=10+10)

```

</p>
</details> 

Epic: None
Release note: None


138939: changefeedccl/kvfeed: pass consumer id correctly r=andyyang890,stevendanna a=wenyihu6

Previously, we introduced the concept of a consumer ID to prevent a single
changefeed job from over-consuming the catch-up scan quota and blocking other
consumers from making progress on the server side. However, the changefeed
client-side code requires the consumer ID to be passed again in the rangefeed
options during rangefeedFactory.Run. This was missing in the previous
PR, causing the changefeed job ID to default to zero. This patch fixes
the issue by ensuring the consumer ID is correctly passed in the
rangefeed options.

Related: #133789
Release note: none
Epic: none

Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
Co-authored-by: Wenyi Hu <wenyi@cockroachlabs.com>
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.

3 participants