On 31-1-2008 14:04 Maarten Manders wrote:
I'm running a cluster of webservers and I'd like to write certain events
(logins, logouts, etc.) to a central log. To do that, I'd like the
webservers to send event messages to a broker. A logging machine should
periodically fetch, process, aggregate and write those events to a log.

We use it in a similar set-up for a few days now, and it works ok. My concerns are with memory-consumption and performance, your issues seem fixable to me.

1) Building ActiveMQ with Maven takes forever. I cancelled it after ~2 hours
of running unit tests and grabbed myself the binary.
I doubt there is any good reason to roll your own for a java-application any way?

2) ActiveMQ seems to block when there's no message in a queue. I was using
the Stomp PHP API (which doesn't handle this gracefully) and the REST
interface (which seems ignore the timeout GET param). Isn't there an easy
way for polling a queue?
You could adjust the code to create a non blocking stream and use stream_select and such, rather than plain old fgets/fread. The Stomp-class is quite trivial to read and adjust (you only need to adjust the readFrame-method).

3) Although I can see pending messages in a queue in the web console, the
REST / Stomp APIs block when trying to fetch them. Any ideas here?
I'm not sure what you mean by 'block' ?

4) Why aren't messages automatically deleted from the queue, when I fetch
them (subscribe in Stomp, GET in REST)?
The php-stomp implementation defaults to client-acknowledgement when you subscribe. So you have to explicitly ack(nowledge) your message's (the id you need is in the headers of the received frame) and/or you could adjust the code Stomp-class to not set the acknowledgement to client. You only need to remove a single line for that in subscribe().

5) Is there a better way interface to bulk fetch a lot of messages from PHP?
To me, REST seems to cause too much protocol overhead and Stomp just doesn't
work well - probably because of a poor PHP API implementation.

Stomp works quite well here, but you should try hard and find the newest sources. I send a cleaned up version of the php implementation that has much better read-performance to the authors, you can find that here:
http://stompcli.googlecode.com/files/stompcli-php4-1.0-20080129.tar.gz

But if you need non-blocking reads to the sockets, etc, you'll have to adjust the readFrame-method of that to do so.

Best regards,

Arjen

Reply via email to