Skip to content
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

add size hint variable for PublishBatch creation #888

Merged
merged 1 commit into from
Jul 5, 2020

Conversation

bollhals
Copy link
Contributor

@bollhals bollhals commented Jul 4, 2020

Proposed Changes

add a new method with a size hint for the creation of the list to hold the commands. This can reduce the allocations due to the storage of the commands by half.

Types of Changes

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

This only adds a new overloaded method to the public IModel interface.

@bollhals
Copy link
Contributor Author

bollhals commented Jul 4, 2020

In the test app of stebet, before:
image

after
image

Copy link
Member

@michaelklishin michaelklishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a lot of sense since batches are rarely random in size. However, this PR changes the public API and thus needs an API approval test update

dotnet test -f netcoreapp3.1 projects/Unit --filter "FullyQualifiedName~RabbitMQ.Client.Unit.APIApproval"

@michaelklishin michaelklishin merged commit 865ba30 into rabbitmq:master Jul 5, 2020
@michaelklishin
Copy link
Member

I updated APIApproval expectations. Thank you for your ongoing contributions @bollhals! 🥇

@michaelklishin michaelklishin added this to the 6.2.0 milestone Jul 5, 2020
@michaelklishin
Copy link
Member

Backported to 6.x.

@bording
Copy link
Collaborator

bording commented Jul 5, 2020

@michaelklishin This is a breaking change, so it should not have been backported to the 6.x branch.

When looking at the APIApproval changes, any time you see an interface being modified, that is a breaking change.

These are definitely the kinds of changes I'd like to see in new minor versions, so I think that's pointing to us needing to remove interfaces from the public API surface because they prevent these kind of things from being possible.

@stebet
Copy link
Contributor

stebet commented Jul 5, 2020

Is there also a good reason to have interfaces for the basics like IConnection, IModel etc.? Don't really see a reason why anyone would go through the trouble of implementing their own version of those.

@bording
Copy link
Collaborator

bording commented Jul 5, 2020

Is there also a good reason to have interfaces for the basics like IConnection, IModel etc.? Don't really see a reason why anyone would go through the trouble of implementing their own version of those.

When I see interfaces used like that, it's usually an attempt to make testing easier since you can provide fake testing implementations.

@michaelklishin
Copy link
Member

I'm not going to lie it is seriously annoying to me that we cannot ship new small features like this quickly in this client because of the adopted semantic versioning interpretation.

There is so much code out there that uses interfaces that removing them seems unrealistic.

@michaelklishin michaelklishin modified the milestones: 6.2.0, 7.0.0 Jul 5, 2020
@michaelklishin
Copy link
Member

I suggest then that we only release new majors and patch releases, no minors. Minors make no sense in the world of strict semantic versioning: even small features often require some kind of interface changes, even minor usability improvements can be interpreted as breaking behavior changes. If almost no change is appropriate for a minor release, why bother with them at all?

@rwkarg
Copy link

rwkarg commented Jul 31, 2020

Is there also a good reason to have interfaces for the basics like IConnection, IModel etc.? Don't really see a reason why anyone would go through the trouble of implementing their own version of those.

For context, we have a SharedPublishConnection and a SharedConsumerConnection implementation of IConnection that we use to enforce that publish and subscribe happen on separate connections/sockets (to avoid TCP backpressure on consumers in case of backlogs) as well as to enforce a single publisher and single consumer connection per endpoint/connection config (to avoid unnecessary TCP connections).

@bollhals bollhals deleted the batchpublishsizehint branch March 2, 2021 20:49
@lukebakken lukebakken modified the milestones: 8.0.0, 7.0.0 Mar 8, 2022
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.

6 participants