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

*: split up large packages to speed up builds #79357

Open
irfansharif opened this issue Apr 4, 2022 · 11 comments
Open

*: split up large packages to speed up builds #79357

irfansharif opened this issue Apr 4, 2022 · 11 comments
Labels
A-build-system C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-dev-inf X-nostale Marks an issue/pr that should be ignored by the stale bot

Comments

@irfansharif
Copy link
Contributor

irfansharif commented Apr 4, 2022

Is your feature request related to a problem? Please describe.

This is a catch-all issue to split up our largest packages (as measured by build time) to increase build parallelism. Bazel can spit out how much time is spent compiling each package, and highlights what the bottleneck packages are.

$ dev build short -- --profile=short.gz # load through chrome, browsing to chrome://tracing
$ bazel analyze-profile short.gz # textual analysis

Describe the solution you'd like

The following packages are common offendors. There are probably more.

  • pkg/sql
  • pkg/sql/parser
  • pkg/sql/colexec/colexecproj
   24.614 s    6.16%   action 'GoCompilePkg pkg/sql/colexec/colexecproj/colexecproj.a'
   ...
    9.509 s    2.38%   action 'GoCompilePkg pkg/sql/sql.a'

Related: #60547, #78237.

Jira issue: CRDB-14743

@irfansharif irfansharif added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-build-system labels Apr 4, 2022
@irfansharif
Copy link
Contributor Author

Here's a representative profile: local.gz.

Critical path (75.991 s):
       Time Percentage   Description
    3.613 s    4.75%   action 'GoCompilePkg pkg/roachpb/roachpb.a'
     894 ms    1.18%   action 'GoCompilePkg pkg/clusterversion/clusterversion.a'
     245 ms    0.32%   action 'GoCompilePkg pkg/settings/cluster/cluster.a'
    0.32 ms    0.00%   action 'GoCompilePkg pkg/security/security.a'
     652 ms    0.86%   action 'GoCompilePkg pkg/base/base.a'
     784 ms    1.03%   action 'GoCompilePkg pkg/util/admission/admission.a'
    0.64 ms    0.00%   action 'GoCompilePkg pkg/sql/sessiondatapb/sessiondatapb.a'
     749 ms    0.99%   action 'GoCompilePkg pkg/kv/kv.a'
    2.844 s    3.74%   action 'GoCompilePkg pkg/sql/sem/tree/tree.a'
    5.340 s    7.03%   action 'GoCompilePkg pkg/sql/parser/parser.a'
     888 ms    1.17%   action 'GoCompilePkg pkg/sql/catalog/descpb/descpb.a'
     985 ms    1.30%   action 'GoCompilePkg pkg/sql/catalog/catalog.a'
    1.178 s    1.55%   action 'GoCompilePkg pkg/sql/catalog/multiregion/multiregion.a'
    1.701 s    2.24%   action 'GoCompilePkg pkg/sql/catalog/typedesc/typedesc.a'
    1.445 s    1.90%   action 'GoCompilePkg pkg/sql/catalog/tabledesc/tabledesc.a'
    1.012 s    1.33%   action 'GoCompilePkg pkg/sql/catalog/systemschema/systemschema.a'
     941 ms    1.24%   action 'GoCompilePkg pkg/config/config.a'
    1.278 s    1.68%   action 'GoCompilePkg pkg/gossip/gossip.a'
    1.222 s    1.61%   action 'GoCompilePkg pkg/kv/kvclient/kvcoord/kvcoord.a'
     646 ms    0.85%   action 'GoCompilePkg pkg/kv/kvclient/rangefeed/rangefeed.a'
     723 ms    0.95%   action 'GoCompilePkg pkg/sql/catalog/lease/lease.a'
     703 ms    0.92%   action 'GoCompilePkg pkg/sql/catalog/hydratedtables/hydratedtables.a'
     667 ms    0.88%   action 'GoCompilePkg pkg/sql/catalog/descs/descs.a'
    3.190 s    4.20%   action 'GoCompilePkg pkg/sql/sem/builtins/builtins.a'
     707 ms    0.93%   action 'GoCompilePkg pkg/jobs/jobs.a'
    1.187 s    1.56%   action 'GoCompilePkg pkg/sql/row/row.a'
     778 ms    1.02%   action 'GoCompilePkg pkg/sql/execinfra/execinfra.a'
     694 ms    0.91%   action 'GoCompilePkg pkg/sql/colcontainer/colcontainer.a'
     356 ms    0.47%   action 'GoCompilePkg pkg/sql/colexec/colexecutils/colexecutils.a'
    1.686 s    2.22%   action 'GoCompilePkg pkg/sql/colexec/colexecbase/colexecbase.a'
    7.009 s    9.22%   action 'GoCompilePkg pkg/sql/colexec/colexecproj/colexecproj.a'
     428 ms    0.56%   action 'GoCompilePkg pkg/sql/colexec/colbuilder/colbuilder.a'
     473 ms    0.62%   action 'GoCompilePkg pkg/sql/colflow/colflow.a'
     384 ms    0.51%   action 'GoCompilePkg pkg/sql/distsql/distsql.a'
    5.841 s    7.69%   action 'GoCompilePkg pkg/sql/sql.a'
    1.519 s    2.00%   action 'GoCompilePkg pkg/sql/gcjob/gcjob.a'
    1.016 s    1.34%   action 'GoCompilePkg pkg/sql/importer/importer.a'
    2.301 s    3.03%   action 'GoCompilePkg pkg/server/server.a'
    1.293 s    1.70%   action 'GoCompilePkg pkg/cli/democluster/democluster.a'
    2.071 s    2.73%   action 'GoCompilePkg pkg/cli/cli.a'
     310 ms    0.41%   action 'GoCompilePkg pkg/ccl/cliccl/cliccl.a'
     145 ms    0.19%   action 'GoCompilePkg pkg/ccl/ccl.a'
     187 ms    0.25%   action 'GoCompilePkg pkg/cmd/cockroach-short/cockroach-short.a'
   15.905 s   20.93%   action 'GoLink pkg/cmd/cockroach-short/cockroach-short_/cockroach-short'
    0.04 ms    0.00%   runfiles for //pkg/cmd/cockroach-short cockroach-short

image

The periods of low build parallelism (pink graph) correspond to roachpb, parser, colexecproj, sql, server respectively.

@rickystewart
Copy link
Collaborator

The 5 packages you named match up to my experience as well, I routinely see them as bottlenecks.

craig bot pushed a commit that referenced this issue Apr 7, 2022
77337: spanconfig: limit # of tenant span configs r=irfansharif a=irfansharif

Fixes #70555. In order to limit the number of span configs a tenant's
able to install, we introduce a tenant-side spanconfig.Limiter. It
presents the following interface:

    // Limiter is used to limit the number of span configs installed by
    // secondary tenants. It considers the committed and uncommitted
    // state of a table descriptor and computes the "span" delta, each
    // unit we can apply a configuration over. It uses these deltas to
    // maintain an aggregate counter, informing the caller if exceeding
    // the configured limit.
    type Limiter interface {
      ShouldLimit(
        ctx context.Context, txn *kv.Txn,
        committed, uncommitted catalog.TableDescriptor,
      ) (bool, error)
    }

This limiter only applies to secondary tenants. The counter is
maintained in a newly introduced (tenant-only) system table, using the
following schema:

    CREATE TABLE system.span_count (
      singleton  BOOL DEFAULT TRUE,
      span_count INT NOT NULL,
      CONSTRAINT "primary" PRIMARY KEY (singleton),
      CONSTRAINT single_row CHECK (singleton),
      FAMILY "primary" (singleton, span_count)
    );

We need just two integration points for spanconfig.Limiter:
- Right above CheckTwoVersionInvariant, where we're able to hook into
  the committed and to-be-committed descriptor state before txn commit.
- In the GC job, when gc-ing table state. We decrement a table's split
  count when GC-ing the table for good.

The per-tenant span config limit used is controlled by a new tenant
read-only cluster setting: spanconfig.tenant_limit. Multi-tenant cluster
settings (#73857) provides the infrastructure for the host tenant to be
able to control this setting cluster wide, or to target a specific
tenant at a time.

We also need a migration here, to start tracking span counts for
clusters with pre-existing tenants. We introduce a migration that scans
over all table descriptors and seeds system.span_count with the right
value. Given cluster version gates disseminate asynchronously, we also
need a preliminary version to start tracking incremental changes.

It's useful to introduce the notion of debt. This will be handy if/when
we lower per-tenant limits, and also in the migration above since it's
possible for pre-existing tenants to have committed state in violation
of the prescribed limit. When in debt, schema changes that add new
splits will be rejected (dropping tables/indexes/partitions/etc. will
work just fine).

When attempting a txn that goes over the configured limit, the UX is as
follows:

    > CREATE TABLE db.t2(i INT PRIMARY KEY);
    pq: exceeded limit for number of table spans

Release note: None
Release justification: low risk, high benefit change

79462: colexecproj: break it down into two packages r=yuzefovich a=yuzefovich

**colexecproj: split up default cmp proj op file into two**

This commit splits up a single file containing two default comparison
projection operators into two files. This is done in preparation of
the following commit (which will move one of the operators to a
different package).

Release note: None

**colexecproj: extract a new package for projection ops with const**

This commit extracts a new `colexecprojconst` package out of
`colexecproj` that contains all projection operators with one
constant argument. This will allow for faster build speeds since both
packages tens of thousands lines of code.

Special care had to be taken for default comparison operator because we
need to generate two files in different packages based on a single
template. I followed the precedent of `sort_partitioner.eg.go` which had
to do the same.

Addresses: #79357.

Release note: None

Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
craig bot pushed a commit that referenced this issue Apr 8, 2022
79485: sql: clean up some dependencies r=yuzefovich a=yuzefovich

**row: move Metrics struct into rowinfra**

This allows us to break dependency of `execinfra` on `row` which speeds
up the build a bit.

Release note: None

**colexecbase: move a single struct to clean up dependencies**

This commit moves `colexecbase.BinaryOverloadHelper` into `colexecutils`
package in order to break the dependencies of `colexecproj` and
`colexecprojconst` packages on `colexecbase`. This will speed up the
build a bit.

Addresses: #79357.

Release note: None

Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
@yuzefovich
Copy link
Member

Here is an updated analysis (with #79938):

Critical path (119.937 s):
       Time Percentage   Description
    5.271 s    4.40%   action 'GoCompilePkg pkg/roachpb/roachpb.a'
    2.243 s    1.87%   action 'GoCompilePkg pkg/clusterversion/clusterversion.a'
     934 ms    0.78%   action 'GoCompilePkg pkg/settings/cluster/cluster.a'
    0.57 ms    0.00%   action 'GoCompilePkg pkg/util/mon/mon.a'
     865 ms    0.72%   action 'GoCompilePkg pkg/base/base.a'
     861 ms    0.72%   action 'GoCompilePkg pkg/util/admission/admission.a'
    0.40 ms    0.00%   action 'GoCompilePkg pkg/sql/sessiondatapb/sessiondatapb.a'
     739 ms    0.62%   action 'GoCompilePkg pkg/kv/kv.a'
    1.393 s    1.16%   action 'GoCompilePkg pkg/kv/kvserver/kvserverbase/kvserverbase.a'
    4.281 s    3.57%   action 'GoCompilePkg pkg/sql/sem/tree/tree.a'
   12.780 s   10.66%   action 'GoCompilePkg pkg/sql/parser/parser.a'
    1.347 s    1.12%   action 'GoCompilePkg pkg/sql/catalog/descpb/descpb.a'
    1.639 s    1.37%   action 'GoCompilePkg pkg/sql/catalog/catalog.a'
    1.118 s    0.93%   action 'GoCompilePkg pkg/sql/catalog/multiregion/multiregion.a'
    1.807 s    1.51%   action 'GoCompilePkg pkg/sql/catalog/typedesc/typedesc.a'
    2.529 s    2.11%   action 'GoCompilePkg pkg/sql/catalog/tabledesc/tabledesc.a'
    1.557 s    1.30%   action 'GoCompilePkg pkg/sql/catalog/systemschema/systemschema.a'
    1.494 s    1.25%   action 'GoCompilePkg pkg/config/config.a'
    2.816 s    2.35%   action 'GoCompilePkg pkg/gossip/gossip.a'
    2.653 s    2.21%   action 'GoCompilePkg pkg/kv/kvclient/kvcoord/kvcoord.a'
    1.025 s    0.85%   action 'GoCompilePkg pkg/kv/kvclient/rangefeed/rangefeed.a'
    1.726 s    1.44%   action 'GoCompilePkg pkg/sql/catalog/lease/lease.a'
    1.046 s    0.87%   action 'GoCompilePkg pkg/sql/catalog/hydratedtables/hydratedtables.a'
    1.182 s    0.99%   action 'GoCompilePkg pkg/sql/catalog/descs/descs.a'
    5.816 s    4.85%   action 'GoCompilePkg pkg/sql/sem/builtins/builtins.a'
    5.345 s    4.46%   action 'GoCompilePkg pkg/sql/opt/memo/memo.a'
    3.320 s    2.77%   action 'GoCompilePkg pkg/sql/opt/norm/norm.a'
     739 ms    0.62%   action 'GoCompilePkg pkg/sql/opt/idxconstraint/idxconstraint.a'
     487 ms    0.41%   action 'GoCompilePkg pkg/sql/opt/invertedidx/invertedidx.a'
    1.307 s    1.09%   action 'GoCompilePkg pkg/sql/opt/xform/xform.a'
     553 ms    0.46%   action 'GoCompilePkg pkg/sql/opt/optgen/exprgen/exprgen.a'
    1.557 s    1.30%   action 'GoCompilePkg pkg/sql/opt/optbuilder/optbuilder.a'
    8.242 s    6.87%   action 'GoCompilePkg pkg/sql/sql.a'
    2.610 s    2.18%   action 'GoCompilePkg pkg/sql/gcjob/gcjob.a'
    1.907 s    1.59%   action 'GoCompilePkg pkg/sql/importer/importer.a'
    3.585 s    2.99%   action 'GoCompilePkg pkg/server/server.a'
    1.933 s    1.61%   action 'GoCompilePkg pkg/testutils/testcluster/testcluster.a'
    2.730 s    2.28%   action 'GoCompilePkg pkg/ccl/backupccl/backupccl.a'
     718 ms    0.60%   action 'GoCompilePkg pkg/ccl/streamingccl/streamingest/streamingest.a'
     240 ms    0.20%   action 'GoCompilePkg pkg/ccl/ccl.a'
     226 ms    0.19%   action 'GoCompilePkg pkg/cmd/cockroach-short/cockroach-short.a'
   27.314 s   22.77%   action 'GoLink pkg/cmd/cockroach-short/cockroach-short_/cockroach-short'
    0.11 ms    0.00%   runfiles for //pkg/cmd/cockroach-short cockroach-short

Packages of the vectorized engine are no longer on the critical path (at least in this run), woohoo!

craig bot pushed a commit that referenced this issue Apr 18, 2022
79938: execinfra: extract out some packages to break dependencies r=yuzefovich a=yuzefovich

**execinfra: shrink the package down a bit**

This commit refactors `execinfra` package by extracting some things in
order to break the dependency of `colexecop` on it. Two main pieces had
to be refactored:
- `stats.go` file is now moved into `execstats` since it seems to be
a much more suitable place. This required inlining `GetTraceData`
function helper and breaking a dependency of `ShouldCollectStats` helper
on `execinfra.FlowCtx`.
- `operator.go` which defines `OpNode` interface (implemented by both
columnar operators and row-by-row processors) has been moved (and
renamed to `op_node.go`) to a new package `execopnode`.

Release note: None

**execinfra: extract Releasable interface into a separate package**

This commit extracts `execinfra.Releasable` interface into a new
`execreleasable` package in order to break the dependency of several
packages of the vectorized engine on `execinfra`. This will allow those
packages (e.g. `colexecproj`) to start being built sooner which will
shorten the build time.

Addresses: #79357.

Release note: None

Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
mgartner added a commit to mgartner/cockroach that referenced this issue Apr 28, 2022
This commit breaks the `memo` package's dependence on the `builtins`
package so that they can be compiled concurrently. Optimizer packages
are no longer on the critical path, for now.

Informs cockroachdb#79357

Release note: None
@irfansharif
Copy link
Contributor Author

Was curious so peeked into the future, running with #80745 + #80687 + #80773 + #80684 off of latest master:

Critical path (67.914 s):
       Time Percentage   Description
    3.389 s    4.99%   action 'GoCompilePkg pkg/roachpb/roachpb.a'
    1.030 s    1.52%   action 'GoCompilePkg pkg/clusterversion/clusterversion.a'
    1.195 s    1.76%   action 'GoCompilePkg pkg/settings/cluster/cluster.a'
    1.05 ms    0.00%   action 'GoCompilePkg pkg/util/mon/mon.a'
     312 ms    0.46%   action 'GoCompilePkg pkg/base/base.a'
     631 ms    0.93%   action 'GoCompilePkg pkg/util/admission/admission.a'
    6.64 ms    0.01%   action 'GoCompilePkg pkg/sql/sessiondatapb/sessiondatapb.a'
    3.357 s    4.94%   action 'GoCompilePkg pkg/sql/sem/tree/tree.a'
    5.286 s    7.78%   action 'GoCompilePkg pkg/sql/parser/parser.a'
     889 ms    1.31%   action 'GoCompilePkg pkg/sql/catalog/descpb/descpb.a'
     715 ms    1.05%   action 'GoCompilePkg pkg/sql/catalog/catalog.a'
     880 ms    1.30%   action 'GoCompilePkg pkg/sql/catalog/catalogkeys/catalogkeys.a'
    1.250 s    1.84%   action 'GoCompilePkg pkg/rpc/rpc.a'
     796 ms    1.17%   action 'GoCompilePkg pkg/rpc/nodedialer/nodedialer.a'
     521 ms    0.77%   action 'GoCompilePkg pkg/blobs/blobs.a'
     588 ms    0.87%   action 'GoCompilePkg pkg/cloud/cloud.a'
    2.507 s    3.69%   action 'GoCompilePkg pkg/jobs/jobspb/jobspb.a'
    2.876 s    4.23%   action 'GoCompilePkg pkg/sql/execinfrapb/execinfrapb.a'
     505 ms    0.74%   action 'GoCompilePkg pkg/sql/execstats/execstats.a'
     778 ms    1.15%   action 'GoCompilePkg pkg/sql/colexecop/colexecop.a'
     705 ms    1.04%   action 'GoCompilePkg pkg/sql/colexec/colexecutils/colexecutils.a'
    1.510 s    2.22%   action 'GoCompilePkg pkg/sql/colexec/colexechash/colexechash.a'
    6.462 s    9.51%   action 'GoCompilePkg pkg/sql/colexec/colexecjoin/colexecjoin.a'
    1.906 s    2.81%   action 'GoCompilePkg pkg/sql/colexec/colexec.a'
     485 ms    0.71%   action 'GoCompilePkg pkg/sql/colexec/colbuilder/colbuilder.a'
     516 ms    0.76%   action 'GoCompilePkg pkg/sql/colflow/colflow.a'
     355 ms    0.52%   action 'GoCompilePkg pkg/sql/distsql/distsql.a'
    5.812 s    8.56%   action 'GoCompilePkg pkg/sql/sql.a'
    1.127 s    1.66%   action 'GoCompilePkg pkg/sql/gcjob/gcjob.a'
     986 ms    1.45%   action 'GoCompilePkg pkg/sql/importer/importer.a'
    2.309 s    3.40%   action 'GoCompilePkg pkg/server/server.a'
    1.044 s    1.54%   action 'GoCompilePkg pkg/cli/democluster/democluster.a'
    2.055 s    3.03%   action 'GoCompilePkg pkg/cli/cli.a'
     299 ms    0.44%   action 'GoCompilePkg pkg/ccl/cliccl/cliccl.a'
     146 ms    0.21%   action 'GoCompilePkg pkg/ccl/ccl.a'
     128 ms    0.19%   action 'GoCompilePkg pkg/cmd/cockroach-short/cockroach-short.a'
   14.558 s   21.44%   action 'GoLink pkg/cmd/cockroach-short/cockroach-short_/cockroach-short'
    0.03 ms    0.00%   runfiles for //pkg/cmd/cockroach-short cockroach-short

Here's the profile: incremental.gz

image

  • pkg/sql and pkg/server are the most severe bottlenecks (plateaus above respectively) limiting build parallelism, can we split them up?
  • sql: refactor builtins package #60547 would be great to get to, shows up but only slightly
  • breaking up pkg/roachpb a bit (moving roachpb.{Key,Span,TenantID} and other very commonly used symbols out of the package would help; would break things like the pkg/sql/parser ... pkg/roachpb dependency

@ajwerner
Copy link
Contributor

would break things like the pkg/sql/parser ... pkg/roachpb dependency

#80684 will do that

@irfansharif
Copy link
Contributor Author

It doesn't, I don't think. I ran the above with the PR, which still has:

"github.com/cockroachdb/cockroach/pkg/roachpb"

@rickystewart
Copy link
Collaborator

It doesn't, I don't think. I ran the above with the PR, which still has:

"github.com/cockroachdb/cockroach/pkg/roachpb"

I'm a little confused -- it doesn't look like roachpb is actually USED in this file after the import. Am I missing something here?

@irfansharif
Copy link
Contributor Author

irfansharif commented Apr 29, 2022

Ah, good catch Ricky! Looking at the generated sql.go, I don't think we need it anymore. The roachpb dependency was pinned in the BUILD file cause it was used in the generated thing, we can just remove it. #80684 (review).

mgartner added a commit to mgartner/cockroach that referenced this issue Apr 29, 2022
This commit breaks the `memo` package's dependence on the `builtins`
package so that they can be compiled concurrently. Optimizer packages
are no longer on the critical path, for now.

Informs cockroachdb#79357

Release note: None
craig bot pushed a commit that referenced this issue Apr 29, 2022
80141: rowexec: use streamer for lookup joins with no ordering r=yuzefovich a=yuzefovich

**row: fix the usage of Get requests with the streamer in some cases**

Previously, `TxnKVStreamer` processed the Get responses under the
assumption that `nil` `enqueueKeys` argument was provided. In such
a scenario, `EnqueueKeysSatisfied` contained an ordinal into the
original spans slice that is needed to process the Get response
correctly. We will shortly expand the usage of the Streamer to use
non-nil `enqueueKeys` argument which breaks that assumption. We go
around it by exporting `Result.Position` value which tracks exactly the
information we need.

Release note: None

**rowexec: use streamer for lookup joins with no ordering**

This commit expands the usage of the Streamer to lookup joins when
ordering doesn't have to be maintained. We can do so easily since the
join reader span generators de-duplicate spans, so the Streamer will
only be asked to process unique requests.

In theory, we should be able to do the same for the cases when ordering
needs to be maintained, but `InOrder` mode of the Streamer currently has
known bugs / limitations when a single request can result in multiple
rows - this wasn't an issue for the index joins since those are
guaranteed to get a single row for each request.

Also, we want to push the de-duplication logic from the join reader into
the Streamer (in order to inform the behavior of the yet-to-be-added
cache in the Streamer), but that will come after addressing the known
`InOrder` bugs mentioned above.

Some adjustments were needed:
- In order to improve the behavior with low `workmem` limit (in
particular, `regional_by_row` CCL logic test file was erroring out) of
the join reader we now make the batch size hint at most 1/12 of the
limit while giving the streamer the same three quarters - this allows
for other in-memory state of the join reader itself to have some space.
- One lookup join unit test is designed with the non-streamer code path
in mind, so we disable the usage of the streamer there.
- `lookup_join_trace` execbuilder file needed to filter out messages
produced by the range cache.

Out of curiosity, I decided to do a quick comparison of TPCH numbers
with the Streamer `off` (first column) and `on` (second column)
(negative numbers indicate the latency reduction, positive - latency
increase):
```
Q1:   3.78s  3.28s -13.36%
Q2:   0.19s  0.19s  2.11%
Q3:   1.72s  1.48s -13.89%
Q4:   1.57s  1.25s -20.54%
Q5:   2.74s  2.49s -9.06%
Q6:   6.36s  8.19s  28.74%
Q7:   6.97s  7.35s  5.42%
Q8:   1.00s  1.09s  8.68%
Q9:   6.52s  6.93s  6.32%
Q10:  1.93s  1.63s -15.60%
Q11:  0.52s  0.57s  9.06%
Q12:  7.16s  8.89s  24.17%
Q13:  1.17s  1.13s -3.43%
Q14:  0.57s  0.66s  13.91%
Q15:  4.83s  5.53s  14.34%
Q16:  0.81s  0.78s -4.08%
Q17:  0.48s  0.48s  0.84%
Q18:  5.61s  5.33s -4.96%
Q19:  3.86s  3.41s -11.83%
Q20: 12.00s 14.37s  19.79%
Q21:  9.33s  7.24s -22.38%
Q22:  0.57s  0.55s -4.03%
```
This mostly confirms our expectations - lookup joins should get faster
since we now parallelize the lookups. Index joins already get parallel
lookups in the old code path, so we have some regressions. Notably, Q6
and Q12 spend most of the time performing index joins and Q20 is
dominated by an index join and a parallelizable (when lookup columns
form a key) lookup joins.

Addresses: #54680

Release note: None

**sql: don't sort spans redundantly when using the streamer**

This commit makes it so that the lookup and index joins don't sort the
spans when the ordering doesn't have to be maintained and the Streamer
API is used - the Streamer itself performs the sort of spans within
single-range batches, so the caller's sort is redundant.

Release note: None

80698: Added s390x support to Bazel's toolchain  r=rickystewart a=dandotimujahid

This PR is in reference to the issue #58676
It will enable s390x binaries to be built using Bazel's toolchain

80745: opt: break memo's dependence on builtins r=mgartner a=mgartner

This commit breaks the `memo` packages dependence on the `builtins`
package so that they can be compiled concurrently. Optimizer packages
are no longer on the critical path, for now.

Informs #79357

Release note: None

80778: dev: make top-level dev runnable from anywhere r=irfansharif a=irfansharif

This should obviate the need to run dev from the top-level checkout; as
long as it's in your path or have an alias to the script, you should be
able to run dev wherever you are. It'll save you the need for the
leading './' when invoking things.

Release note: None

Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
Co-authored-by: dandotimujahid <Mujahid.Dandoti@ibm.com>
Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
@irfansharif
Copy link
Contributor Author

irfansharif commented Apr 30, 2022

We're a good 10% faster for incremental builds with all the PRs above + #80684 (review) + Yahor's #80810. A bit more that 10% since this issue was originally filed. Thanks for all the work!

Critical path (57.378 s):
       Time Percentage   Description
    0.20 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_redact/interfaces/interfaces.a'
    0.21 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_redact/internal/markers/markers.a'
    0.21 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_redact/internal/escape/escape.a'
    0.21 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_redact/internal/buffer/buffer.a'
    0.24 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_redact/internal/rfmt/rfmt.a'
    0.21 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_redact/builder/builder.a'
    0.24 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_redact/redact.a'
    0.24 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_errors/errbase/errbase.a'
    0.21 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_errors/markers/markers.a'
    0.21 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_errors/assert/assert.a'
    0.24 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_errors/errutil/errutil.a'
    0.71 ms    0.00%   action 'GoCompilePkg external/com_github_cockroachdb_errors/errors.a'
    0.21 ms    0.00%   action 'GoCompilePkg pkg/util/humanizeutil/humanizeutil.a'
    26.3 ms    0.05%   action 'GoCompilePkg pkg/settings/settings.a'
    14.9 ms    0.03%   action 'GoCompilePkg pkg/util/tracing/tracing.a'
    20.6 ms    0.04%   action 'GoCompilePkg pkg/util/log/log.a'
    4.71 ms    0.01%   action 'GoCompilePkg pkg/util/hlc/hlc.a'
    4.03 ms    0.01%   action 'GoCompilePkg pkg/kv/kvserver/readsummary/rspb/rspb.a'
    3.591 s    6.26%   action 'GoCompilePkg pkg/roachpb/roachpb.a'
     667 ms    1.16%   action 'GoCompilePkg pkg/clusterversion/clusterversion.a'
     324 ms    0.56%   action 'GoCompilePkg pkg/settings/cluster/cluster.a'
    2.74 ms    0.00%   action 'GoCompilePkg pkg/util/mon/mon.a'
     261 ms    0.45%   action 'GoCompilePkg pkg/base/base.a'
     361 ms    0.63%   action 'GoCompilePkg pkg/util/admission/admission.a'
    7.77 ms    0.01%   action 'GoCompilePkg pkg/sql/sessiondatapb/sessiondatapb.a'
    77.2 ms    0.13%   action 'GoCompilePkg pkg/sql/sem/tree/tree.a'
     502 ms    0.88%   action 'GoCompilePkg pkg/sql/catalog/catpb/catpb.a'
    27.1 ms    0.05%   action 'GoCompilePkg pkg/sql/schemachanger/scpb/scpb.a'
    2.140 s    3.73%   action 'GoCompilePkg pkg/sql/catalog/descpb/descpb.a'
     762 ms    1.33%   action 'GoCompilePkg pkg/sql/catalog/catalog.a'
     904 ms    1.57%   action 'GoCompilePkg pkg/sql/rowenc/valueside/valueside.a'
    1.138 s    1.98%   action 'GoCompilePkg pkg/sql/rowenc/rowenc.a'
     966 ms    1.68%   action 'GoCompilePkg pkg/sql/catalog/tabledesc/tabledesc.a'
    1.051 s    1.83%   action 'GoCompilePkg pkg/sql/catalog/systemschema/systemschema.a'
     594 ms    1.03%   action 'GoCompilePkg pkg/config/config.a'
    1.432 s    2.50%   action 'GoCompilePkg pkg/gossip/gossip.a'
    1.137 s    1.98%   action 'GoCompilePkg pkg/kv/kvclient/kvcoord/kvcoord.a'
     451 ms    0.79%   action 'GoCompilePkg pkg/kv/kvclient/rangefeed/rangefeed.a'
     996 ms    1.74%   action 'GoCompilePkg pkg/sql/catalog/lease/lease.a'
     338 ms    0.59%   action 'GoCompilePkg pkg/sql/catalog/hydratedtables/hydratedtables.a'
     597 ms    1.04%   action 'GoCompilePkg pkg/sql/catalog/descs/descs.a'
    3.615 s    6.30%   action 'GoCompilePkg pkg/sql/sem/builtins/builtins.a'
     348 ms    0.61%   action 'GoCompilePkg pkg/sql/execinfra/execagg/execagg.a'
    2.412 s    4.20%   action 'GoCompilePkg pkg/sql/colexec/colexecagg/colexecagg.a'
    1.605 s    2.80%   action 'GoCompilePkg pkg/sql/colexec/colexec.a'
     385 ms    0.67%   action 'GoCompilePkg pkg/sql/colexec/colexecdisk/colexecdisk.a'
     507 ms    0.88%   action 'GoCompilePkg pkg/sql/colexec/colbuilder/colbuilder.a'
     438 ms    0.76%   action 'GoCompilePkg pkg/sql/colflow/colflow.a'
     340 ms    0.59%   action 'GoCompilePkg pkg/sql/distsql/distsql.a'
    5.546 s    9.67%   action 'GoCompilePkg pkg/sql/sql.a'
    1.150 s    2.00%   action 'GoCompilePkg pkg/sql/gcjob/gcjob.a'
    1.066 s    1.86%   action 'GoCompilePkg pkg/sql/importer/importer.a'
    2.180 s    3.80%   action 'GoCompilePkg pkg/server/server.a'
     783 ms    1.36%   action 'GoCompilePkg pkg/cli/democluster/democluster.a'
    1.937 s    3.38%   action 'GoCompilePkg pkg/cli/cli.a'
     227 ms    0.40%   action 'GoCompilePkg pkg/ccl/cliccl/cliccl.a'
    93.9 ms    0.16%   action 'GoCompilePkg pkg/ccl/ccl.a'
    98.3 ms    0.17%   action 'GoCompilePkg pkg/cmd/cockroach-short/cockroach-short.a'
   16.249 s   28.32%   action 'GoLink pkg/cmd/cockroach-short/cockroach-short_/cockroach-short'
    0.03 ms    0.00%   runfiles for //pkg/cmd/cockroach-short cockroach-short

Here's the profile: incremental.gz

Screen Shot 2022-04-30 at 3 35 28 PM

As before, breaking down pkg/{sql,server,roachpb,builtins} in roughly that order of importance; roachpb, sql and server are the ones that actually limit parallelism given where they are in our dependency tree, the plateaus respectively in the screen shot above. All the analysis above has been focused on transitive dependencies from pkg/roachpb. Perhaps we should find a few other base packages to drive similar dependency hygiene improvements for CRDB.

craig bot pushed a commit that referenced this issue May 2, 2022
80842: parser: remove roachpb from tree r=irfansharif a=otan

Reacting on an [earlier comment](#80684 (review)) which I misunderstood. Delete roachpb
from parser as it is no longer a dependency.

Refs: #79357

Release note: None

Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
craig bot pushed a commit that referenced this issue May 2, 2022
80810: colexecdisk: extract disk-backed operators into a new package r=yuzefovich a=yuzefovich

**colexecdisk: extract disk-backed operators into a new package**

This allows us to break dependency of `colexec` on `colexecjoin` which
speeds up the build a bit.

Addresses: #79357.

Release note: None

**execagg: extract out some aggregate helpers into a separate package**

This allows us to break dependency of `colexecagg` on `execinfra`.

Release note: None

80874: Add Andrew Baptist to AUTHORS r=andrewbaptist a=andrewbaptist



Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
Co-authored-by: Andrew Baptist <baptist@cockroachlabs.com>
@rail
Copy link
Member

rail commented May 25, 2022

Manually synced with Jira

Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@rickystewart rickystewart added X-nostale Marks an issue/pr that should be ignored by the stale bot and removed no-issue-activity labels Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-system C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-dev-inf X-nostale Marks an issue/pr that should be ignored by the stale bot
Projects
None yet
Development

No branches or pull requests

6 participants