[Python-Dev] To reduce Python "application" startup time
wes.turner at gmail.com
Wed Sep 6 10:12:00 EDT 2017
On Wednesday, September 6, 2017, INADA Naoki <songofacandy at gmail.com> wrote:
> > How significant is application startup time to something that uses
> > Jinja2? Are there short-lived programs that use it? Python startup
> > time matters enormously to command-line tools like Mercurial, but far
> > less to something that's designed to start up and then keep running
> > (eg a web app, which is where Jinja is most used).
> Since Jinja2 is very popular template engine, it is used by CLI tools
> like ansible.
SaltStack uses Jinja2. It really is a good idea to regularly restart the
Celery can also cycle through worker processes, IIRC.
> Additionally, faster startup time (and smaller memory footprint) is good
> for even Web applications.
> For example, CGI is still comfortable tool sometimes.
> Another example is GAE/Python.
Short-lived processes are sometimes preferable from a security standpoint.
Python is currently less viable for CGI use than other scripting languages
due to startup time.
Resource leaks (e.g. memory, file handles, database references; valgrind)
do not last w/ short-lived CGI processes. If there's ASLR, that's also
Scale up operations with e.g. IaaS platforms like Kubernetes and PaaS
platforms like AppScale all incur Python startup time on a regular basis.
> Anyway, I think researching import tree of popular library is good
> about optimizing startup time.
> For example, modules like ast and tokenize are imported often than I
> Jinja2 is one of libraries I often use. I'm checking other libraries
> like requests.
> Python-Dev mailing list
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev