how to limit the thread number?

Edward Hervey bilboed at bilboed.com
Fri Jul 25 00:07:20 PDT 2014


Hi,


On Fri, 2014-07-25 at 09:58 +0800, Wang Zhenzhong wrote:
> Hi:
> every body,  we are using gstreamer for develop media server.
> the media server need support many audio/video user,
> so every user include udpsrc/rtpsrc/decode/encode/rtpsink/udpsink...
> must create about 3-5 threads

  That sounds about right

> but the centos's thread num and memory is limited, so the capability
> of our server is limited by gstreamer's thread number

  Have you investigated changing those limits ? via ulimit/getrlimit.

>  
> is there anyway to limit the thread num of gstreamer? such as
> confirmed thread num in startup and unrelated to user num

  GStreamer is multi-threaded, it *needs* those (streaming) threads to
work. If a thread can't be created, it will fail. What you can do
though, is figure out how many threads will be created.

  The rule of thumb is (roughly):
  * queue element will create one new streaming thread
  * sources (when working push-based, such as udpsrc) or demuxers (when
working pull-based) will create one new streaming thread
  * Some other elements might create a streaming thread (such as the
jitterbuffer normally used in client-side RTP pipelines).

  If you're not sure, create one pipeline (I'm assuming your pipelines
are identical), and look at how many threads are running (top, and then
'H' to view each thread is quite useful for that). Take your thread
limits, divide it by that => you have your maximum number of clients you
can accept. But once again, you should check whether you can change the
limit of threads via ulimit/getrlimit first.

   Regards,

     Edward

>  
> thankyou 
>   
>  
> 
> ______________________________________________________________________
>  
> 王振中
>  
>  
>  
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140725/99867e04/attachment.sig>


More information about the gstreamer-devel mailing list