Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

concurrent_queue overhead

Yumo_J_
Beginner
402 Views

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.

 

 

 

0 Kudos
2 Replies
Alexei_K_Intel
Employee
402 Views

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 representationconcurrent_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.

Regards,
Alex

 

0 Kudos
Yumo_J_
Beginner
402 Views

Thanks Alex!

0 Kudos
Reply