We are using a custom Groovy script to retrieve and filter assets from a Maven repository. We are trying to optimize the performance for the script and noticed the storage query’s execution is the culprit, regularly taking 1.5-2+ seconds to complete.
def repo = repository.repositoryManager.get("my-repo-name")
StorageFacet storageFacet = repo.facet(StorageFacet)
StorageTx tx = storageFacet.txSupplier().get()
try {
tx.begin()
Query.Builder query = Query.builder()
.where("component.group").eq(request.groupId)
.and("component.name").eq(request.artifactId)
.and("blob_created > ").param(request.startDate)
log.info("before query")
Iterable<Asset> results = tx.findAssets(query.build(), [repo])
log.info("after query")
} finally {
tx.close()
}
We are wondering if performance is related to our usage of component.group
and component.name
; are these non-indexed fields?
Our custom script is primarily so we can retrieve only “recent” artifacts through a client-provided startDate
value (we didn’t see a similar way to accomplish with the Search API; no way to sort by date). If there is a different way to accomplish, we are interested to know!
We are using Nexus OSS with fairly standard install config. We have artifact purging for the repository for ~6 months.
Thanks!