We typically have 1M+ users online per instance. In our current implementation, we queue pending messages for user in a lock-free linked list.
We are planning to change that implementation using concurrent_queue where a queue is assigned to users having pending messages. However, this will result in worst case scenario having 1M queues (thought this can be reduced by queue pool later).
Hence, was wondering about per queue overhead. Feel free to suggest other alternatives.
I do not know the exact amount of memory consumed by empty tbb::concurrent_queue but the rough estimation can be as a size of its representation. concurrent_queue_rep_base is about 3 times of NFS_MaxLineSize number of bytes (that is 128) and 8 sizes of micro_queue that is about 5 pointers each. The total is about 700 bytes so we can say that overall estimation is not bigger than 1K. Therefore, 1M+ queues will consume 1Gb+ memory. Pay attention that this estimation is rough and valid only for some particular version of the implementation.