Im working on an streaming server and i need to have several pipes running at the same time, i started to do some tests to see how much memory and how much threads would something like that use on gstreamer. So i wrote a very simple application that starts a lot of pipelines, where the pipelines will be simply an faksrc ! fakesink. I started the tests and i realized that even for a simple task as running an fakesrc ! fakesink im using a lot of memory.<br>
<br>with 1 pipe:<br><br>Tasks: 2 total, 1 running, 1 sleeping, 0 stopped, 0 zombie<br>Cpu(s): 51.5%us, 1.0%sy, 0.0%ni, 47.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st<br>Mem: 2027232k total, 963800k used, 1063432k free, 75976k buffers<br>
Swap: 995988k total, 0k used, 995988k free, 430676k cached<br><br> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND <br>
6402 katcipis 20 0 26204 4060 2548 R 99.9 0.2 0:48.04 multiple_pipes <br> 6400 katcipis 20 0 26204 4060 2548 S 0.0 0.2 0:00.04 multiple_pipes <br>
<br>with 2 pipes:<br><br>Tasks: 3 total, 2 running, 1 sleeping, 0 stopped, 0 zombie<br>Cpu(s): 96.8%us, 1.8%sy, 0.0%ni, 1.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st<br>Mem: 2027232k total, 965044k used, 1062188k free, 76804k buffers<br>
Swap: 995988k total, 0k used, 995988k free, 430752k cached<br><br> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND <br>
6541 katcipis 20 0 42600 4092 2544 R 95.3 0.2 0:16.22 multiple_pipes <br> 6542 katcipis 20 0 42600 4092 2544 R 95.3 0.2 0:16.36 multiple_pipes <br>
6539 katcipis 20 0 42600 4092 2544 S 0.0 0.2 0:00.04 multiple_pipes<br><br>with 3 pipes:<br><br>Tasks: 4 total, 2 running, 2 sleeping, 0 stopped, 0 zombie<br>Cpu(s): 90.6%us, 3.1%sy, 0.0%ni, 6.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st<br>
Mem: 2027232k total, 964608k used, 1062624k free, 77528k buffers<br>Swap: 995988k total, 0k used, 995988k free, 430752k cached<br><br> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND <br>
6563 katcipis 20 0 51820 4116 2544 S 62.5 0.2 0:17.44 multiple_pipes <br> 6566 katcipis 20 0 51820 4116 2544 R 62.5 0.2 0:16.36 multiple_pipes <br>
6565 katcipis 20 0 51820 4116 2544 R 50.0 0.2 0:13.94 multiple_pipes <br> 6561 katcipis 20 0 51820 4116 2544 S 0.0 0.2 0:00.04 multiple_pipes <br>
<br><br>i have another test where i run an gnomevfssrc and a decodebin and the numbers are even worse:<br><br>with 1 pipe:<br><br>Tasks: 2 total, 0 running, 2 sleeping, 0 stopped, 0 zombie<br>Cpu(s): 8.1%us, 2.7%sy, 0.0%ni, 89.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st<br>
Mem: 2027232k total, 972104k used, 1055128k free, 78080k buffers<br>Swap: 995988k total, 0k used, 995988k free, 430760k cached<br><br> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND <br>
6603 katcipis 20 0 43724 12m 5212 S 0.0 0.6 0:00.10 multiple_pipes <br> 6605 katcipis 20 0 43724 12m 5212 S 0.0 0.6 0:00.12 multiple_pipes <br>
<br>with 2 pipes:<br><br>Tasks: 3 total, 0 running, 3 sleeping, 0 stopped, 0 zombie<br>Cpu(s): 15.7%us, 4.3%sy, 0.0%ni, 79.8%id, 0.0%wa, 0.2%hi, 0.0%si, 0.0%st<br>Mem: 2027232k total, 972604k used, 1054628k free, 78548k buffers<br>
Swap: 995988k total, 0k used, 995988k free, 430760k cached<br><br> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND <br>
6622 katcipis 20 0 53348 13m 5208 S 0.0 0.7 0:00.08 multiple_pipes <br> 6624 katcipis 20 0 53348 13m 5208 S 0.0 0.7 0:00.10 multiple_pipes <br>
6625 katcipis 20 0 53348 13m 5208 S 0.0 0.7 0:00.04 multiple_pipes<br><br>with 3 pipes:<br><br>Tasks: 4 total, 0 running, 4 sleeping, 0 stopped, 0 zombie<br>Cpu(s): 6.8%us, 4.5%sy, 0.0%ni, 88.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st<br>
Mem: 2027232k total, 974368k used, 1052864k free, 79328k buffers<br>Swap: 995988k total, 0k used, 995988k free, 430760k cached<br><br> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND <br>
6960 katcipis 20 0 62136 13m 5208 S 9.6 0.7 0:00.04 multiple_pipes <br> 6957 katcipis 20 0 62136 13m 5208 S 0.0 0.7 0:00.10 multiple_pipes <br>
6959 katcipis 20 0 62136 13m 5208 S 0.0 0.7 0:00.08 multiple_pipes <br> 6962 katcipis 20 0 62136 13m 5208 S 0.0 0.7 0:00.02 multiple_pipes<br>
<br><br>i also realized that for every stream there is a thread, is there some way to use one thread for multiple pipes (or multiple streams)? is something that i did terribly wrong or it is normal this usage of memory? if it is normal, can i configure gstreamer to use less memory? considering that gstreamer works even in embedded systems i suppose im doing something very wrong on there is some way to use less resources.<br>
<br>im attaching the source code of my tests, the simple one using fakesrc and the complete one using gnomevfs and decodebin.<br><br>best regards,<br>Katcipis<br><br><br>