<commit_before>Running and deploying
=====================

Since Tornado supplies its own HTTPServer, running and deploying it is
a little different from other Python web frameworks.  Instead of
configuring a WSGI container to find your application, you write a
``main()`` function that starts the server::

    def main():
        app = make_app()
        app.listen(8888)
        IOLoop.current().start()

    if __name__ == '__main__':
        main()

Configure your operating system or process manager to run this program to
start the server. Please note that it may be necessary to increase the number 
of open files per process (to avoid "Too many open files"-Error). 
To raise this limit you can use the ulimit command or modify 
/etc/security/limits.conf (setting it to 50000 for example).

Processes and ports
~~~~~~~~~~~~~~~~~~~

Due to the Python GIL (Global Interpreter Lock), it is necessary to run
multiple Python processes to take full advantage of multi-CPU machines.
Typically it is best to run one process per CPU.

Tornado includes a built-in multi-process mode to start several
processes at once.  This requires a slight alteration to the standard
main function::

    def main():
        app = make_app()
        server = tornado.httpserver.HTTPServer(app)
        server.bind(8888)
        server.start(0)  # forks one process per cpu
        IOLoop.current().start()

This is the easiest way to start multiple processes and have them all
share the same port, although it has some limitations.  First, each
child process will have its own IOLoop, so it is important that
nothing touch the global IOLoop instance (even indirectly) before the
fork.  Second, it is difficult to do zero-downtime updates in this model.
Finally, since all the processes share the same port it is more difficult
to monitor them individually.<commit_msg>adding hint to supervisord minfds<commit_after>Running and deploying
=====================

Since Tornado supplies its own HTTPServer, running and deploying it is
a little different from other Python web frameworks.  Instead of
configuring a WSGI container to find your application, you write a
``main()`` function that starts the server::

    def main():
        app = make_app()
        app.listen(8888)
        IOLoop.current().start()

    if __name__ == '__main__':
        main()

Configure your operating system or process manager to run this program to
start the server. Please note that it may be necessary to increase the number 
of open files per process (to avoid "Too many open files"-Error). 
To raise this limit (setting it to 50000 for example)  you can use the ulimit command, 
modify /etc/security/limits.conf or setting ``minfds`` in your supervisord config.

Processes and ports
~~~~~~~~~~~~~~~~~~~

Due to the Python GIL (Global Interpreter Lock), it is necessary to run
multiple Python processes to take full advantage of multi-CPU machines.
Typically it is best to run one process per CPU.

Tornado includes a built-in multi-process mode to start several
processes at once.  This requires a slight alteration to the standard
main function::

    def main():
        app = make_app()
        server = tornado.httpserver.HTTPServer(app)
        server.bind(8888)
        server.start(0)  # forks one process per cpu
        IOLoop.current().start()

This is the easiest way to start multiple processes and have them all
share the same port, although it has some limitations.  First, each
child process will have its own IOLoop, so it is important that
nothing touch the global IOLoop instance (even indirectly) before the
fork.  Second, it is difficult to do zero-downtime updates in this model.
Finally, since all the processes share the same port it is more difficult
to monitor them individually.
{'fraction_non_alphanumeric': 0.0739268680445151, 'fraction_numerical': 0.007419183889772125, 'mean_word_length': 3.7664141414141414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5486877', 'n_tokens_mistral': 994, 'n_tokens_neox': 941, 'n_words': 517}