← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~jugmac00/launchpad:add-performance-documentation into launchpad:master

 


Diff comments:

> diff --git a/doc/explanation/performance.rst b/doc/explanation/performance.rst
> new file mode 100644
> index 0000000..578973a
> --- /dev/null
> +++ b/doc/explanation/performance.rst
> @@ -0,0 +1,73 @@
> +About Launchpad performance
> +===========================
> +
> +This document provides an overview of techniques and tools that can help
> +Launchpad developers running Launchpad more efficiently - faster, and using

Considering the flow of this sentence, it looks like there might be a typo and 'tools that can help Launchpad developers run Launchpad more efficiently ...' sounds correct?

> +fewer system resources.
> +
> +Measure, don't guess
> +--------------------
> +In order to ensure highly performant web services, we need to have a look at
> +numbers.
> +
> +We conduct regular performance checks with Google's
> +`PageSpeed Insights <https://pagespeed.web.dev/>`_ for which we currently score
> +an excellent 98 out of 100, with intentions to close the last bits.
> +
> +We also have
> +`internal monitoring <https://grafana.admin.canonical.com/d/oIhMaXhMk/launchpad-dash?orgId=1&refresh=5m>`_

Would it make the text here and in a few places below more readable if we separated the link and the target like it is documented at https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks?

> +set up with Grafana, where we measure and monitor various metrics.
> +
> +Timeouts
> +--------
> +It is important to have sensible timeouts, as otherwise very slow clients could
> +block resources for too long, and prevent other clients from connecting.
> +
> +We use a default of 5 seconds for all page views. This value can be tweaked via
> +`feature rules <https://launchpad.net/+feature-rules>`_.

Should we mention that this can be done at a per-page level?

> +
> +Writing performant Python code
> +------------------------------
> +As a general guideline, writing clean and modern Python code usually produces
> +considerable fast code.
> +
> +As a base, you need to
> +`choose the correct data structure <https://wiki.python.org/moin/TimeComplexity>`_,
> +depending on whether you optimize for lookups, appending elements, or similar.
> +
> +You also need to be aware of the
> +`runtime complexity (Big O) <https://towardsdatascience.com/understanding-time-complexity-with-python-examples-2bda6e8158a7>`_
> +of your code.
> +
> +Another way to ensure high performance is to use caches.
> +While Launchpad uses caches on various levels, you should be aware of the
> +``propertycache`` module, which offers a ``cachedproperty`` decorator.
> +For more information please see the documentation at
> +https://git.launchpad.net/launchpad/tree/lib/lp/services/doc/propertycache.rst.
> +
> +It is also recommended to run the latest version of a software, as that one is
> +usually the fastest one.
> +This applies both to third party Python libraries, and also to the
> +`Python interpreter <https://devblogs.microsoft.com/python/python-311-faster-cpython-team/>`_ itself.
> +
> +
> +Delivering payload
> +------------------
> +We leverage various ways to improve performance on the server side.
> +
> +Apache is configured to make use of the `gzip` compression.
> +
> +Also, static files are directly served by the web server, instead of the
> +application server, which reduces CPU load and enables more effective caching.
> +
> +- what do we do with static files?
> +- minification -> lookup
> +
> +
> +Further information
> +-------------------
> +
> +- Debugging timeouts [ link to video ]
> +- Debugging slow SQL queries [ we either have a video or link to some EXPLAIN documentation ]
> +- Writing efficient queries [ ask Colin]

There is some useful documentation regarding this at https://dev.launchpad.net/Database/Performance. Perhaps we could extract and mention some of it here?

> +- `Preserving query count <https://launchpad.readthedocs.io/en/latest/how-to/preserve-query-count.html>`_


-- 
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/447112
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:add-performance-documentation into launchpad:master.



References