|
| 1 | +# File Cache Microbenchmark |
| 2 | + |
| 3 | +## Compilation |
| 4 | + |
| 5 | +To compile the project, run the following command: |
| 6 | + |
| 7 | +```bash |
| 8 | +./build.sh --clean --file-cache-microbench --be |
| 9 | +``` |
| 10 | + |
| 11 | +This will generate the `file_cache_microbench` executable in the `apache_doris/output/be/lib` directory. |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +1. Create a deployment directory: |
| 16 | + ```bash |
| 17 | + mkdir {deploy_dir} |
| 18 | + ``` |
| 19 | + |
| 20 | +2. Create a configuration directory: |
| 21 | + ```bash |
| 22 | + mkdir {deploy_dir}/conf |
| 23 | + ``` |
| 24 | + |
| 25 | +3. Copy the executable to the deployment directory: |
| 26 | + ```bash |
| 27 | + cp -r apache_doris/output/be/lib/file_cache_microbench {deploy_dir} |
| 28 | + ``` |
| 29 | + |
| 30 | +4. Copy the configuration file to the configuration directory: |
| 31 | + ```bash |
| 32 | + cp -r apache_doris/output/be/conf/be.conf {deploy_dir}/conf |
| 33 | + ``` |
| 34 | + |
| 35 | +5. Edit the configuration file `{deploy_dir}/conf/be.conf` and add the following configuration information: |
| 36 | + ```ini |
| 37 | + enable_file_cache=true |
| 38 | + file_cache_path = [ {"path": "/mnt/disk2/file_cache", "total_size":53687091200, "query_limit": 10737418240}] |
| 39 | + test_s3_resource = "resource" |
| 40 | + test_s3_ak = "ak" |
| 41 | + test_s3_sk = "sk" |
| 42 | + test_s3_endpoint = "endpoint" |
| 43 | + test_s3_region = "region" |
| 44 | + test_s3_bucket = "bucket" |
| 45 | + test_s3_prefix = "prefix" |
| 46 | + ``` |
| 47 | + |
| 48 | +6. Change to the deployment directory: |
| 49 | + ```bash |
| 50 | + cd {deploy_dir} |
| 51 | + ``` |
| 52 | + |
| 53 | +7. Run the microbenchmark: |
| 54 | + ```bash |
| 55 | + ./file_cache_microbench --port={test_port} |
| 56 | + ``` |
| 57 | + |
| 58 | +8. Access the variables: |
| 59 | + ```bash |
| 60 | + bvar http://${ip}:${port}/vars/ |
| 61 | + ``` |
| 62 | + |
| 63 | +9. Check the logs in `{deploy_dir}/log/`. |
| 64 | + |
| 65 | +## API |
| 66 | + |
| 67 | +### get_help |
| 68 | +``` |
| 69 | +curl "http://localhost:{port}/MicrobenchService/get_help" |
| 70 | +``` |
| 71 | + |
| 72 | +#### Endpoints: |
| 73 | +- **GET /get_job_status/<job_id>** |
| 74 | + - Retrieve the status of a submitted job. |
| 75 | + - Parameters: |
| 76 | + - `job_id`: The ID of the job to retrieve status for. |
| 77 | + - `files` (optional): If provided, returns the associated file records for the job. |
| 78 | + - Example: `/get_job_status/job_id?files=10` |
| 79 | + |
| 80 | +- **GET /list_jobs** |
| 81 | + - List all submitted jobs and their statuses. |
| 82 | + |
| 83 | +- **GET /get_help** |
| 84 | + - Get this help information. |
| 85 | + |
| 86 | +- **GET /file_cache_clear** |
| 87 | + - Clear the file cache with the following query parameters: |
| 88 | + ```json |
| 89 | + { |
| 90 | + "sync": <true|false>, // Whether to synchronize the cache clear operation |
| 91 | + "segment_path": "<path>" // Optional path of the segment to clear from the cache |
| 92 | + } |
| 93 | + ``` |
| 94 | + If `segment_path` is not provided, all caches will be cleared based on the `sync` parameter. |
| 95 | + |
| 96 | +- **GET /file_cache_reset** |
| 97 | + - Reset the file cache with the following query parameters: |
| 98 | + ```json |
| 99 | + { |
| 100 | + "capacity": <new_capacity>, // New capacity for the specified path |
| 101 | + "path": "<path>" // Path of the segment to reset |
| 102 | + } |
| 103 | + ``` |
| 104 | + |
| 105 | +- **GET /file_cache_release** |
| 106 | + - Release the file cache with the following query parameters: |
| 107 | + ```json |
| 108 | + { |
| 109 | + "base_path": "<base_path>" // Optional base path to release specific caches |
| 110 | + } |
| 111 | + ``` |
| 112 | + |
| 113 | +- **GET /update_config** |
| 114 | + - Update the configuration with the following JSON body: |
| 115 | + ```json |
| 116 | + { |
| 117 | + "config_key": "<key>", // The configuration key to update |
| 118 | + "config_value": "<value>", // The new value for the configuration key |
| 119 | + "persist": <true|false> // Whether to persist the configuration change |
| 120 | + } |
| 121 | + ``` |
| 122 | + |
| 123 | +- **GET /show_config** |
| 124 | + - Retrieve the current configuration settings. |
| 125 | + |
| 126 | +### Notes: |
| 127 | +- Ensure that the S3 configuration is set correctly in the environment. |
| 128 | +- The program will create and read files in the specified S3 bucket. |
| 129 | +- Monitor the logs for detailed execution information and errors. |
| 130 | + |
| 131 | +### Version Information: |
| 132 | +you can see it in get_help return msg |
| 133 | + |
0 commit comments