Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a memory bound message queue in Erlang?

I want the speed of asynchronous messages but still have some flow control. How can I accomplish this in Erlang?

like image 295
Eric des Courtis Avatar asked May 30 '13 14:05

Eric des Courtis


1 Answers

There is no process memory limit right now -- it is discussed on mailing list etc. You can look at those threads.

On the up side, when you use OTP patterns implementation like gen_server you have a lot of freedom in retrieving messages from process queue and measuring the length of the queue.

gen_server2 used in rabbitmq used to optimize that by moving messages to internal data structure. Having that you can discard any new incoming message when internal queue is too long. You can do it silently or notify sender that the message rejected.

All of that is on very low level.

RabbitMQ will provide this functionality on AMQP level.

like image 169
user425720 Avatar answered Sep 17 '22 22:09

user425720