diff --git a/performance-tests/all-files.js b/performance-tests/all-files.js index f38fd90e1dd97fd75db853d28e9c05128b11ba5f..bf0104c23ca4dd35a93f389dc558d83a0ccbeaed 100644 --- a/performance-tests/all-files.js +++ b/performance-tests/all-files.js @@ -38,21 +38,41 @@ const uiMWPath = process.env.UI_MIDDLEWARE_PATH // 4. collect manifests from the ui-container (or already do that in 1.) const manifests = await result.json() -// 5. setup autocannon options with all files +// 5.1 setup autocannon with cold cache console.log('Setup finished, start autocannon...') await new Promise(resolve => setTimeout(resolve, 50)) -const testResult = await autocannon({ +const coldCacheResult = await autocannon({ url: uiMWPath, connections: 1, duration: 60, requests: Object.values(manifests).map(({ file }) => ({ path: new URL(file, uiMWPath).href - })) + })), + workers: 5 }) -// 6. handle result +// 6.1 handle result await new Promise(resolve => setTimeout(resolve, 50)) -console.log(autocannon.printResult(testResult)) +console.log('Autocannon results with cold cache:') +console.log(autocannon.printResult(coldCacheResult)) + +// 5.2 setup autocannon options with all files +console.log('Setup finished, start autocannon with warm cache...') +await new Promise(resolve => setTimeout(resolve, 50)) +const warmCacheResult = await autocannon({ + url: uiMWPath, + connections: 1, + duration: 60, + requests: Object.values(manifests).map(({ file }) => ({ + path: new URL(file, uiMWPath).href + })), + workers: 5 +}) + +// 6.2 handle result +await new Promise(resolve => setTimeout(resolve, 50)) +console.log('Autocannon results with warm cache:') +console.log(autocannon.printResult(warmCacheResult)) // 7. restore old config try {