Performance tests

Django MongoDB Backend uses a performance test suite to catch regressions.

See the ODM Performance Benchmarking specification for an overview of design and implementation decisions.

Running the performance tests

First, setup your environment to run the unit tests.

Then, set up the benchmark data, running the following commands from the django-mongodb-backend repository’s root directory:

.. code-block:: bash

$ git clone –depth 1 https://github.com/mongodb/specifications.git $ mkdir performance_tests/odm-data $ cp specifications/source/benchmarking/odm-data/flat_models.tgz performance_tests/odm-data/flat_models.tgz $ cp specifications/source/benchmarking/odm-data/nested_models.tgz performance_tests/odm-data/nested_models.tgz $ pushd performance_tests/odm-data $ tar xf flat_models.tgz $ tar xf nested_models.tgz $ popd

To run the tests:

$ cd performance_tests
$ FASTBENCH=1 ./runtests.py

Warning

Running the full test suite without FASTBENCH=1 will take a significant amount of time.

To run an individual test (again, you may want to add FASTBENCH=1):

$ ./runtests.py perf.tests.TestLargeNestedDocFilterArray