How to increase thread_pool and socket_queue_size in TG2?

23 views
Skip to first unread message

D R Dinesh Kumar

unread,
Mar 16, 2017, 9:15:11 PM3/16/17
to TurboGears
Hi All,

We are migrating our project from TG1 to TG2. We had the following setting in our config (.cfg) file to increase thread pool and queue size.

server.thread_pool = 70
server.socket_queue_size =50

but how to do the same in TG2? I don't find any such option that new config supports.
Please help.

With Regards,
Dinesh.

Alessandro Molina

unread,
Mar 17, 2017, 3:20:39 AM3/17/17
to TurboGears
Those are options strictly related to the WSGI server involved in serving the WSGI app, not TG2 options themselves.
On which wsgi server do you plan to serve the app?


If you plan to serve the app through "gearbox serve" the most common options as wsgi server are: 
  - wsgiref which becames multithreaded only if "wsgiref.threaded = true" option is added to the configuration. When threaded has no threadpool, will just spawn 1 thread per-request.
  - waitress which has a threadpool, can be enabled with "use = egg:waitress#main"
  - cherrypy which has a threadpool too, can be enabled with "use = egg:gearbox#cherrypy"

Using wsgiref on production is usually discouraged apart for very controlled environments. It's not optimised for speed and spawns unlimited concurrent threads until OOM in case of too many concurrent requests.





--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+unsubscribe@googlegroups.com.
To post to this group, send email to turbo...@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

D R Dinesh Kumar

unread,
Mar 17, 2017, 4:15:09 AM3/17/17
to TurboGears
Hi Alessandro,

Thank you for the information provided.

Yes, we are serving the app through "gearbox serve" and development.ini is used (which is by default).
hosting the app on cherrypy with "use = egg:gearbox#cherrypy". By default, cherrypy provides 10 threads. 
Can you please help me out with how to pass "thread_pool" and "socket_queue_size" to cherrypy through .ini file? 

Should adding the following lines help?
server.thread_pool = <num>
server.socket_queue_size = <num>

With Regards,
Dinesh.


On Friday, 17 March 2017 00:20:39 UTC-7, Alessandro Molina wrote:
Those are options strictly related to the WSGI server involved in serving the WSGI app, not TG2 options themselves.
On which wsgi server do you plan to serve the app?


If you plan to serve the app through "gearbox serve" the most common options as wsgi server are: 
  - wsgiref which becames multithreaded only if "wsgiref.threaded = true" option is added to the configuration. When threaded has no threadpool, will just spawn 1 thread per-request.
  - waitress which has a threadpool, can be enabled with "use = egg:waitress#main"
  - cherrypy which has a threadpool too, can be enabled with "use = egg:gearbox#cherrypy"

Using wsgiref on production is usually discouraged apart for very controlled environments. It's not optimised for speed and spawns unlimited concurrent threads until OOM in case of too many concurrent requests.




On Fri, Mar 17, 2017 at 2:15 AM, D R Dinesh Kumar <dinus...@gmail.com> wrote:
Hi All,

We are migrating our project from TG1 to TG2. We had the following setting in our config (.cfg) file to increase thread pool and queue size.

server.thread_pool = 70
server.socket_queue_size =50

but how to do the same in TG2? I don't find any such option that new config supports.
Please help.

With Regards,
Dinesh.

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+...@googlegroups.com.

Alessandro Molina

unread,
Mar 17, 2017, 5:07:22 AM3/17/17
to TurboGears
On Fri, Mar 17, 2017 at 9:15 AM, D R Dinesh Kumar <dinus...@gmail.com> wrote:
Hi Alessandro,

Thank you for the information provided.

Yes, we are serving the app through "gearbox serve" and development.ini is used (which is by default).
hosting the app on cherrypy with "use = egg:gearbox#cherrypy". By default, cherrypy provides 10 threads. 
Can you please help me out with how to pass "thread_pool" and "socket_queue_size" to cherrypy through .ini file? 

Should adding the following lines help?
server.thread_pool = <num>
server.socket_queue_size = <num>

D R Dinesh Kumar

unread,
Mar 21, 2017, 9:23:50 PM3/21/17
to TurboGears
Hi Alessandro,

Thank you. This is helpful.
With TG1 cherrypy used to reserve 5g of virtual memory for numthreads = 70
whereas in, TG2 it takes 1g only.


With Regards,
Dinesh.
Reply all
Reply to author
Forward
0 new messages