I want each consumer to listen on their own private queue. To do this I'm using Elixir to spawn up a process for each user and subscribing that process to listen for new messages on their private user queue.
On my macbook pro with 16G of RAM, my rabbitmq admin panel shows me that I have:
File descriptors: 256 available Socket descriptors: 138 available
Apparently I cannot open up more than 138 connections.
Question 1: What is that limit based on, and am I able to raise it? I want to know how potentially how much higher that would be on a production machine (what kind of EC2 instance would be needed) and whether it's a good idea to have a connection per user. I've read that the limit might be related to ulimit, but when I run ulimit on the command line I see 'unlimited'.
I need to serve 4000 users now and will grow maybe 500-1000 users per year.
Another approach would be to make 1 tcp connection from Elixir app to Rabbitmq and use channels for each process. That works, but it requires a slightly more complicated setup. Instead of each process initializing their own connection, they would need to re-use an existing connection and open a new channel on it instead.
If the connection dies, I need to come up with a strategy for restarting a common connection, and then cascading to restart the channel for each process. I haven't figured out how to do that yet.
Q2: Is channels a better idea? Putting all the channels into one connection seems like the other extreme. Does the bandwidth of messages suffer if they are all multiplexed on the same connection?
What other strategies might be available?