Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Endpoints should not be durable #58

Closed
jacktuck opened this issue Nov 23, 2017 · 9 comments
Closed

Endpoints should not be durable #58

jacktuck opened this issue Nov 23, 2017 · 9 comments
Assignees

Comments

@jacktuck
Copy link
Collaborator

jacktuck commented Nov 23, 2017

Ack Latency for Persistent Messages

basic.ack for a persistent message routed to a durable queue will be sent after persisting the message to disk. The RabbitMQ message store persists messages to disk in batches after an interval (a few hundred milliseconds) to minimise the number of fsync(2) calls, or when a queue is idle. This means that under a constant load, latency for basic.ack can reach a few hundred milliseconds. To improve throughput, applications are strongly advised to process acknowledgements asynchronously (as a stream) or publish batches of messages and wait for outstanding confirms. The exact API for this varies between client libraries.

https://www.rabbitmq.com/confirms.html

@jpwilliams
Copy link
Owner

Good find in the docs!

Having them be durable, however, does mean that an endpoint can die and then come back up and respond to messages that haven't yet reached their timeout - it's a nice feature to have on occasion and has saved some of our services from causing larger failures before.

Batching might be the way to go, I suppose? But we'd need some rules for how/when it's done.

@jacktuck
Copy link
Collaborator Author

Having them be durable, however, does mean that an endpoint can die and then come back up and respond to messages that haven't yet reached their timeout

That is expected IMO. Otherwise there is no difference between endpoint and listener semantics.

@jpwilliams
Copy link
Owner

Aye so making them non-durable is not an option there then. So batching?

@jacktuck
Copy link
Collaborator Author

jacktuck commented Nov 29, 2017

Well my point is that i think endpoints should not be durable. And it's fine that messages can be lost. Retrying would help with endpoint can die and then come back up

@jpwilliams
Copy link
Owner

Ah you reckon? I guess it makes sense for an endpoint to not back up requests for itself, though then I suppose we'd need something so that requesters weren't waiting for services to come back up (i.e., hitting a dead endpoint should return an error immediately rather than waiting 30 seconds). #43's a discussion for that.

If we did do that, I think I'd like to be able to add durable endpoints as an added option; they are very useful sometimes, but if they have a scary performance hit under load and act a bit differently we can just explain that in an option in the docs and folks can use it if they choose.

That sound sensible?

@jpwilliams
Copy link
Owner

#45 was an issue regarding the possibility of a "transient" option for endpoints (what we're suggesting is the default here).

Would making it the default be considered a breaking change? It wouldn't actively break things, but it does change how they behave, albeit indirectly.

@jacktuck
Copy link
Collaborator Author

jacktuck commented Nov 30, 2017

what we're suggesting is the default here

correct

Would making it the default be considered a breaking change?

I think so

add durable endpoints as an added option; they are very useful sometimes

As long as durable: false is the default i think that is cool.

@jpwilliams
Copy link
Owner

I'll set up a PR stub that we can use to start working on it.

@jpwilliams
Copy link
Owner

jpwilliams commented Nov 30, 2017

Looking at this a bit more carefully, it doesn't look like it'd be this that's affecting us.

The docs there mention persistent messages that travel to durable queues, but messages sent via requests and emits are always transient (persistent requires either persistent: true or deliveryMode: 2 in the publishing options).

This may still be an intuitive change, but I don't think it'll have any lasting effect on response times etc.

Source: Underlying amqplib docs - Channel#publish section

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants