Open davepacheco opened 3 years ago
Was just about to make an issue for this. Glad all this detail already exists. I'm on an M1 MBP seeing the same thing. It's not unusable, but when I run a test locally that needs Cockroach, it takes about 20 seconds. When I run two such tests, it takes 40 seconds, so it's not shared overhead.
Haven't tested it too scientifically, but I think I'm seeing a huge improvement with the new M1 Mac build in 22.2.
cargo run --bin=omicron-dev db-run
~/oxide/omicron $ time cargo run --bin=omicron-dev db-wipe --database-url="postgresql://root@127.0.0.1:32221?sslmode=disable"
warning: skipping duplicate package `header-check` found at `/Users/david/.cargo/git/checkouts/propolis-12517f89d3d9f483/b596e72/crates/viona-api/header-check`
Finished dev [unoptimized + debuginfo] target(s) in 0.31s
Running `target/debug/omicron-dev db-wipe '--database-url=postgresql://root@127.0.0.1:32221?sslmode=disable'`
omicron-dev: wiping any existing database
omicron-dev: wiped
cargo run --bin=omicron-dev db-wipe 0.25s user 0.12s system 41% cpu 0.918 total
~/oxide/omicron $ time cargo run --bin=omicron-dev db-populate --database-url="postgresql://root@127.0.0.1:32221?sslmode=disable"
warning: skipping duplicate package `header-check` found at `/Users/david/.cargo/git/checkouts/propolis-12517f89d3d9f483/b596e72/crates/viona-api/header-check`
Finished dev [unoptimized + debuginfo] target(s) in 0.32s
Running `target/debug/omicron-dev db-populate '--database-url=postgresql://root@127.0.0.1:32221?sslmode=disable'`
omicron-dev: populating database
omicron-dev: populated database
cargo run --bin=omicron-dev db-populate 0.25s user 0.13s system 20% cpu 1.860 total
On my 2020 Macbook Pro running Catalina (10.15.7), using the official CockroachDB v20.2.5 build, CockroachDB schema updates are incredibly slow. I've started
omicron_dev db-run
in the background (which itself took tens of seconds to populate the database with an empty schema). Then, running eitherdb-wipe
ordb-populate
takes many seconds each (except wiping an empty database):cargo test
does a bunch of similar operations, so it winds up taking 2m40s altogether.By contrast, on illumos (omnios-r151034-0d278a0cc5) running in AWS (t2.2xlarge, 8 cores, 32 GiB DRAM, one 200 GiB EBS volume), this is almost 20x faster:
and the test suite takes only 8s.
Similarly, on illumos (helios-1.0.20336) running under VMware Fusion 11.5.7 on the same Mac, these operations are fast:
and
cargo test
takes about 17s on this system.Summarizing:
This is all on commit a0ce0e46e2cd117698d05a40e418de0890460fb4.
This looks like a CockroachDB issue at this point. I can reproduce the slowness using this statement from the schema file:
This takes several hundred milliseconds on an empty table.
Here are some avenues to explore:
All that said: I'm not planning to dig into this right now. I just wanted to record this in case we decide to dig deeper in the future.