RabbitMq (3.5.4) High Cpu Usage when Client is started on Server.

573 views
Skip to first unread message

Micheal Pike

unread,
Aug 14, 2015, 8:29:15 AM8/14/15
to rabbitmq-users
Hi,

I have a Subscriber that is installed as a windows service on the same server as RabbitMq is installed.  Before starting the windows service, the erl process is taking up about 6% cpu.  However, after I start the windows service, the erl process jumps to and stays at 65% and the windows service stays at around 14% cpu utilization which means that between the two processes the cpu utilization stays around approx 70% - and this is only one consumer!  If I restart RabbitMq the cpu utilization proceeds back to the approximate 65% cpu utilization.  

If I move the client windows service to another server and start the service the RabbitMq on the original server never moves above 6% cpu utilization and the windows service never moves above .1% utilization at idle.  When messages are received these values rise momentarily but stay within acceptable ranges and then fall back to the idle percentages - this works nicely!  But I cannot use this configuration :(

Due to hardware restrictions at my company, they are requiring me to run the RabbitMq server and queue consumers on the same server.  Is this a bad setup or am I doing something wrong?

My client code looks exactly like the tutorial example code except I have moved the code from a console app to a windows service.  Which means my client code looks like this:

        var factory = new ConnectionFactory() { HostName = _queueServer };
        using (var connection = factory.CreateConnection())
        {
            using (var channel = connection.CreateModel())
            {
                channel.QueueDeclare(_queueName, false, false, false, null);

                var consumer = new EventingBasicConsumer(channel);
                consumer.Received += (model, ea) =>
                {
                    var body = ea.Body;
                    var message = Encoding.UTF8.GetString(body);
                    QueueReceivedMessageEvent(message);
                };
                channel.BasicConsume(queue: _queueName, noAck: true, consumer: consumer);
            }
        }

Thanks for your help in advance!

Michael Klishin

unread,
Aug 14, 2015, 8:43:59 AM8/14/15
to rabbitm...@googlegroups.com, Micheal Pike
On 14 August 2015 at 15:29:18, Micheal Pike (mpik...@gmail.com) wrote:
> I have a Subscriber that is installed as a windows service on
> the same server as RabbitMq is installed. Before starting the
> windows service, the erl process is taking up about 6% cpu. However,
> after I start the windows service, the erl process jumps to and
> stays at 65% and the windows service stays at around 14% cpu utilization
> which means that between the two processes the cpu utilization
> stays around approx 70% - and this is only one consumer! If I restart
> RabbitMq the cpu utilization proceeds back to the approximate
> 65% cpu utilization.
>
> If I move the client windows service to another server and start
> the service the RabbitMq on the original server never moves above
> 6% cpu utilization and the windows service never moves above
> .1% utilization at idle.

What kind of workload do you run? Is the consumer completely idle? (I doubt it is)

RabbitMQ's runtime on Windows does not support kernel polling (I/O completion ports in Windows
speak), so it's not a platform to run on if you are looking for efficiency.

My guess is that your consumer maxes out a single queue on a 2 core machine,
so both processes consume about 60% of the CPU capacity total. 
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Micheal Pike

unread,
Aug 14, 2015, 9:04:17 AM8/14/15
to rabbitmq-users
The high cpu utilization starts when the consumer starts.  The process which puts messages into the queue hasn't been started.  This means that both the erl and windows service should start up and be idle; however, they ramp up to high cpu utilization on start up.  Please see attached file.
cpuutil.jpg
Reply all
Reply to author
Forward
0 new messages