8.3.2.51. v4.7.12ΒΆ

commit 7e961198e39e7d62b0a884b671c82557292c4c53
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Fri Nov 19 10:28:18 2021 -0600

    perf(content): Cache more expensive to recalc things.

    We do a lot of remarshalling bootenv overrides and package repos
    during the content load process.  Cache them on the data tracker
    instead.

    Create an intern package to hold interned strings and utility methods,
    and move transact.SK to the new intern package.

    Add garbage collection of interend strings to the intern package.
    This will keep cached strings from growing without bound, at the
    expense of slow churn in cached strings.

M   backend/bootenv.go
M   backend/catalog_items.go
M   backend/contexts.go
M   backend/dataTracker.go
M   backend/dhcpUtils.go
M   backend/endpoints.go
M   backend/jobs.go
M   backend/lease.go
M   backend/machines.go
M   backend/param.go
M   backend/plugins.go
M   backend/pools.go
M   backend/preference.go
M   backend/profiles.go
M   backend/profiles_test.go
M   backend/raw_model.go
M   backend/requestTracker.go
M   backend/reservation.go
M   backend/roles.go
M   backend/stage.go
M   backend/subnet.go
M   backend/task.go
M   backend/template.go
M   backend/tenants.go
M   backend/user.go
M   backend/utils.go
M   backend/version_sets.go
M   backend/workflow.go
M   commit/pkey.go
M   datastack/index/index.go
A   intern/intern.go
A   intern/key.go
M   transact/interlockTracker.go
M   transact/simpleKey.go
M   transact/tx.go
M   transact/tx_test.go

commit 824315d48f5a69129889b283994f5bdc9ed2e4c5
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 18 14:35:53 2021 -0600

    perf(bootenvs): Cache the realArches method.

    realArches bever changes per backend.Bootenv once it is calculated, so
    jsut calculate it once and reuse it.  This saves on a lot of gnarly
    template calculations.

M   backend/bootenv.go

commit e32ea893acd8561f2dbe9a1a4d12967f21a53b7a
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 18 14:15:39 2021 -0600

    perf(bootenvs) Cache machine calculated bootenv within a transaction

    There are several places where bootenv.RealEnv is called multiple
    times over a bootenv validity checking cycle.  Instead of
    recalculating the real bootenv data every time, cache it and reuse it
    until the end of the transaction.

M   backend/machines.go

commit d60beb074b1d243e0b6729548fe7f459fbebb772
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 18 12:28:53 2021 -0600

    perf(transact) Return early in transact.Acquire*

    If transact.AcquireRead or transact.AcquireWrite already has the right
    ownership on the objects in question, avoid going into the interlock
    tracker.  This reduces pressure on the main interloc tracker mutex,
    which becomes very contested under heavy load.

M   transact/interlockTracker.go
M   transact/simpleKey.go
M   transact/tx.go

commit 1767e1ca920c76ceaa675ee57c928b4af5ede02c
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 18 12:27:10 2021 -0600

    fix(index): Consolidate flag handling and fix Any filter

    Get rid of some repeated flag checking boilerplate in the index
    package, and make the Any filter deduplicate its results by default.

M   datastack/index/index.go

commit 5605598f021535079e5e21006c3d7e67b88a6800
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 18 09:28:08 2021 -0600

    pref(backend): Make rt.find dive into stack layers directly.

    Instead of calling into rt.baseItems when looking for just one object,
    just search all the layers incrementally.  This saves the overhead of
    having to merge together all the data we need to search through when
    we don't actually need to.

M   backend/requestTracker.go
M   datastack/index/index.go
M   datastack/stack.go

commit 3de344036a302f6ed707ea8cc9114a7835107349
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 18 09:27:25 2021 -0600

    perf(transact) Use transact.SK more internally.

    This reworks the internals a bit to use SK structs where we were using
    strings.  This promarily just cuts down on SK <-> string conversion.

M   backend/requestTracker.go
M   transact/interlockTracker.go
M   transact/simpleKey.go
M   transact/tx.go
M   transact/tx_test.go

commit 803ade52f5fd8d4d83982c2b29bcbe3f81781cb1
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 18 09:17:50 2021 -0600

    perf(indexes): Have index Makers carry around frozen empty Indexes.

    The index logic uses empty Indexes in several places to reduce the
    amount of special case handling needed when working with filters that
    expect to be able to process multiple Indexes.  In the vast majority
    of those places, the empty index is never intended to be changed, and
    when dealing with operations that are operating across a large swath
    of the index space the cost of allocating and deallocating those empty
    indexes adds up.  To alleviate that CPU and memory pressure, have the
    Makers carry around samples of an enpty Index specialized for them,
    and add logic to make sure that an empty index is never modified.

    While we are at it, refactor Indexes a bit to carry around pointers to
    their makers instead of copies of them, and add a couple of utility
    types for collections of Makers.

M   backend/bootenv.go
M   backend/jobs.go
M   backend/machines.go
M   backend/param.go
M   backend/raw_model.go
M   backend/requestTracker.go
M   backend/subnet.go
M   backend/task.go
M   backend/utils.go
M   datastack/index/index.go
M   datastack/index/index_test.go
M   frontend/indexes.go

commit a2326850ee048260814fcbb800b4aa44503c22d4
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 18 09:17:14 2021 -0600

    perf(params): Get object params via reflection where feasible.

    More or less everything that satisfies models.Paramer stores its
    params in a field named "Params".  Use reflection via the mr package
    to access that field directly instead of making a copy via the
    GetParams interface when we already have a read lock on the object and
    are not going to use the values in a location they would be modified.
    This saves a fair amount of memory and CPU cost involved in making
    lots of somethmes not so little maps that we then just throw away.

M   backend/bootenv.go
M   backend/dataTracker.go
M   backend/param.go
M   backend/requestTracker.go
M   backend/utils.go

commit 218faf6421e524d436d64fe95e2bdf1ae030b64e
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Mon Nov 15 13:51:17 2021 -0600

    perf(backend): Change where the global profile is cached.

    Move from caching it on a per-request basis in request tracker to
    globally in the datatracker, and arrange for the cached copy to be
    updated whenever the global profile changes.

    Handling it this way keeps fewer copies of the global porofile in
    memory, and it is a highly read object that most requests that deal
    with param values require at some point or another.

M   backend/bootenv.go
M   backend/dataTracker.go
M   backend/jobs.go
M   backend/requestTracker.go
M   clitest/test-data/output/TestCorePieces/bootenvs.indexes/stdout.expect
M   datastack/index/index.go

commit 956a3374521288957815cf9b86c2abb51260f9f6
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Fri Nov 12 21:28:46 2021 -0600

    perf(jobs): Tune space an CPU utilization when retiring older jobs.

    Get rid of an unneeded data copy when marking a job as incomplete,
    since the job that is no longer current is not returned and we can
    ensure that nothing else is accessing it.

M   backend/jobs.go

commit bc5c3d3b107df999982a072af6d5e270ae2a76e3
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 11 11:02:23 2021 -0600

    feat(indexes): Get rid of index boilerplate.

    Instead of requiring each backend object to carry around methods that
    allow it to be indexed, assume the can all be indexed and let them
    satisfy interfaces to override the default reflect-based automatic
    index maker generation.

M   backend/bootenv.go
M   backend/catalog_items.go
M   backend/contexts.go
M   backend/endpoints.go
M   backend/jobs.go
M   backend/lease.go
M   backend/machines.go
M   backend/param.go
M   backend/pluginProviders.go
M   backend/plugins.go
M   backend/pools.go
M   backend/profiles.go
M   backend/raw_model.go
M   backend/requestTracker.go
M   backend/reservation.go
M   backend/roles.go
M   backend/stage.go
M   backend/subnet.go
M   backend/task.go
M   backend/template.go
M   backend/tenants.go
M   backend/user.go
M   backend/utils.go
M   backend/version_sets.go
M   backend/workflow.go
M   datastack/index/index.go
M   frontend/frontend.go
M   mr/modelReflect.go

commit c330d0d5181d15916521b32c712e7a00157ec267
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Thu Nov 11 09:46:16 2021 -0600

    perf(transact) Optimize struct layout in the transact packaqge

    Rearrange the fields in the Transact structs to minimize the amount of
    space they use.

M   transact/interlockTracker.go
M   transact/tx.go
M   transact/tx_test.go

commit 59cd1fa90a102c4590af6ed2b95c80162550b1d9
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Wed Nov 17 13:04:06 2021 -0600

    test(perf): Allow for loading extra content during the perf tests.

    This allows you to point at a coupel of extra directories to test
    content bundle and plugin provider loading as part of the job running
    unit tests.  The intent is to replicate the behaviour of the system
    when trying to load content on a busy system and identify bottlenecks
    that can cause that process to excessively slow down.

M   cmds/license/machinePerf.go
A   perf_tests/contentLoad_test.go
M   perf_tests/machineCreate_test.go

commit 65ea5c00d3eb3fcf3264cbf6e615990ce4da265a
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Tue Nov 16 13:44:29 2021 -0600

    debug(backend): Poison the requestTracker on transaction entrance.

    This will force the request tracker to panic if we ever try to acquire
    the rate limiting semaphore recursively.  This will not prevent more
    sophisticated deadlocks involving plugin events, but it will ensure
    that we cannot get into a situation where we deadlock in a simple
    recursive fashion.

M   backend/requestTracker.go

commit 065f9b040e8fdd951efe2df2bcf48fb4a02535b5
Author: Victor Lowther <victor.lowther@gmail.com>
Date:   Tue Nov 16 11:29:20 2021 -0600

    fix(transact) Fix transaction leak.

    If a request gets cancelled after creating a unique transact.Tx but
    before getting far enough to clean up that transaction, it will hang
    out in the interlock tracker forever, eventually slowing things down.
    Resolve this issue deferring the release if the transaction jsut after
    acquiring it (this is safe because releasing an already released
    transaction is a noop), and moving transaction acquisition after the
    ratelimiting semaphore.

M   backend/requestTracker.go
M   transact/tx.go

End of Note