diff --git a/scenarios/run_scenarios.md b/scenarios/run_scenarios.md index 5dcb733..468340a 100644 --- a/scenarios/run_scenarios.md +++ b/scenarios/run_scenarios.md @@ -138,6 +138,7 @@ Options (in addition to the common options): * `DELETE_AGE` - age of object in seconds before which it can not be deleted. This parameter can be used to control how many objects we have in the system under load. * `SLEEP_DELETE` - time interval (in seconds) between deleting VU iterations. * `OBJ_NAME` - if specified, this name will be used for all write operations instead of random generation. + * `DIR_HEIGHT`, `DIR_WIDTH` - if both specified, object name will consist of `DIR_HEIGHT` directories, each of which can have `DIR_WIDTH` subdirectories, for example for `DIR_HEIGHT = 3, DIR_WIDTH = 100`, object names will be `/dir{1...100}/dir{1...100}/dir{1...100}/{uuid || OBJ_NAME}` ## S3 Multipart diff --git a/scenarios/s3.js b/scenarios/s3.js index aa707c9..58ff450 100644 --- a/scenarios/s3.js +++ b/scenarios/s3.js @@ -159,7 +159,20 @@ export function obj_write() { sleep(__ENV.SLEEP_WRITE); } - const key = __ENV.OBJ_NAME || uuidv4(); + let width = parseInt(__ENV.DIR_WIDTH || '0'); + let height = parseInt(__ENV.DIR_HEIGHT || '0'); + + let key = '' + if (width > 0 && height > 0) { + for (let index = 0; index < height; index++) { + const w = Math.floor(Math.random() * width) + 1 + key = key + '/dir' + w + } + key += '/' + } + + key += (__ENV.OBJ_NAME || uuidv4()); + const bucket = bucket_list[Math.floor(Math.random() * bucket_list.length)]; const payload = generator.genPayload(); diff --git a/scenarios/s3_car.js b/scenarios/s3_car.js index 2aaa94e..5f907ba 100644 --- a/scenarios/s3_car.js +++ b/scenarios/s3_car.js @@ -177,7 +177,19 @@ export function obj_write() { sleep(__ENV.SLEEP_WRITE); } - const key = __ENV.OBJ_NAME || uuidv4(); + let width = parseInt(__ENV.DIR_WIDTH || '0'); + let height = parseInt(__ENV.DIR_HEIGHT || '0'); + + let key = '' + if (width > 0 && height > 0) { + for (let index = 0; index < height; index++) { + const w = Math.floor(Math.random() * width) + 1 + key = key + '/dir' + w + } + key += '/' + } + + key += (__ENV.OBJ_NAME || uuidv4()); const bucket = bucket_list[Math.floor(Math.random() * bucket_list.length)]; const payload = generator.genPayload(); diff --git a/scenarios/s3_dar.js b/scenarios/s3_dar.js index 5f10bd0..de49e1c 100644 --- a/scenarios/s3_dar.js +++ b/scenarios/s3_dar.js @@ -159,7 +159,19 @@ export function obj_write() { sleep(__ENV.SLEEP_WRITE); } - const key = __ENV.OBJ_NAME || uuidv4(); + let width = parseInt(__ENV.DIR_WIDTH || '0'); + let height = parseInt(__ENV.DIR_HEIGHT || '0'); + + let key = '' + if (width > 0 && height > 0) { + for (let index = 0; index < height; index++) { + const w = Math.floor(Math.random() * width) + 1 + key = key + '/dir' + w + } + key += '/' + } + + key += (__ENV.OBJ_NAME || uuidv4()); const bucket = bucket_list[Math.floor(Math.random() * bucket_list.length)]; const payload = generator.genPayload(); diff --git a/scenarios/s3_multipart.js b/scenarios/s3_multipart.js index 2b94ddc..c574df4 100644 --- a/scenarios/s3_multipart.js +++ b/scenarios/s3_multipart.js @@ -101,7 +101,19 @@ export function obj_write_multipart() { sleep(__ENV.SLEEP_WRITE); } - const key = __ENV.OBJ_NAME || uuidv4(); + let width = parseInt(__ENV.DIR_WIDTH || '0'); + let height = parseInt(__ENV.DIR_HEIGHT || '0'); + + let key = '' + if (width > 0 && height > 0) { + for (let index = 0; index < height; index++) { + const w = Math.floor(Math.random() * width) + 1 + key = key + '/dir' + w + } + key += '/' + } + + key += (__ENV.OBJ_NAME || uuidv4()); const bucket = bucket_list[Math.floor(Math.random() * bucket_list.length)]; const payload = generator.genPayload(); diff --git a/scenarios/s3local.js b/scenarios/s3local.js index 6eaf049..2e350d4 100644 --- a/scenarios/s3local.js +++ b/scenarios/s3local.js @@ -131,7 +131,19 @@ export function handleSummary(data) { } export function obj_write() { - const key = __ENV.OBJ_NAME || uuidv4(); + let width = parseInt(__ENV.DIR_WIDTH || '0'); + let height = parseInt(__ENV.DIR_HEIGHT || '0'); + + let key = '' + if (width > 0 && height > 0) { + for (let index = 0; index < height; index++) { + const w = Math.floor(Math.random() * width) + 1 + key = key + '/dir' + w + } + key += '/' + } + + key += (__ENV.OBJ_NAME || uuidv4()); const bucket = bucket_list[Math.floor(Math.random() * bucket_list.length)]; const payload = generator.genPayload();