Posts Tagged rabbitmq

spring amqp tuning

It looked like the spring amqp listenerr wass about 4x slower than a simple client!

sending messages 100000 messages
sent messages
13:{"spring":{"bytes":91479,"messages":4450,"rate":342},"raw":{"bytes":2188890,"messages":100000,"rate":7692}}
23:{"spring":{"bytes":808060,"messages":37236,"rate":1618},"raw":{"bytes":2188890,"messages":100000,"rate":7692}}
34:{"spring":{"bytes":1559932,"messages":71411,"rate":2100},"raw":{"bytes":2188890,"messages":100000,"rate":7692}}
44:{"spring":{"bytes":2188890,"messages":100000,"rate":2380},"raw":{"bytes":2188890,"messages":100000,"rate":7692}}

That’s spring: 2380/s versus raw 7692/s

The amqp SimpleMessageListenerContainer versus a simplistic client with com.rabbitmq.client.QueueingConsumer using com.rabbitmq.client.Channel.basicConsume

Using spring-integration-amqp 2.2.1.RELEASE and rabbitmq amqp-client 3.0.2

I randomly bumped up some settings like so:

<rabbit:listener-container 
    connection-factory="rabbitConnectionFactory" 
    prefetch="500" 
    transaction-size="250"
>

This brought things much more in bounds:

20:{"spring":{"bytes":2188890,"messages":100000,"rate":6250},"raw":{"bytes":2188890,"messages":100000,"rate":7142}}

That’s spring: 6250/s versus raw 7142/s, which is much more reasonable.

CAVEAT: I tried turning up “concurrency” from 1 to 2 and some messages went missing… so… dunna do it!

Leave a Comment

fun with nodejs and rabbitmq

The long awaited server side javascript revolutions is alive and well!

Here is a quickstart for funning around with nodejs and rabbitmq

The copy-pasta is from my retro machine at the house running ubuntu 10 (Maverick), but there’s little ubuntu specific stuff…

install nodejs

 % git clone https://github.com/joyent/node.git
 % cd node
 % sudo apt-get install g++ libssl-dev
 % ./configure && make && sudo make install
 % echo 'console.log( "go node!" )'  | node

install npm

As per the website, you can run the install script from curl.

Oddly enuff, to avoid running it as root, buddy suggests making your user own all of /usr/local.

Instead, I thought I’d add an npm user and setuid the npm stuff:

 % sudo adduser --gid 0 npm
 % sudo chmod g+w /usr/local/lib 
 % sudo chmod g+w /usr/local/share/man 
 % sudo chmod g+w /usr/local/bin 
 % sudo chmod g+w /usr/local/man/man1
 % sudo su npm
 % cd /tmp
 % git clone https://github.com/isaacs/npm.git
 % cd npm
 % ./configure
 % make && make install 
I tried setting 4755 on /usr/local/lib/node_modules/npm/bin/npm.js, but it complains when I tried to install some stuff..

Just have to use the npm user to install node-amqp:

 % sudo su npm -c "npm install -g amqp"
 % cd 
 % ln -s /usr/local/lib/node_modules

install rabbitmq

The out of the box rabbit for ubu10 was ancient bullshit!

The rabbitmq guys have some tips… basically:

 % echo deb http://www.rabbitmq.com/debian/ testing main | sudo tee -a /etc/apt/sources.list
 % wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
 % sudo apt-key add rabbitmq-signing-key-public.asc
 % sudo apt-get update
 % sudo apt-get install rabbitmq-server

It gets cranked up at install and there is a handy init script:

 % sudo /etc/init.d/rabbitmq-server status

a simple demo

So… this code runs fine on my mac, but is weirdly busted on my olde ubuntu box:

clear ; ./amqp-dee-dum.js
connected
ready
got the exchange
[hilarity ensues: try it out!]

I had to create new exchange named ‘tmp’, it wouldn’t let me use ‘amq.direct’ for some reason…

Anyhooo…

I think the code is pretty ez to follow if sorta copy-pasta heavy.

I hope to do a refactored version at some point…

what happened with the old rabbit

connected
ouch: Oversized frame 1342243080
cya!
FATAL ERROR: v8::Object::SetIndexedPropertiesToExternalArrayData() length exceeds max acceptable value

Using the non-crusty version everything worked fine.

Comments (2)