mirror of https://github.com/mongodb/mongo
GitOrigin-RevId: e9dd74c88f9963dc897a77d6d25b9389240d5125 |
||
|---|---|---|
| .. | ||
| .gitignore | ||
| BUILD.bazel | ||
| OWNERS.yml | ||
| README.md | ||
| calibration_settings.py | ||
| ce_data_settings.py | ||
| ce_generate_data.py | ||
| common.py | ||
| config.py | ||
| cost_estimator.py | ||
| data_generator.py | ||
| database_instance.py | ||
| execution_tree_classic.py | ||
| execution_tree_sbe.py | ||
| experiment.py | ||
| parameters_extractor_classic.py | ||
| qsn_calibrator.py | ||
| qsn_costing_parameters.py | ||
| query_solution_tree.py | ||
| random_generator.py | ||
| requirements.txt | ||
| start.py | ||
| workload_execution.py | ||
README.md
Cost Model Calibrator
Getting Started
1) Setup Mongod
First, prepare the MongoDB server:
- Activate the standard virtual environment:
source python3-venv/bin/activate
- Build server with optimizations (makes doc insertion faster):
(python3-venv) bazel build --config=opt install-devcore
- Run mongod instance:
(python3-venv) bazel-bin/install-mongod/bin/mongod --setParameter internalMeasureQueryExecutionTimeInNanoseconds=true
2) Setup Cost Model Calibrator
In another terminal:
- Navigate to the cost model directory:
cd buildscripts/cost_model
- Set up Python alias to use MongoDB toolchain:
alias python=/opt/mongodbtoolchain/v4/bin/python3
- Deactivate any existing Python environment (if needed):
deactivate
- Create new virtual environment:
/opt/mongodbtoolchain/v4/bin/python3 -m venv cm
- Activate the new environment:
source cm/bin/activate
- Install required packages:
(cm) python -m pip install -r requirements.txt
- Run the calibrator:
(cm) python start.py
Note: For the first time it will take a while since it has to generate the data. Afterwards, as long as you aren't modifying the collections, you can comment out await generator.populate_collections() in start.py - this will make it a lot faster.
- When done, deactivate the environment:
(cm) deactivate
Install New Packages
- Install the package:
(cm) python -m pip install <package_name>
- Update requirements.txt:
(cm) python -m pip freeze > requirements.txt