<div dir="ltr">Tsuraan,<br><br>I am using durable, non-auto-deleting queues and exchanges with persistent messages. I&#39;m using the Erlang client in network mode, and not using AMQP transactions. Every message that I basic.publish makes it to the queue, even if there is no consumer on the other side draining the queue. No messages are dropped. I have similar hardware to yours except my disks aren&#39;t as fast :)<br>
<br>Here are my exchange parameters:<br>:<br>ExchangeDeclare = #&#39;exchange.declare&#39;{ticket = Ticket, exchange = Exchange, type = &lt;&lt;&quot;direct&quot;&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; passive = false, durable = true, auto_delete = false, internal = false,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nowait = false, arguments = []}<br><br>Here are the queue declare parameters:<br><br>&nbsp;&nbsp;&nbsp; QueueDeclare = #&#39;queue.declare&#39;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ticket = Ticket,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; queue = Q,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; passive = false,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % This is a real creation request, not a status check<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; durable = true,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Messages must be persistent and survive server restart<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exclusive = false,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; auto_delete = false,&nbsp;&nbsp;&nbsp; % Don&#39;t auto-delete the queue when released by channel<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nowait = false,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Wait for a queue.declare_ok response from the server<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arguments = []},<br><br>And the queue bind:<br><br>#&#39;queue.bind&#39;{ticket = Ticket, queue = Q1, exchange = X,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; routing_key = Q1, nowait = false, arguments = []}<br><br>Here is the basic.publish setup:<br>
<br>#publish{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; routing_key = RoutingKey,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; queue = Q,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exchange = X,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bind_key = _BindKey, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; payload = Payload,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mandatory = false,&nbsp; % If true, server sends Return if msg unroutable, else silently drops msg<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; immediate = false &nbsp; % If true, server sends Return if msg cannot be delivered immediately, else queues msg<br>&nbsp;&nbsp;&nbsp; }<br><br>On a different topic, if you are expecting to queue millions of persistent messages to replace a filesystem-based queuing mechanism, you need to be aware that at present, RabbitMQ keeps all undelivered messages in memory. If they are persistent, then they are also saved on disk, but my understanding is that every message is also kept in memory. There is therefore a memory constraint and you can&#39;t just happily enqueue messages without draining the queues until the disk is full, without risking memory exhaustion and resultant Erlang node crash. I understand there are plans to implement an &quot;overflow to disk&quot; mechanism, but the ETA is unknown to me. Ben can say more about this.<br>
<br>Hope this helps.<br><br><div class="gmail_quote">On Mon, Sep 22, 2008 at 7:13 PM, tsuraan <span dir="ltr">&lt;<a href="mailto:tsuraan@gmail.com">tsuraan@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">&gt; So how do you know whether they&#39;re enqueued or not?<br>
<br>
</div>When the program&#39;s done running, I do a passive queue_declare, and the<br>
message count has increased by ~400 each time the program has run.<br>
It&#39;s actually more like 300 the first time and 500 the second time,<br>
but it seems like overall, I get about 400 per run.<br>
<div class="Ih2E3d"><br>
&gt;&gt; Is there a way that I can tell whether the message I sent was dropped<br>
&gt;&gt; by the server?<br>
&gt;<br>
&gt; You can run rabbit_amqqueue:stat_all() in the shell.<br>
<br>
</div>Ok, so there isn&#39;t a return code from basic_publish that will tell me<br>
it was dropped?<br>
<div class="Ih2E3d"><br>
&gt; That shouldn&#39;t take a minute even with a TX per message and logging to disk.<br>
&gt;<br>
&gt; I think something may not be quite right with your setup.<br>
<br>
</div>I&#39;d be willing to believe that. &nbsp;When running with one transaction per<br>
message, my system is almost idle. &nbsp;python&#39;s taking 2-3% of the cpu,<br>
beam.smp is taking less than that, and my IO is a few KB/s. &nbsp;Do you<br>
have any advice for figuring out what&#39;s going on? &nbsp;My system is a<br>
core2 duo with a pair of raptor10k drives in RAID1 on a 3ware 9650; I<br>
shouldn&#39;t be too starved for cpu, io, or memory with this setup, so<br>
any advice for where to start would be much appreciated.<br>
<div class="Ih2E3d"><br>
&gt; Either with a transaction or by setting up a return handler (and<br>
&gt; setting the mandatory flag).<br>
&gt;<br>
&gt; BTW, when I run this code:<br>
&gt;<br>
&gt; #!/usr/bin/python2.5<br>
&gt;<br>
&gt; import sys<br>
&gt; from time import time<br>
&gt; import amqplib.client_0_8 as A<br>
&gt;<br>
&gt; q = &quot;q-%d&quot; % int(time())<br>
&gt;<br>
&gt; conn = A.Connection(&quot;<a href="http://127.0.0.1" target="_blank">127.0.0.1</a>&quot;, &quot;guest&quot;, &quot;guest&quot;)<br>
&gt; chan = conn.channel()<br>
&gt;<br>
&gt; chan.queue_declare(queue=q, auto_delete=True, durable=False)<br>
&gt;<br>
&gt; for i in range(1000):<br>
&gt; &nbsp; &nbsp;print i<br>
&gt; &nbsp; &nbsp;m = A.Message(str(i), delivery_mode=1)<br>
&gt; &nbsp; &nbsp;print chan.basic_publish(m, &quot;&quot;, q, mandatory=True, immediate=False)<br>
&gt;<br>
&gt; and then in the shell<br>
&gt;<br>
&gt; rabbit@xlr8)3&gt; rabbit_amqqueue:stat_all().<br>
&gt; [{ok,{resource,&lt;&lt;&quot;/&quot;&gt;&gt;,queue,&lt;&lt;&quot;q-1222121318&quot;&gt;&gt;},1000,0}]<br>
&gt;<br>
&gt; which would indicate that 1000 messages got enqueued.<br>
<br>
</div>Is the difference then that my queues are persistent? &nbsp;I&#39;m using a<br>
topic exchange with just one persistent, non-autodelete queue. &nbsp;Does<br>
that change things?<br>
<div class="Ih2E3d"><br>
&gt; And maybe this is a stupid question, but why are you enqueuing stuff?<br>
&gt; Don&#39;t you want it to be delivered?<br>
<br>
</div>Isn&#39;t enqueuing a necessary step before delivery? &nbsp;The system I&#39;m<br>
working on processes a lot of files, and as files are processed new<br>
files or database rows are created that have to be processed<br>
downstream. &nbsp;Sometimes the programs doing the processing get hung up<br>
on invalid data, or get flooded with more data than they can process<br>
in a timely manner, so the workloads get really badly backed up. &nbsp;I&#39;ve<br>
seen programs that have millions of tasks in their job queues more<br>
than a few times.<br>
<br>
We currently have a &quot;message queue&quot; system that is just files written<br>
to the hard drive; different directories are the job queues for<br>
different actors, and the files in them are just identifiers for<br>
database or file-based workloads. &nbsp;I want to replace that with real<br>
message queue system for all sorts of reasons, so I&#39;m just<br>
experimenting with RabbitMQ to see if it does what I need, and to see<br>
how good the performance and stability are.<br>
<div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br>
</div></div></blockquote></div><br></div>