TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Adventures in message queues

350 点作者 fcambus大约 10 年前

24 条评论

ChuckMcM大约 10 年前
In my experience there are three things that will break here;<p>1) At-most-once is a bridge to an elementary school which has an inter-dimensional connection to a universe filled with pit vipers. Kids will die, and there is nothing you can do to stop it.<p>2) Messages are removed when acknowledged <i>or</i> memory pressure forces them to be kicked out. Black Perl messages, those that sail in from out of nowhere, and lonely widows (processes that never find out their loved ones are dead) will result.<p>3) Messages are ordered using wall clock millisecond time. This will leave your messages struggling to find their place in line and messages that should be dead, not be dead (missing fragment problem).<p>Obviously all these are simply probabilistic trade-offs based on most likely scenarios which result in arbitrarily small windows of vulnerability. No window is small enough at scale over time.<p>Often when these things have bitten me it has been non-programming stuff. For example a clock that wouldn&#x27;t follow NTP because it was too far ahead of what NTP thought the time was, an operator fixed that by turning time back 8 seconds. A client library that was told messages arrive at most one time, and so made a file deletion call on the arrival of a message, a restored node holding that message managed to shoot it out before the operator could tell it that it was coming back from a crash, poof damaged file. And one of my favorites in ordering, a system that rebooted after an initial crash (resetting its sequence count) and getting messages back into flight with the wrong sequence number but with legitimate sequence values. FWIW, these sorts of things are especially challenging for distributed storage systems because files are, at their most abstract, little finite state machines that walk through a very specific sequence of mutations the order of which is critical for correct operation.<p>My advice for folks building such systems are never depend on the &#x27;time&#x27;, always assume at-least-once, and build in-band error detection and correction to allow for computing the correct result from message stream &#x27;n&#x27; where two or more invariants in your message protocol have been violated.<p>Good luck!
评论 #9210291 未加载
评论 #9209530 未加载
评论 #9209522 未加载
评论 #9210275 未加载
antirez大约 10 年前
I&#x27;m very sorry, credits for the questions goes to Jacques Chester, see <a href="https://news.ycombinator.com/item?id=8709146" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8709146</a> I made an error cut&amp;pasting the wrong name of Adrian (Hi Adrian, sorry for misquoting you!). Never blog and go to bed I guess, your post may magically be top news on HN...
pixelmonkey大约 10 年前
Seems like a similar design to Apache Kafka, <a href="http://kafka.apache.org" rel="nofollow">http:&#x2F;&#x2F;kafka.apache.org</a>. AP, partial ordering (Kafka does ordering within &quot;partitions&quot;, but not topics).<p>One difference is that Disque &quot;garbage collects&quot; data once delivery semantics are achieved (client acks) whereas Kafka holds onto all messages within an SLA&#x2F;TTL, allowing reprocessing. Disque tries to handle at-most-once in the server whereas Kafka leaves it to the client.<p>Will be good to have some fresh ideas in this space, I think. A Redis approach to message queues will be interesting because the speed and client library support is bound to be pretty good.
andrea_s大约 10 年前
Maybe I&#x27;m missing something, but if it is important to guarantee that a certain message will be dispatched and processed by a worker, why wouldn&#x27;t a RDBMS with appropriate transactional logic be the best solution?
评论 #9210510 未加载
acolyer大约 10 年前
Credit for the questions is due to jacques_chester, not me! See <a href="https://news.ycombinator.com/item?id=8709146" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8709146</a>
turingbook大约 10 年前
&gt;a few months ago I saw a comment in Hacker News, written by Adrian Colyer...was commenting how different messaging systems have very different set of features, properties, and without the details it is almost impossible to evaluate the different choices, and to evaluate if one is faster than the other because it has a better implementation, or simple offers a lot less guarantees. So he wrote a set of questions one should ask when evaluating a messaging system.<p>I can not find the comment by @acolyer on HN. Who can help me?
评论 #9209943 未加载
caf大约 10 年前
I wonder what the point is in having &quot;best effort FIFO&quot;? If the application has to be able to deal with unordered messages anyway, you might as well not bother to try to maintain any kind of order.<p>It&#x27;s as well to be hung for a sheep as for a lamb.
评论 #9209748 未加载
评论 #9208913 未加载
mappu大约 10 年前
Ask HN: I&#x27;m in the market for a distributed message queue, for scheduling background tasks -<p>Does anything support &quot;regional&quot; priorities, where jobs are popped based on a combination of age + geographic&#x2F;latency factors?<p>Also, what are recommended solutions for distributing job injection? My job injection is basically solely dependent on time, and so i envisage one node (raft consensus?) determining all jobs to inject into the queue.<p>My queue volume is about 50 items&#x2F;sec and nodes will be up to 400ms apart.
评论 #9210225 未加载
isb大约 10 年前
This looks very cool. At-least once semantics are the way to go because most tasks require idempotence anyway and that helps in dealing with multiple delivery. Strict FIFO ordering is not always needed either as long as you avoid starvation - most of the time you need &quot;reliable&quot; deferred execution (&quot;durable threads&quot;).<p>I started prototyping something along these lines on top of riak (it is incomplete - missing leases etc but that should be straightforward to add): <a href="https://github.com/isbo/carousel" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;isbo&#x2F;carousel</a> It is a durable and loosely FIFO queue. It is AP because of Riak+CRDTs. It is a proof of concept - would be nice to build it on top of riak_core instead of as a client library.
jtchang大约 10 年前
When I first installed Redis years ago I was astounded at how easy it was to get up and running. Compare this to the plethora of message brokers out there: the vast majority you will spend the better half of the day trying to figure out how to configure the damn thing.<p>My overall impressions with message brokers is that RabbitMQ is a pain in the ass to setup, celery is my go to these days with beanstalkd being a close second if I don&#x27;t want too many of celery&#x27;s features.
评论 #9209833 未加载
评论 #9211284 未加载
评论 #9209671 未加载
评论 #9209452 未加载
评论 #9209991 未加载
sylvinus大约 10 年前
FYI, Salvatore will speak at dotScale in Paris about Disque on June 8: <a href="http://dotscale.io" rel="nofollow">http:&#x2F;&#x2F;dotscale.io</a>
rdoherty大约 10 年前
This has me excited for many reasons. Redis is amazingly powerful, robust and reliable piece of technology. Also I love reading antirez&#x27;s blog posts about the decisions behind Redis so I can&#x27;t wait to learn more about queueing systems from him when discussing Disque.
评论 #9208829 未加载
bcg1大约 10 年前
This looks like a good effort, congratulations.<p>Personally I&#x27;m torn on the usefulness of generic brokers for all circumstances... there are obvious advantages, but at the same time every messaging problem scales and evolves differently so a broker can quickly become just one more tail trying to wag the dog.<p>I am also interested in the architecture of tools like ZeroMQ and nanomsg, where they provide messaging &quot;primitives&quot; and patterns that can easily be used to compose larger systems, including having central brokers if that floats your boat.
jraedisch大约 10 年前
We recently switched from RabbitMQ to Redis queuing because we were not able to implement a well enough priority queue with highly irregular workloads. Prefetch would not work since 2 minute workloads would block all following messages. Timeout queues would somewhat rebalance msgs, but large blocks of messages would be queued at the same time and therefor be processed as large blocks. Now our workers are listening to 10 queues&#x2F;lists with different priorities with BRPOP and so far everything seems to work.
latch大约 10 年前
Unodered, in-memory queues shouldn&#x27;t be anyone&#x27;s goto solution. I think there&#x27;s a time and place for these, and having at-least-once delivery is a huge win over just using Redis, so I&#x27;m excited.<p>Still, unless you know exactly what you&#x27;re doing, you should pick a something with strong ordering guarantees and that won&#x27;t reject messages under memory pressure (although, rejecting new messages under memory pressure is A LOT easier&#x2F;better to handle than dropping old messages).
jpfr大约 10 年前
Some big project are currently making the switch to DDS-based pub&#x2F;sub. [1,2]<p>Now that everybody is making QoS guarantees in pub&#x2F;sub and message queues, is there a real difference to the 10 year old tech deployed in boats, trains and tanks?<p>[1] <a href="http://www.omg.org/spec/DDS/1.2/" rel="nofollow">http:&#x2F;&#x2F;www.omg.org&#x2F;spec&#x2F;DDS&#x2F;1.2&#x2F;</a><p>[2] <a href="http://design.ros2.org/articles/ros_on_dds.html" rel="nofollow">http:&#x2F;&#x2F;design.ros2.org&#x2F;articles&#x2F;ros_on_dds.html</a>
评论 #9210879 未加载
arunoda大约 10 年前
I think this has a lot of roots from NSQ. But, NSQ has no replication support.<p>I think built in replication is very nice to have. Would like to try once this arrives.
评论 #9209558 未加载
jacques_chester大约 10 年前
I wish to assure all and sundry that Adrian Colyer is not my secret crime-fighting identity, and vice versa :)
评论 #9210302 未加载
评论 #9210172 未加载
Lx1oG-AWb6h_ZG0大约 10 年前
Will there be any way to set up machine affinity? I think Azure Service Bus uses this mechanism (by specifying a partition key for a message) to enable strict FIFO for a given partition.
andrewstuart大约 10 年前
I didn&#x27;t see any mention of dead letter queues. Does it support dead letters? This is an extremely useful feature of Amazon SQS.
X-Istence大约 10 年前
This reminds me of a talk at SCALE13x about NATS: <a href="http://nats.io" rel="nofollow">http:&#x2F;&#x2F;nats.io</a><p>It&#x27;s fast and scaleable.
评论 #9209988 未加载
aaa667大约 10 年前
Is guaranteed at-most-once delivery impossible?
评论 #9210322 未加载
评论 #9212292 未加载
JohnLen大约 10 年前
How does zero MQ stand up
评论 #9209813 未加载
andrewstuart大约 10 年前
It would be nice to have a message queue system not built in Erlang or Java.
评论 #9214439 未加载
评论 #9209774 未加载
评论 #9209662 未加载