Benchmarking LFS¶
This section describes how to benchmark LFS.
Overview¶
The development buildout comes with lfs_bench
, a small application, which
provides some tools to benchmark LFS.
You can use it in case you want to optimize LFS in terms of speed. In case you want to development a new feature, please compare the versions with and without this feature and try to not slow down LFS.
JMeter¶
Install JMeter
Prepare the database:
$ bin/django lfs_init $ bin/django lfs_generate_content_for_benchmark
Start LFS
- Start LFS in production mode, for instance with
bin/django-gunicorn
. and a reverse proxy in front of it. In other words don’t use the development server.- Set DEBUG to False
- Start JMeter
Make sure you start it from the buildout base directory (that’s the same directory you start Django from):
$ /path/to/jmeter/bin/jmeter -t src/lfs_bench/lfs_bench/jmeter/lfs.jmx -p src/lfs_bench/lfs_bench/jmeter/user.properties
- Execute the Testplan and check the result within
Summary Report
for instance.
Apache Benchmark - ab¶
Prepare the database:
$ bin/django lfs_init $ bin/django lfs_generate_content_for_benchmark
Start LFS
- Start LFS in production mode, for instance with
bin/django-gunicorn
. and a reverse proxy in front of it. In other words don’t use the development server.- Set DEBUG to False
Use
ab
, for instance like that:$ ab -n 1000 -c 20 http://localhost/product-1-1-1
Check the results.
Python Profiling¶
The development buildout provides a middleware by default, which let you profile
single requests. Just suffix the request with ?prof
in order to get
profiling data, for instance:
http://localhost/product-1-1-1?prof
See also: