-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
[performance] massively improved ActivityPub delivery worker efficiency #2812
Merged
tsmethurst
merged 35 commits into
superseriousbusiness:main
from
NyaaaWhatsUpDoc:feature/indexable-http-queue-and-fixed-client-workers
Apr 11, 2024
Merged
[performance] massively improved ActivityPub delivery worker efficiency #2812
tsmethurst
merged 35 commits into
superseriousbusiness:main
from
NyaaaWhatsUpDoc:feature/indexable-http-queue-and-fixed-client-workers
Apr 11, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nge, integrate the deliverypool changes into transportcontroller
NyaaaWhatsUpDoc
commented
Apr 8, 2024
NyaaaWhatsUpDoc
commented
Apr 8, 2024
NyaaaWhatsUpDoc
commented
Apr 8, 2024
NyaaaWhatsUpDoc
commented
Apr 8, 2024
NyaaaWhatsUpDoc
changed the title
[feature] indexable http client queue and fixed http client worker pool
[feature] massively improved ActivityPub delivery worker efficiency
Apr 8, 2024
NyaaaWhatsUpDoc
commented
Apr 8, 2024
tsmethurst
reviewed
Apr 8, 2024
tsmethurst
reviewed
Apr 8, 2024
tsmethurst
approved these changes
Apr 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me :) Good work! Once 0.15.0 is out let's squerge this.
NyaaaWhatsUpDoc
changed the title
[feature] massively improved ActivityPub delivery worker efficiency
[performance] massively improved ActivityPub delivery worker efficiency
Apr 8, 2024
nyarla
pushed a commit
to nyarla/gotosocial-modded
that referenced
this pull request
Jun 19, 2024
…cy (superseriousbusiness#2812) * add delivery worker type that pulls from queue to httpclient package * finish up some code commenting, bodge a vendored activity library change, integrate the deliverypool changes into transportcontroller * hook up queue deletion logic * support deleting queued http requests by target ID * don't index APRequest by hostname in the queue * use gorun * use the original context's values when wrapping msg type as delivery{} * actually log in the AP delivery worker ... * add uncommitted changes * use errors.AsV2() * use errorsv2.AsV2() * finish adding some code comments, add bad host handling to delivery workers * slightly tweak deliveryworkerpool API, use advanced sender multiplier * remove PopCtx() method, let others instead rely on Wait() * shuffle things around to move delivery stuff into transport/ subpkg * remove dead code * formatting * validate request before queueing for delivery * finish adding code comments, fix up backoff code * finish adding more code comments * clamp minimum no. senders to 1 * add start/stop logging to delivery worker, some slight changes * remove double logging * use worker ptrs * expose the embedded log fields in httpclient.Request{} * ensure request context values are preserved when updating ctx * add delivery worker tests * fix linter issues * ensure delivery worker gets inited in testrig * fix tests to delivering messages to check worker delivery queue * update error type to use ptr instead of value receiver * fix test calling Workers{}.Start() instead of testrig.StartWorkers() * update docs for advanced-sender-multiplier * update to the latest activity library version * add comment about not using httptest.Server{}
nyarla
pushed a commit
to nyarla/gotosocial-modded
that referenced
this pull request
Jun 19, 2024
…cy (superseriousbusiness#2812) * add delivery worker type that pulls from queue to httpclient package * finish up some code commenting, bodge a vendored activity library change, integrate the deliverypool changes into transportcontroller * hook up queue deletion logic * support deleting queued http requests by target ID * don't index APRequest by hostname in the queue * use gorun * use the original context's values when wrapping msg type as delivery{} * actually log in the AP delivery worker ... * add uncommitted changes * use errors.AsV2() * use errorsv2.AsV2() * finish adding some code comments, add bad host handling to delivery workers * slightly tweak deliveryworkerpool API, use advanced sender multiplier * remove PopCtx() method, let others instead rely on Wait() * shuffle things around to move delivery stuff into transport/ subpkg * remove dead code * formatting * validate request before queueing for delivery * finish adding code comments, fix up backoff code * finish adding more code comments * clamp minimum no. senders to 1 * add start/stop logging to delivery worker, some slight changes * remove double logging * use worker ptrs * expose the embedded log fields in httpclient.Request{} * ensure request context values are preserved when updating ctx * add delivery worker tests * fix linter issues * ensure delivery worker gets inited in testrig * fix tests to delivering messages to check worker delivery queue * update error type to use ptr instead of value receiver * fix test calling Workers{}.Start() instead of testrig.StartWorkers() * update docs for advanced-sender-multiplier * update to the latest activity library version * add comment about not using httptest.Server{}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This replaces our current transport delivery routine to instead push deliveries to a concurrency-safe queue, which is pulled from by a fixed-size pool of delivery workers. These delivery workers are optimized (unlike currently) to prefer new attempted deliveries over backlogged erroring (i.e. retry-backoff) deliveries, which hugely optimizes both the amount of time our goroutines spend and the actual number of them, so they're doing useful delivery work and not performing retry-backoffs in serial.
Also sneaks in a lil change to use
errorsv2.AsV2()
instead oferrors.As()
in a number of places because it's much nicer working with generic types, and likely faster instead of the existing reflect logic.Checklist
go fmt ./...
andgolangci-lint run
.