Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.

concurrent_queue overhead

Yumo_J_
Beginner
236 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
236 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

 

Yumo_J_
Beginner
236 Views

Thanks Alex!

Reply