TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Alchemy Micro-Service Framework: Using RabbitMQ Instead of HTTP

149 pointsby grahar64about 9 years ago

13 comments

atombenderabout 9 years ago
As someone who has used RabbitMQ in production for many years, you should rather consider using NATS [1] for RPC.<p>RabbitMQ&#x27;s high availability support is, frankly, terrible [2]. It&#x27;s a single point of failure no matter how you turn it, because it cannot merge conflicting queues that result from a split-brain situation. Partitions can happen not just on network outage, but also in high-load situations.<p>NATS is also a <i>lot</i> faster [3], and its client network protocol is so simple that you can implement a client in a couple hundred lines in any language. Compare to AMQP, which is complex, often implemented wrong, and requires a lot of setup (at the very least: declare exchanges, declare queues, then bind them) on the client side. NATS does topic-based pub&#x2F;sub out of the box, no schema required.<p>(Re performance, relying on ACK&#x2F;NACK with RPC is a bad idea. The better solution is to move retrying into the client side and rely on timeouts, and of course error replies.)<p>RabbitMQ is one of the better message queue implementations for scenarios where you need the bigger features it provides: durability (on-disk persistence), transactions, cross-data center replication (shovel&#x2F;federation plugins), hierarchical topologies and so on.<p>[1] <a href="http:&#x2F;&#x2F;nats.io" rel="nofollow">http:&#x2F;&#x2F;nats.io</a><p>[2] <a href="https:&#x2F;&#x2F;aphyr.com&#x2F;posts&#x2F;315-jepsen-rabbitmq" rel="nofollow">https:&#x2F;&#x2F;aphyr.com&#x2F;posts&#x2F;315-jepsen-rabbitmq</a><p>[3] <a href="http:&#x2F;&#x2F;bravenewgeek.com&#x2F;dissecting-message-queues&#x2F;" rel="nofollow">http:&#x2F;&#x2F;bravenewgeek.com&#x2F;dissecting-message-queues&#x2F;</a>
评论 #11286105 未加载
评论 #11287503 未加载
评论 #11285011 未加载
评论 #11284939 未加载
评论 #11285333 未加载
评论 #11286967 未加载
评论 #11287932 未加载
评论 #11284920 未加载
评论 #11288081 未加载
olivemonkeyabout 9 years ago
IMO this is an emerging anti pattern to use Rabbit to connect &quot;microservices&quot;. It often introduces a single point of failure to your &quot;distributed&quot; system and has problems with network partitions. If critical functionality stops working when Rabbit is down, you&#x27;re probably doing it wrong.
评论 #11285454 未加载
评论 #11284821 未加载
评论 #11284949 未加载
评论 #11284926 未加载
edddabout 9 years ago
Looks pretty cool, but doing RPC over RMQ is quite expensive. I would rather see good abstractions over ZMQ - that would be really cool.<p>Also as many people here pointed out, RMQ is a single point of failure which might be acceptable for some cases. To me, the problem is that by design this architecture has a bottleneck which is really hard to get rid off.
mugsieabout 9 years ago
OpenStack has had this as a common design pattern across a lot of the services for a while.<p>It works quite well for us now - there was a period 2-3 years ago where rabbitmq was the bane of my existence, and the cause of many a page but newer versions have been fine.<p>We do assume that everything in the queue can go away, and only in flight calls will fail - and (at least in the service I work on) we do retries if something falls through the cracks.<p>There is a shared library we use for it - <a href="http:&#x2F;&#x2F;docs.openstack.org&#x2F;developer&#x2F;oslo.messaging&#x2F;" rel="nofollow">http:&#x2F;&#x2F;docs.openstack.org&#x2F;developer&#x2F;oslo.messaging&#x2F;</a><p>It also has drivers for ZMQ, and QPID afaik.
评论 #11286675 未加载
eeZiabout 9 years ago
How does this compare to Autobahn &#x2F; crossbar.io?<p><a href="http:&#x2F;&#x2F;autobahn.ws&#x2F;" rel="nofollow">http:&#x2F;&#x2F;autobahn.ws&#x2F;</a><p><a href="http:&#x2F;&#x2F;crossbar.io&#x2F;" rel="nofollow">http:&#x2F;&#x2F;crossbar.io&#x2F;</a><p>I really like the service discovery in Crossbar (&quot;routed RPC&quot;).
评论 #11285416 未加载
nitrogenabout 9 years ago
This looks cool. I wrote a less developed than this and unreleased RabbitMQ-based microframework that combines RPC and one-way event streams to integrate an ecommerce site in one datacenter with a back office in another. At another company I used ZeroMQ to make a job processing cluster.<p>Comments by others suggesting the use of http are kind of missing the point of message queues. The latency added by http(s) made interactive RPC sluggish, and made batch back office updates take hours instead of minutes with AMQP.<p>If I had Alchemy two years ago I might have used this instead of rolling my own.
kitwalker12about 9 years ago
this is helpful. we already use rabbitmq for our golang services. This would ease the task of setting up publishers and subscribers in the node APIs we&#x27;re building.
ajmurmannabout 9 years ago
I&#x27;ve been working on something similar but decided to go with Kafka as the message bus because I want the messages to persist. This allows for more error recovery solutions and auditing. Still having all that data around also allows me to come up with new ideas to use that days after the fact.
jhggabout 9 years ago
I feel like this is a bit silly. Feel like one could just speak HTTP or Thrift, and use etcd or zookeeper for discovery. RabbitMQ just complicates the stack. Also, it&#x27;s HA options are generally... disappointing.
sunnyaabout 9 years ago
Check out <a href="http:&#x2F;&#x2F;restbus.org" rel="nofollow">http:&#x2F;&#x2F;restbus.org</a> , a similar project for .NET.
swangabout 9 years ago
What are you using for general load balancing&#x2F;availability? A consistent hashring?
评论 #11285427 未加载
philip142auabout 9 years ago
Use AKKA
jorgecurioabout 9 years ago
as someone who&#x27;s used RabbitMQ in a SaaS app to run millions of tasks, heed my warning, RabbitMQ is great if you are low on memory but the overhead was too much to deal with. Celery also contributed to this but if I could travel back in time, I would stop myself from using RabbitMQ. Instead, Redis is a much better alternative for micro-service.
评论 #11287615 未加载