summaryrefslogtreecommitdiffstats
path: root/integration-test/src
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-03-08 13:50:34 +0000
committerdanielhanrahan <daniel.hanrahan@est.tech>2023-03-13 14:30:46 +0000
commit2e07b499eb798c19c8641078ff79364f9439a281 (patch)
treeec1287cb75f12d432da39d7736fd2cf723d77d13 /integration-test/src
parent9a552aaf3dcd944a629aa30a3cb8122eb8ce7585 (diff)
Fetch fragment entities using recursive SQL query
- Add SQL query that can fetch needed fragments to any given depth - Update getFragmentEntities to use new query - Remove now unused FragmentRepositoryMultiPathQuery - Remove unused TempTableCreator method - Result: getDataNodesForMultipleXpaths is up to 10 times faster Issue-ID: CPS-1525 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I07cbc9da5ab994ce7e0c2b02d7ca05089f05dab0
Diffstat (limited to 'integration-test/src')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/base/CpsPerfTestBase.groovy22
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy8
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy16
3 files changed, 33 insertions, 13 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/CpsPerfTestBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/CpsPerfTestBase.groovy
index 6fb6d844a9..e75f1dce36 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/CpsPerfTestBase.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/CpsPerfTestBase.groovy
@@ -20,6 +20,8 @@
package org.onap.cps.integration.performance.base
+import org.onap.cps.spi.FetchDescendantsOption
+
import java.time.OffsetDateTime
import org.onap.cps.integration.base.CpsIntegrationSpecBase
import org.onap.cps.rest.utils.MultipartFileUtil
@@ -44,11 +46,21 @@ class CpsPerfTestBase extends PerfTestBase {
}
def createInitialData() {
+ createWarmupData()
createLargeBookstoresData()
addOpenRoadModel()
addOpenRoadData()
}
+ def createWarmupData() {
+ def data = "{\"bookstore\":{}}"
+ stopWatch.start()
+ addAnchorsWithData(1, CpsIntegrationSpecBase.BOOKSTORE_SCHEMA_SET, 'warmup', data)
+ stopWatch.stop()
+ def durationInMillis = stopWatch.getTotalTimeMillis()
+ recordAndAssertPerformance('Creating warmup anchor with tiny data tree', 250, durationInMillis)
+ }
+
def createLargeBookstoresData() {
def data = CpsIntegrationSpecBase.readResourceDataFile('bookstore/largeModelData.json')
stopWatch.start()
@@ -80,7 +92,17 @@ class CpsPerfTestBase extends PerfTestBase {
cpsAdminService.createAnchor(CPS_PERFORMANCE_TEST_DATASPACE, schemaSetName, anchorNamePrefix + it)
cpsDataService.saveData(CPS_PERFORMANCE_TEST_DATASPACE, anchorNamePrefix + it, data, OffsetDateTime.now())
}
+ }
+ def 'Warm the database'() {
+ when: 'get data nodes for warmup anchor'
+ stopWatch.start()
+ def result = cpsDataService.getDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, 'warmup1', '/', FetchDescendantsOption.OMIT_DESCENDANTS)
+ assert countDataNodesInTree(result) == 1
+ stopWatch.stop()
+ def durationInMillis = stopWatch.getTotalTimeMillis()
+ then: 'all data is read within 15 seconds (warm up not critical)'
+ recordAndAssertPerformance("Warming database", 15_000, durationInMillis)
}
}
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy
index 753faf44f1..30e8bf23d4 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy
@@ -42,10 +42,10 @@ class GetPerfTest extends CpsPerfTestBase {
recordAndAssertPerformance("Read datatrees using ${scenario}", durationLimit, durationInMillis)
where: 'the following xpaths are used'
scenario | anchorPrefix | xpath || durationLimit | expectedNumberOfDataNodes
- 'bookstore root' | 'bookstore' | '/' || 25_000 | 78
- 'bookstore top element' | 'bookstore' | '/bookstore' || 1_000 | 78
- 'openroadm root' | 'openroadm' | '/' || 1_000 | 2151
- 'openroadm top element' | 'openroadm' | '/openroadm-devices' || 10_000 | 2151
+ 'bookstore root' | 'bookstore' | '/' || 130 | 78
+ 'bookstore top element' | 'bookstore' | '/bookstore' || 130 | 78
+ 'openroadm root' | 'openroadm' | '/' || 750 | 2151
+ 'openroadm top element' | 'openroadm' | '/openroadm-devices' || 750 | 2151
}
}
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy
index 939281a73c..87327030c7 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy
@@ -21,12 +21,11 @@
package org.onap.cps.integration.performance.ncmp
import java.util.stream.Collectors
-
+import org.onap.cps.integration.performance.base.NcmpRegistryPerfTestBase
+import org.springframework.dao.DataAccessResourceFailureException
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import org.onap.cps.integration.performance.base.NcmpRegistryPerfTestBase
-
class CmHandleQueryPerfTest extends NcmpRegistryPerfTestBase {
def objectUnderTest
@@ -52,14 +51,13 @@ class CmHandleQueryPerfTest extends NcmpRegistryPerfTestBase {
assert countDataNodesInTree(result) == 5 * 999
}
- def 'Multiple get limitation: 32,764 (~ 2^15) xpaths.'() {
+ def 'Multiple get limit exceeded: 32,764 (~ 2^15) xpaths.'() {
given: 'more than 32,764 xpaths)'
- def xpaths = []
- (0..32_765).each { xpaths.add("/size/of/this/path/does/not/matter/for/limit[@id='" + it + "']") }
- when: 'get single get is executed to get all the parent objects and their descendants'
+ def xpaths = (0..32_764).collect(i -> "/size/of/this/path/does/not/matter/for/limit[@id='" + i + "']")
+ when: 'single get is executed to get all the parent objects and their descendants'
cpsDataService.getDataNodesForMultipleXpaths(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_ANCHOR, xpaths, INCLUDE_ALL_DESCENDANTS)
- then: 'no exception is thrown (limit is not present in current implementation)'
- noExceptionThrown()
+ then: 'an exception is thrown'
+ thrown(DataAccessResourceFailureException.class)
}
}