Page 1 of 1

SABnzbd process number

Posted: February 1st, 2010, 8:24 am
by dd44
Hello,
i'm using SABnzbd 5.0RC3 on a (linux) VPS server with a limited number of process allowed at same time. I can see that "SABnzbd.py" is using 20 proccess when it idle ( pstree ), and i have a maximum process number of 96 allowed :x

So, is there a way to reduce the number of process of sabnzbd like i did for apache ( MaxSpareServers 4 ) ?

Thanks in advance,
David.

Re: SABnzbd process number

Posted: February 1st, 2010, 9:31 am
by shypike
SABnzbd uses threads, not processes.
It needs them all.

Just guessing:
If the kernel doesn't have threading support and the Python interpreter
somehow needs processes to compensate for this, you have a problem.
This is beyond my knowledge.

Re: SABnzbd process number

Posted: February 1st, 2010, 2:11 pm
by switch
CherryPy can probably be made to use less threads, however it would require changes in SABnzbd.py and I can't find the name of the cherrypy setting that needs changing.

Re: SABnzbd process number

Posted: February 2nd, 2010, 10:34 am
by dd44
Hum ok crap, 20 "thread/procs" on 96 for sabnzb is killing me :x I may take a look at the sources soon but i never coded anything in python language so it may be hard :)

Re: SABnzbd process number

Posted: February 2nd, 2010, 11:13 am
by shypike
I have never seen more than one SABnzbd process listed on a Linux system.
If your system has a 96 thread limit, I wish you good luck.

Re: SABnzbd process number

Posted: February 2nd, 2010, 3:12 pm
by dd44
Well, your right, it's one process with 20 thread ( well there is near 0 application that use 20 threads anyway ). Just do a "pstree" and you'll see what i mean.
Else, it's a common stuff to limit process/threads on VPS, and around 100 max seems to be common. It's sad because sabnzbd is probably the best thing on linux to do what it's supposed to do, but it don't seems optimised.

For the procnum/thread limit, i'm at around 56 with plesk ( qmail, apache2, mysql, psa server ... ) so it's really enough, but this bring me to 76 on 96 with sabnzbd running :x

Re: SABnzbd process number

Posted: February 2nd, 2010, 3:31 pm
by shypike
dd44 wrote: but it don't seems optimised.
Not for a VPS :)

Re: SABnzbd process number

Posted: February 2nd, 2010, 4:22 pm
by dd44
Well, i did change the cherrypy thread pool max from 10 to 2, and also a change in two other files. I now have 12 thread running instead of 20, all seems to work correctly but need more testing. Here's the diff in case :

Code: Select all

*** _cpserver.py	2010-02-02 22:10:05.046692131 +0100
--- old/_cpserver.py	2010-02-02 22:09:28.201691987 +0100
***************
*** 48,55 ****
      shutdown_timeout = 5
      protocol_version = 'HTTP/1.1'
      reverse_dns = False
!     thread_pool = 2
!     thread_pool_max = 2
      max_request_header_size = 500 * 1024
      max_request_body_size = 100 * 1024 * 1024
      instance = None
--- 48,55 ----
      shutdown_timeout = 5
      protocol_version = 'HTTP/1.1'
      reverse_dns = False
!     thread_pool = 10
!     thread_pool_max = -1
      max_request_header_size = 500 * 1024
      max_request_body_size = 100 * 1024 * 1024
      instance = None

Code: Select all

*** lib/covercp.py	2010-02-02 22:09:35.098692868 +0100
--- old/covercp.py	2010-02-02 22:08:26.562689195 +0100
***************
*** 351,357 ****
      import cherrypy
      cherrypy.config.update({'server.socket_port': port,
!                             'server.thread_pool': 2,
                              'environment': "production",
                              })
      cherrypy.quickstart(CoverStats())
--- 351,357 ----
      import cherrypy
      cherrypy.config.update({'server.socket_port': port,
!                             'server.thread_pool': 10,
                              'environment': "production",
                              })
      cherrypy.quickstart(CoverStats())

Code: Select all

*** lib/profiler.py	2010-02-02 22:09:38.437692110 +0100
--- old/profiler.py	2010-02-02 22:09:05.618692052 +0100
***************
*** 187,193 ****
  def serve(path=None, port=8080):
      import cherrypy
      cherrypy.config.update({'server.socket_port': int(port),
!                             'server.thread_pool': 2,
                              'environment': "production",
                              })
      cherrypy.quickstart(Profiler(path))
--- 187,193 ----
  def serve(path=None, port=8080):
      import cherrypy
      cherrypy.config.update({'server.socket_port': int(port),
!                             'server.thread_pool': 10,
                              'environment': "production",
                              })
      cherrypy.quickstart(Profiler(path))

Re: SABnzbd process number

Posted: February 2nd, 2010, 5:31 pm
by shypike
Good that it works for you.
We're not going to implement this for release 0.5.0.
But possibly later.