VMware Cloud Community
EchoBravo
Contributor
Contributor

Slow Perf with getIAASCatalogItemFromNameAndBG

I try to figure a way to optimize this action getIAASCatalogItemFromNameAndBG, it takes around 7min to execute it (more than 2500 VM's).

I guess I found a way to make the query in  few seconds, but I would like your feedback about what I have done, and to be sure that both actions give the same result

Best Regards,

Manuel

Input:

    bg: vCACCAFE:BusinessGroup

    vcachost: vCACCAFE:VCACHost

Output:

    att0 : vCACCAFE:CataloItem

Script:

    var service = vcachost.createCatalogClient().getCatalogConsumerResourceService();

    System.debug("**************Start of TEST1**********");   

    var CIname='%CI_NAME%'

    var filter = new Array();

    filter[0]= vCACCAFEFilterParam.substringOf("organization/subTenant/id", vCACCAFEFilterParam.string(bg.id));

    filter[1] = vCACCAFEFilterParam.substringOf("catalogItem/name", vCACCAFEFilterParam.string(CIname));

    filter[2] = vCACCAFEFilterParam.substringOf("owners/ref", vCACCAFEFilterParam.string("%SamAccount@AD.FQDN%"));

    var query = vCACCAFEOdataQuery.query().addFilter(filter);

    var items = service.getResourcesList(new vCACCAFEPageOdataRequest(query));

    System.debug("pouet label:   "+items[0].getCatalogItem().getLabel());

    System.debug("pouet ID:   "+items[0].getCatalogItem().getId());

    var att0 = items[0];

    System.debug("**************end of TEST1************");

Output:

    [2016-08-18 16:45:11.587] [D] **************Start of TEST1**********

    [2016-08-18 16:45:11.735] [D] pouet label:   %CI_NAME%

    [2016-08-18 16:45:11.735] [D] pouet ID:   %CI_NAME_GUID%

    [2016-08-18 16:45:11.735] [D] %resourceItem.name%

    [2016-08-18 16:45:11.736] [D] BluePrint ID :DynamicWrapper (Instance) : [vCACCAFEProviderBinding]-[class com.vmware.vcac.catalog.rest.stubs.ProviderBinding]

            -- VALUE : Binding id: 9be2c382-5a89-4715-a882-227190e34310, Provider: {id: 4e9b938a-5670-4631-a664-eda6252d8d51, label: iaas-service}

    [2016-08-18 16:45:11.736] [D] **************end of TEST1************

0 Kudos
0 Replies