Massimo Paladin | 6 Aug 14:11
Picon
Picon

RabbitMQ and Stomp topic behavior

Hello,


I am doing some testing with RabbitMQ and Stomp.
I am using stomp-benchmark to run the scenario attached to this email.

It is producing small messages at highest rate possible on a topic on a RabbitMQ server, the topic does not have any consumer attached.
I can be run with such a command:
sbt run --host host --login guest --passcode guest --port 61613  --scenario-file custom.xml /tmp/rabbitmq_topic

I am running rabbitmq-server on a 16GB memory machine and 8GB swap with watermark level of 0.5 (7.8GB watermark)
Memory level output from the web interface reach values > 20GB.
Why does the memory goes up if there are no consumers attached to the topic?
Messages are supposed to be discarded straight away.

Regards,
Attachment (rabbitmq_topic.xml): text/xml, 1113 bytes
Massimo Paladin | 7 Aug 21:52
Picon
Picon

Re: RabbitMQ and Stomp topic behavior

Some details.


I am using rabbitmq 2.5.1 on a rhel based os with erlang R14B-02.

For stomp-benchmark details look at: https://github.com/chirino/stomp-benchmark

The scenario provided makes memory increasing and if you let it run for some time at some point rabbitmq crashes because it can not allocate memory.
If you are interested I kept the crash dumps.

Regards,
---
Massimo Paladin

email: massimo.paladin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
website: http://www.mpaladin.com
flickr's page: http://flickr.com/photos/massimop


On Sat, Aug 6, 2011 at 2:11 PM, Massimo Paladin <Massimo.Paladin-vJEk5272eHo@public.gmane.org> wrote:
Hello,

I am doing some testing with RabbitMQ and Stomp.
I am using stomp-benchmark to run the scenario attached to this email.

It is producing small messages at highest rate possible on a topic on a RabbitMQ server, the topic does not have any consumer attached.
I can be run with such a command:
sbt run --host host --login guest --passcode guest --port 61613  --scenario-file custom.xml /tmp/rabbitmq_topic

I am running rabbitmq-server on a 16GB memory machine and 8GB swap with watermark level of 0.5 (7.8GB watermark)
Memory level output from the web interface reach values > 20GB.
Why does the memory goes up if there are no consumers attached to the topic?
Messages are supposed to be discarded straight away.

Regards,

Matthias Radestock | 8 Aug 17:06
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,

On 07/08/11 20:52, Massimo Paladin wrote:
> Why does the memory goes up if there are no consumers attached to the topic?

Messages are processed in a fully asynchronous pipeline, and the 
decision on whether to discard a message is made at a later stage.

Having this pipeline allows rabbit to absorb spikes in message load, 
i.e. it can read messages off the socket quickly and pass them to the 
next stage of the pipeline.

However, if the load is not a spike and instead is consistently high 
then obviously rabbit will run out of memory eventually. To prevent 
that, memory usage is monitored and producers are temporarily blocked to 
relieve memory pressure. So...

> The scenario provided makes memory increasing and if you let it run for
> some time at some point rabbitmq crashes because it can not allocate memory.

That shouldn't happen. Do you get any memory alarms in the rabbit logs? 
Also, does Rabbit run out of memory with the default threshold of 0.4?

Regards,

Matthias.
Massimo Paladin | 8 Aug 17:19
Picon
Picon

Re: RabbitMQ and Stomp topic behavior

I tried in two machines, in one I had 0.5, in the other I did not set it which means the default is 0.4.


They both crashed and I get many memory alarms and clears in the log.

The memory goes up and down through the test, and soon or later it fills both memory and swap until it gets to crash.

Cheers,
---
Massimo Paladin

email: massimo.paladin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
website: http://www.mpaladin.com
flickr's page: http://flickr.com/photos/massimop


On Mon, Aug 8, 2011 at 5:06 PM, Matthias Radestock <matthias-mQ7lE4MOPXtWk0Htik3J/w@public.gmane.org> wrote:
Massimo,


On 07/08/11 20:52, Massimo Paladin wrote:
Why does the memory goes up if there are no consumers attached to the topic?

Messages are processed in a fully asynchronous pipeline, and the decision on whether to discard a message is made at a later stage.

Having this pipeline allows rabbit to absorb spikes in message load, i.e. it can read messages off the socket quickly and pass them to the next stage of the pipeline.

However, if the load is not a spike and instead is consistently high then obviously rabbit will run out of memory eventually. To prevent that, memory usage is monitored and producers are temporarily blocked to relieve memory pressure. So...


The scenario provided makes memory increasing and if you let it run for
some time at some point rabbitmq crashes because it can not allocate memory.

That shouldn't happen. Do you get any memory alarms in the rabbit logs? Also, does Rabbit run out of memory with the default threshold of 0.4?

Regards,

Matthias.

Matthias Radestock | 8 Aug 17:23
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,

On 08/08/11 16:19, Massimo Paladin wrote:
> I tried in two machines, in one I had 0.5, in the other I did not set it
> which means the default is 0.4.
>
> They both crashed and I get many memory alarms and clears in the log.
>
> The memory goes up and down through the test, and soon or later it fills
> both memory and swap until it gets to crash.

Interesting. To rule out one possibility, please repeat the test with 
the 0.4 setting *and without the management plug-in (or any other 
plug-ins except those needed for stomp)*.

Regards,

Matthias.
Matthias Radestock | 8 Aug 17:43
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,

On 08/08/11 16:23, Matthias Radestock wrote:
> To rule out one possibility, please repeat the test with
> the 0.4 setting *and without the management plug-in (or any other
> plug-ins except those needed for stomp)*.

One more thing...It would also be helpful if you sent us the report 
produced by
   rabbitmqctl report > rabbit_report.txt
when the broker is getting close to running out of memory.

(the 'report' command only exists in rabbit >= 2.5.0).

Regards,

Matthias.
Massimo Paladin | 9 Aug 09:39
Picon
Picon

Re: RabbitMQ and Stomp topic behavior

It crashed also with only stomp and amqp_client plugins.


Attached you can find the latest report I got in one run and a crash dump.

The configuration is minimal:
[
    {rabbit, [
        {default_vhost, <<"rabbitmq">>},
        {default_user, <<"guest">>},
        {default_pass, <<"guest">>},
        {default_permissions, [<<".*">>, <<".*">>, <<".*">>]},
        {tcp_listeners, []}
    ]},
    {rabbitmq_stomp, [
        {tcp_listeners, [61223]}
    ]}
].

Cheers,
---
Massimo Paladin

email: massimo.paladin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
website: http://www.mpaladin.com
flickr's page: http://flickr.com/photos/massimop


On Mon, Aug 8, 2011 at 5:43 PM, Matthias Radestock <matthias-mQ7lE4MOPXtWk0Htik3J/w@public.gmane.org> wrote:
Massimo,


On 08/08/11 16:23, Matthias Radestock wrote:
To rule out one possibility, please repeat the test with
the 0.4 setting *and without the management plug-in (or any other
plug-ins except those needed for stomp)*.

One more thing...It would also be helpful if you sent us the report produced by
 rabbitmqctl report > rabbit_report.txt
when the broker is getting close to running out of memory.

(the 'report' command only exists in rabbit >= 2.5.0).

Regards,

Matthias.

Matthias Radestock | 9 Aug 10:08
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,

On 09/08/11 08:39, Massimo Paladin wrote:
> It crashed also with only stomp and amqp_client plugins.
>
> Attached you can find the latest report I got in one run and a crash dump.

According to the crash dump, rabbit is failing to allocate 6.9G when it 
already has 5.8G, giving a total of 12.7G. You said your machine has 
16GB of RAM and 8GB of swap, so growing a process to 12.7G shouldn't be 
a problem. What memory threshold does rabbit report in its logs? And do 
you have other programs running that consume a large amount of memory? 
Check with 'ps auxw --sort vsz'.

Regards,

Matthias.
Massimo Paladin | 9 Aug 10:38
Picon
Picon

Re: RabbitMQ and Stomp topic behavior

This report and dump is related to another machine which has 8GB of memory and 4GB of swap.


Do you also want a crash of the other machine?

Cheers,
---
Massimo Paladin

email: massimo.paladin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
website: http://www.mpaladin.com
flickr's page: http://flickr.com/photos/massimop


On Tue, Aug 9, 2011 at 10:08 AM, Matthias Radestock <matthias-mQ7lE4MOPXtWk0Htik3J/w@public.gmane.org> wrote:
Massimo,


On 09/08/11 08:39, Massimo Paladin wrote:
It crashed also with only stomp and amqp_client plugins.

Attached you can find the latest report I got in one run and a crash dump.

According to the crash dump, rabbit is failing to allocate 6.9G when it already has 5.8G, giving a total of 12.7G. You said your machine has 16GB of RAM and 8GB of swap, so growing a process to 12.7G shouldn't be a problem. What memory threshold does rabbit report in its logs? And do you have other programs running that consume a large amount of memory? Check with 'ps auxw --sort vsz'.

Regards,

Matthias.

Matthias Radestock | 9 Aug 10:41
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,

On 09/08/11 09:38, Massimo Paladin wrote:
> This report and dump is related to another machine which has 8GB of
> memory and 4GB of swap.

Ah ok. Would be good to see the rabbit.log file.

> Do you also want a crash of the other machine?

I don't think that's necessary. Having it fail in one place is good/bad 
enough.

Matthias.
Massimo Paladin | 9 Aug 10:47
Picon
Picon

Re: RabbitMQ and Stomp topic behavior

All log files attached.


Cheers,
---
Massimo Paladin

email: massimo.paladin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
website: http://www.mpaladin.com
flickr's page: http://flickr.com/photos/massimop


On Tue, Aug 9, 2011 at 10:41 AM, Matthias Radestock <matthias-mQ7lE4MOPXtWk0Htik3J/w@public.gmane.org> wrote:
Massimo,


On 09/08/11 09:38, Massimo Paladin wrote:
This report and dump is related to another machine which has 8GB of
memory and 4GB of swap.

Ah ok. Would be good to see the rabbit.log file.


Do you also want a crash of the other machine?

I don't think that's necessary. Having it fail in one place is good/bad enough.


Matthias.

Attachment (20110809_rabbitmq_log.tgz): application/x-gzip, 1816 bytes
Steve Powell | 10 Aug 18:59
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,
I'm attempting to reproduce your sbt results on a Linux VM. Please can you send me your sbt configuration, and any other setup files you have in your sbt project?

Thank you.
Steve Powell  (a hippy bunny)
----------some definitions from the SPD----------
Rigatoni n. A prime-ministerial grin.
Nigella n. The next bottle-size up from a Nebuchadnezzar.
Homily adv. Rather like a frenchman.

On 9 Aug 2011, at 09:47, Massimo Paladin wrote:
http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-August/014404.html
Massimo Paladin | 10 Aug 23:10
Picon
Picon

Re: RabbitMQ and Stomp topic behavior

Hi Steve,


I do not have any special sbt configuration.
I just setup stomp-benchmark as it is described in the web page.
Then I run the scenario file I attached to the first email of the discussion with the command line specified.

Do you need more?

Regards,
---
Massimo Paladin

email: massimo.paladin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
website: http://www.mpaladin.com
flickr's page: http://flickr.com/photos/massimop


On Wed, Aug 10, 2011 at 6:59 PM, Steve Powell <steve <at> rabbitmq.com> wrote:
Massimo,
I'm attempting to reproduce your sbt results on a Linux VM. Please can you send me your sbt configuration, and any other setup files you have in your sbt project?

Thank you.
Steve Powell  (a hippy bunny)
----------some definitions from the SPD----------
Rigatoni n. A prime-ministerial grin.
Nigella n. The next bottle-size up from a Nebuchadnezzar.
Homily adv. Rather like a frenchman.

On 9 Aug 2011, at 09:47, Massimo Paladin wrote:
http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-August/014404.html

Steve Powell | 15 Aug 18:37
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,

I've had no luck(!) trying to get the stomp-benchmark to run. (Tried several machines/downloads) but it appears to be stuck for me.  I'll attempt to get the scenario to run on my Mac (desktop), where I appear to have an (older) running sbt/stomp-benchmark, and get back to you, but I have far less control over the memory requirements unless I'm in a virtual machine.

I'll get back to you soon.
Steve Powell  (a happy bunny)
----------some definitions from the SPD----------
Rigatoni n. A prime-ministerial grin.
Nigella n. The next bottle-size up from a Nebuchadnezzar.
Homily adv. Rather like a frenchman.

On 10 Aug 2011, at 22:10, Massimo Paladin wrote:

http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-August/014485.html

Steve Powell | 16 Aug 12:04
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,
I got a response from stomp-benchmark on github; apparently the sbt moved to xsbt github is not compatible with the benchmark, so I managed to get a 0.7.7 version which apparently works.  now running your scenario with your configuration, against rabbitmq 2.5.1.

Minor changes, --host localhost --port 61223 are compatible with your scenario, I believe.

Currently monitoring memory during run (at 1Gb in a 2Gb mem machine); will get back to you here.
[wrk: +44-2380-111-528] [mob: +44-7815-838-558]


Steve Powell | 16 Aug 17:09
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,
I've run the scenario on my 2-core 2Gb Ubuntu 32-bit VM (final changes, I removed vhost (default <<"/">>) from the config file).

The benchmark runs for about two lines of dots and then the rabbitmq_server gets a segmentation fault! and terminates.  The benchmark doesn't notice and ploughs on regardless.  Disappointingly I found no log information to explain the failure.

I added {vm_memory_high_watermark, 0.1} to the configuration, and switched the log file output to a local directory, and the benchmark and running broker (and benchmark) seem to continue fairly stably for ever!!  (I'm assuming the benchmark has no termination coded, it didn't seem to stop by itself, so I interrupt it after about half an hour.)

I notice several things:
  • rabbitmq_server process runs at full CPU (200% in my virtual machine) most of the time, with occasional lapses to 0 (zero), when the benchmark and the server appear to pause for breath.
  • the virtual memory requirements for rabbitmq_server seem to be below 0.5Gb, most of the time, but occasionally creep up to 0.7 or 0.8Gb, and then drop to about 0.2Gb.  By comparison, the java stomp-benchmark process runs at 723Mb all the time.
  • the memory (as opposed to virtual memory) requirements for rabbit_server appear to run between 0.54 to 0.75 of the virtual requirements.
I suspect that, when set to 0.4 (the default vm_memory_high_watermark ratio) the vMem occasionally creeps above the maximum allowed on this machine, which is about 1.6/1.7Gb, and that's when we get the segmentation fault.  This is worth investigation.  Also the CPU glitches look interesting; this may be throttling, or some sort of Erlang process garbage collection of which I am ignorant.

So where are the benchmark results put?  I see nothing produced (save a truncated rabbitmq_topic file) when I interrupt it.  Is this another problem with my sbt/workbench setup?

Steve Powell  (a happy bunny)
----------some definitions from the SPD----------
Rigatoni n. A prime-ministerial grin.
Nigella n. The next bottle-size up from a Nebuchadnezzar.
Homily adv. Rather like a frenchman.

On 16 Aug 2011, at 11:04, Steve Powell wrote:

Massimo,
I got a response from stomp-benchmark on github; apparently the sbt moved to xsbt github is not compatible with the benchmark, so I managed to get a 0.7.7 version which apparently works.  now running your scenario with your configuration, against rabbitmq 2.5.1.

Minor changes, --host localhost --port 61223 are compatible with your scenario, I believe.

Currently monitoring memory during run (at 1Gb in a 2Gb mem machine); will get back to you here.
[wrk: +44-2380-111-528] [mob: +44-7815-838-558]


_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss <at> lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Steve Powell | 18 Sep 14:56
Favicon

Re: RabbitMQ and Stomp topic behavior

Massimo,
After quite a  time of trials and tribulations I have found a bug 
in the RabbitMQ STOMP adapter which appears to cause 
crashes under high message load.
    The bug is related to the (rather primitive) throttling which 
kicks in when reaching the memory limit.

After fixing this, I have successfully run your testcase, and 
RabbitMQ STOMP does manage to survive during the throwing 
away of large numbers of unsubscribed topic SENDs. I had to 
make one alteration to the configuration in order to get the test 
to stay up. I set the vm_high_watermark to 0.2 (instead of the 
default of 0.4).

This setting determines the proportion of available memory 
above which the 'memory-alarm' is triggered. The reader 
process in RabbitMQ-STOMP will then block processing 
further bytes from clients, until the memory alarm is switched 
off.  Because message processing is proceeding at a very 
high rate (that is why memory is being used up), the 
input-queues for Erlang processes are likely to be large, 
and so even blocking input will not result in a lowering of 
memory consumption -- memory requirements increase in 
the pipeline flow -- and so the actual memory consumed is 
likely to reach 0.6/0.7 of available memory (found by observation).  
This is why setting it to 0.4 (the default) doesn't work.  Memory 
for Erlang can then be completely exhausted, resulting in 
crashes (which normally result in long pauses and large 
amounts of dump-data written to disk). Any recovery after 
that is likely not to succeed for very long, since the pause 
allows time for more requests to be put in. (The benchmark 
test runs with non-blocking io; I'm not sure what that means, 
but if it means that requests will be put in even if the socket 
blocks then this is going to increase the load during the 
pauses.)

As I say, setting it to 0.2 worked, and I suspect that 0.3 would 
still work.

However,...

The test doesn't really tell us much.  This is a poor benchmark, 
because it consists of a single producer sending a 20-byte 
message to a topic to which no-one is currently subscribed.  
This is therefore a measure of how fast a broker can throw 
away messages.  RabbitMQ does reasonably well here, but 
cannot determine that there are no subscribers until it reaches 
the actual rabbit exchange, so it goes through AMQP 
processing.  In general, especially in the presence of potential 
durable topic subscriptions, it is hard to see how to fix this -- 
though if it were a common scenario perhaps some sort of 
status of the broker subscription space could be cached near 
to the client, allowing us to throw away messages close to 
the client: but then we need to update the cache when 
(remote) subscribers come on line, or risk throwing away 
messages in error.  This is very complex, and only for a gain 
in a low probability use-case.

I notice that the benchmark test runs for a very long time 
(hours on my little 2Gb 2Core Linux VM) and produces a noisy 
graph as result (there are lots of zeros in it because RabbitMQ 
blocks reads quite often). The graph doesn't help us to guess 
at an average rate.  I attach the benchmark json output, so 
you can view it with generic_report, or something.

The bug fix is rabbit bugzilla 24426, which after QA will 
probably go into the next release.

Thanks for spotting this,

Steve Powell
steve@...
[wrk: +44-2380-111-528] [mob: +44-7815-838-558]

Previously:
>>> http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-August/014555.html
>> 
>> _______________________________________________
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss@...
>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> 
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss@...
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


Gmane