sapling/blobrepo
Thomas Orozco 2ee46eb252 mononoke: don't require cachelib to talk to a remote DB
Summary:
Currently, we implicitly expect that caching is enabled if we're dealing with a remote repository, but that means cachelib must be enabled when running with a remote repository, and that is ... slow.

This can be problematic in two cases:

In tests. It makes MySQL tests unbearably slow, and a little more flaky because we end up using so much CPU. With this patch, MySQL tests remain slower than SQLite tests, but by a factor of < 2, which is a pretty substantial improvement.

Running trivial administrative commands (e.g. a `mononoke_admin`), notably using a dev build (which right now unbearably slow). With this patch, such a trivial command is about 6x faster:

```
[torozco@devvm4998.lla1 ~/fbcode] time buck-out/gen/scm/mononoke/admin#binary/admin --repo-id 2102 --mononoke-config-path /home/torozco/local/.mononoke_exec/config/PROD --skip-caching bookmarks list --kind publishing
Jun 21 08:57:36.658 INFO using repo "instagram-server" repoid RepositoryId(2102)
master	c96ac4654e4d2da45a9597af859adeac9dba3d7ca964cb42e5c96bc153f185e3	2c5713ad27262b91bf1dfaf21b3cf34fe3926c8d

real	0m5.299s
user	0m5.097s
sys	0m0.699s
[torozco@devvm4998.lla1 ~/fbcode] time buck-out/gen/scm/mononoke/admin#binary/admin --repo-id 2102 --mononoke-config-path /home/torozco/local/.mononoke_exec/config/PROD bookmarks list --kind publishing
I0621 08:57:59.299988 1181997 CacheAllocator-inl.h:3123] Started worker 'PoolRebalancer'
Jun 21 08:57:59.328 INFO using repo "instagram-server" repoid RepositoryId(2102)
master	c96ac4654e4d2da45a9597af859adeac9dba3d7ca964cb42e5c96bc153f185e3	2c5713ad27262b91bf1dfaf21b3cf34fe3926c8d

real	0m28.620s
user	0m27.680s
sys	0m2.466s
```

This is also nice because it means the MySQL tests won't talk to Memcache anymore.

 ---

Note: in this refactor, I made `Caching` an enum so it can't accidentally be swapped with some other boolean.

 ---

Finally, it also uses up quite a bit less RAM (we no longer need 2GB of RAM to output one line of bookmarks — although we're still using quite a bit!):

```
[torozco@devvm4998.lla1 ~/fbcode] env time buck-out/gen/scm/mononoke/admin#binary/admin --skip-caching --repo-id 2102 --mononoke-config-path /home/torozco/local/.mononoke_exec/config/PROD bookmarks list --kind publishing
Jun 21 09:18:36.074 INFO using repo "instagram-server" repoid RepositoryId(2102)
master	abdd2f78dafeaa8d4b96897955a63844b31324f9d89176b3a62088d0e2ae2b22	1702392d14bf7a332bf081518cb1ea3c83a13c39
5.08user 0.68system 0:05.28elapsed 109%CPU (0avgtext+0avgdata 728024maxresident)k
6776inputs+0outputs (8major+115477minor)pagefaults 0swaps

[torozco@devvm4998.lla1 ~/fbcode] env time buck-out/gen/scm/mononoke/admin#binary/admin --repo-id 2102 --mononoke-config-path /home/torozco/local/.mononoke_exec/config/PROD bookmarks list --kind publishing
I0621 09:19:01.385933 1244489 CacheAllocator-inl.h:3123] Started worker 'PoolRebalancer'
Jun 21 09:19:01.412 INFO using repo "instagram-server" repoid RepositoryId(2102)
master	abdd2f78dafeaa8d4b96897955a63844b31324f9d89176b3a62088d0e2ae2b22	1702392d14bf7a332bf081518cb1ea3c83a13c39
26.96user 2.27system 0:27.93elapsed 104%CPU (0avgtext+0avgdata 2317716maxresident)k
11416inputs+5384outputs (17major+605118minor)pagefaults 0swaps
```

Reviewed By: farnz

Differential Revision: D15941644

fbshipit-source-id: 0df4a74ccd0220a786ebf0e883e1a9b8aab0a647
2019-06-24 06:07:18 -07:00
..
blob_changeset/src remove HgNodeHash from HgChangesetEnvelopeMut 2019-05-21 12:25:06 -07:00
changeset_fetcher/src mononoke: move changeset_fetcher out of blobrepo into separate crate 2019-01-31 00:41:48 -08:00
errors/src improve performance of hg manifest generation 2019-05-21 12:25:52 -07:00
factory/src mononoke: don't require cachelib to talk to a remote DB 2019-06-24 06:07:18 -07:00
src mononoke: add lazy fetching of HgBlobEntry content 2019-06-24 03:00:54 -07:00
test Convert MPathElement to a newtype around Bytes 2019-06-21 15:40:55 -07:00
Cargo.toml Add Cargo.toml files to crates. (#7) 2018-07-09 19:52:27 -07:00