ovh/php-ovh

[Public Cloud] Very slow loading

stonebuzz opened this issue · 0 comments

Hello OVH team,

I'd like to tell you about a problem I'm currently experiencing while writing a script to retrieve information about Public Clouds.

I currently have 3 projects containing public clouds for a total of around 100 instances

This simple script

try {
    $ovh = new Api(
        $application_key,
        $application_secret,
        "ovh-eu",
        $consumer_key
    );

    $all_project = $ovh->get('/cloud/project'); // load all project
    foreach ($all_project as $project_name) { // foreach instance
        $ovh_project_infos                  = $ovh->get('/cloud/project/' . $project_name); // get project infos
        $ovh_project_instances = $ovh->get('/cloud/project/' . $project_name . '/instance'); // get all instances for this project
        foreach ($ovh_project_instances as $instance) { // foreach instance
            $ovh_instance_infos                 = $ovh->get('/cloud/project/' . $project_name . '/instance/' . $instance['id']); // get instance info
            $ovh_interface_infos[$instance['id']]  = $ovh->get('/cloud/project/' . $project_name . '/instance/' . $instance['id'] . '/interface'); // get instance interface
        }
    }
} catch (\Throwable $e) {
    error_log('Failed to get data for Public Cloud ');
}

takes about 5 minutes to retrieve the information.

Is there a problem with my script?

How can I improve response times from the API?

Best regards