[rabbitmq-discuss] Apache/PHP_mod and keeping connection alive

Alvaro Videla videlalvaro at gmail.com
Sat Apr 5 16:51:41 BST 2014


Note that you don't need to declare the queue/exchange every time. You
can have that setup in advance and use your connection to just send
the message.

About RabbitMQ being overloaded by this, unless you are on the several
thousands, I doubt it would be a problem. As always, it's better to
benchmark this yourself.



On Sat, Apr 5, 2014 at 5:40 PM, Jonathan Bouzekri
<jonathan.bouzekri at gmail.com> wrote:
> Hi,
> I bought the Rabbit In Action book. The authors said that you should not
> open a connection to Rabbit every single time you want to send a message. It
> seems logic when you know the channel mecanism however in a HTTP context
> with a server web, I don't see how you can do it. Especially in an
> Apache/PHP mod context. You can't share a connection between requests in PHP
> because each request has its own process and scope and don't share anything
> (or I don't know of any method to do it).
> So suppose you must send a message through Rabbit each time a user make a
> GET request to your server, you will open a connection, create an exchange
> (maybe a queue too), send a message, close the connection. It will be time
> consumming and maybe overload rabbit. Is there another solution ? I am
> thinking about queueing my message in a simple SQL table (because I already
> open the connection to the server at each request) and process each line
> with a batch which will send the message to Rabbit but It seems like
> building another queue mecanism from scratch ....
> Thanks in advance for your suggestion.
> Best regards
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

More information about the rabbitmq-discuss mailing list