Skip to content

Conversation

@snej
Copy link
Contributor

@snej snej commented May 9, 2023

CBG-2952

  • Don't create new goroutines to encode/decode Message bodies.
  • Message state that's only needed while receiving or sending is broken out into new structs msgSender and msgStreamer.
  • New API for handling requests. Added AsyncHandler type, Dispatcher interface, and some Dispatcher implementations for typical tasks like handler-per-Profile and limited concurrency.
  • New ThreadPool class for handling requests asynchronously without spawning more goroutines.
  • receiver goroutine blocks and stops reading from the socket when the total size of received-but-unhandled requests exceeds a limit. (This exerts backpressure on the client.)

Note to reviewers:

The two commits here are best reviewed individually. One contains the real work; the rest just fixes a bunch of Go compiler warnings that have accumulated over time (mostly about capitalized error messages.)

@snej snej force-pushed the CBG-2952-better-concurrency branch 3 times, most recently from 85478ad to 2d6ce1a Compare May 10, 2023 23:50
snej added 2 commits May 10, 2023 17:03
- Don't create new goroutines to encode/decode Message bodies.
- Message state that's only needed while receiving or sending is broken out
  into new structs msgSender and msgStreamer.
- New API for handling requests. Added AsyncHandler type, Dispatcher interface,
  and some Dispatcher implementations for typical tasks like handler-per-Profile
  and limited concurrency.
- New ThreadPool class for handling requests asynchronously without spawning
  more goroutines.
- receiver goroutine blocks and stops reading from the socket when the total
  size of received-but-unhandled requests exceeds a limit. (This exerts
  backpressure on the client.)

CBG-2952
Most of them were about capitalized error messages...
@snej snej force-pushed the CBG-2952-better-concurrency branch from 2d6ce1a to 011516c Compare May 11, 2023 00:04
@snej snej marked this pull request as ready for review May 11, 2023 00:24
@snej snej requested a review from bbrks May 11, 2023 00:24
@snej snej assigned snej and bbrks and unassigned snej May 30, 2023
snej and others added 2 commits June 6, 2023 11:24
If an incomplete incoming reply has already been dispatched to the app, don't
change its body to an error when the connection closes.

Also made receiver.closePendingResponses() be called on the receiver's
parseLoop's goroutine, not the sender's.
@bbrks
Copy link
Member

bbrks commented Mar 25, 2025

Attempted to quickly resolve conflicts just to keep this branch alive. Not overly confident in what I merged though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants