Set Max memory to use ?

153 views
Skip to first unread message

Sijan Shrestha

unread,
Dec 18, 2016, 4:35:04 AM12/18/16
to Tornado Web Server
Is there a way to set maximum memory to use (limit the amount of memory to use) ?

I can set the maximum CPU to be used, but i am unable to configure the max CPU's to be used.

Example 

       server = tornado.httpserver.HTTPServer(app, xheaders=True)                                                                                    
       server.bind(int(config.get("port")))  
       server.start(num_procs)

I want to limit the memory to prevent some processes to stop consuming a lot of memory. Is there a way to avoid this without using cgroups ? I couldn't din it in documentation . Any suggestion?

A. Jesse Jiryu Davis

unread,
Dec 18, 2016, 7:30:55 AM12/18/16
to python-...@googlegroups.com
No, Python itself (unlike Java) has no such feature, so Tornado cannot provide it. Fortunately, I've run Tornado in production and never needed a "maximum memory" dial.

--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Darnell

unread,
Dec 19, 2016, 6:06:43 AM12/19/16
to python-...@googlegroups.com
Tornado does have some related features: the @streaming_request_body decorator and options like max_body_size can be used to limit the amount of memory that tornado uses on behalf of a single connection. The biggest thing we're missing is a way to limit the number of connections (aside from file descriptor limits and other blunt instruments). This can be managed by running Tornado behind a proxy like haproxy or nginx which can limit the number of connections before they get to tornado.

-Ben

--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.

Phyo Arkar

unread,
Dec 20, 2016, 7:31:48 AM12/20/16
to python-...@googlegroups.com
Run in a docker container , and then you can limit memory usage
Reply all
Reply to author
Forward
0 new messages