hxamqp: AMQP with haxe!

Posted on December 15, 2008. Filed under: Uncategorized | Tags: , , , , , |

It’s been a while since my last post, but the wait has been worthwhile. I’ve been working on converting Ben Hood’s amqp library for as3 with my converter. It’s been an educational experience on a couple of fronts getting more familiar with the issues of conversion from as3 to haxe, AMQP/RabbitMQ, and flash vs neko io issues.

The resulting library, hxampq, is up on github with a couple examples to experiment with.

While working on this I ran into issues with trying to map a flash lib to neko. Flash only has asychronous IO, while Neko is synchronous IO only. In my examples I create a thread to deal with the socket data and pass messages back and with neko’s Thread and Deque API.

In my tests, I ran into a latency issue with RabbitMQ. I was trying to send an empty message from a swf, to rabbit, then read that message from a neko server, send a message back to rabbit on another q, and have the swf read it. The resulting “roundtrip” time was measured over thousands of samples. I was getting terrible times anywhere from 7 to 60ms. I was running the servers on an Ubuntu VM on my local machine. Doing a direct connection from a swf to neko and sending bytes back and forth showed times of 3ms. It turns out that the issue is Linux TCP/IP related. The Nagle algorithm is buffering these tiny packets. The issue could probably be solved by sending a lot more data at once. So after enabling TCP_NODELAY in RabbitMQ (this should be the default now with 1.5.0 and on the repo), I tried sending data from one swf to another swf over RabbitMQ and got 3ms! But sending data to neko is still slow around 30+ms. Looks like I’ll have to tinker with the neko socket code to enable high performance tcp/ip options.

Read Full Post | Make a Comment ( 1 so far )

Liked it here?
Why not try sites on the blogroll...