Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Performance issue with RPC calls

  • ritapas
  • ritapas's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 1 month ago - 4 years 1 month ago #194797 by ritapas
Performance issue with RPC calls was created by ritapas
Hello, I'm taking my first steps in php programming, sorry if the question will look dumb.
I'm trying to write a simple php script to estract some basic infor from the survey list in a CSV format, from our Limesurvey 3.14.
We have almost 3000 survey there.

This part of the script takes a loooot to run, about two hours.
Code:
  foreach ($groups as $survey) {
    $survey_id =  $survey['sid'] ;
    $result = $myJSONRPCClient->get_survey_properties($sessionKey,$survey_id,$baseproperties);
    $stats=$myJSONRPCClient->get_summary($sessionKey, $survey_id);
 
    if (empty($stats) ||  !isset($stats['full_responses'])) {
        $stats=  array ('completed_responses' => 0,'incomplete_responses' => 0,'full_responses' =>   0);
    }
    echo "<tr>";
    echo "<td>". $survey['sid'] . "</td>";
    echo "<td>". $result['active'] . "</td>";
    echo "<td>". $survey['surveyls_title'] . "</td>";
    echo "<td>". $result['datecreated'] . "</td>";
    $user = $myJSONRPCClient->list_users( $sessionKey, $result['owner_id'] );
    echo "<td>". $user[0]['users_name'] . "</td>";
    $country = substr($user[0]['users_name'], 0, 2);
    echo "<td>". $country . "</td>";
    echo "<td>". $stats['completed_responses'] . "</td>";
    echo "<td>". $stats['incomplete_responses'] . "</td>";
    echo "<td>". $stats['full_responses'] . "</td>";  
    echo "</tr>";
 
    array_push($_SESSION['surveyStats'], array($survey['sid'], $survey['active'], $survey['surveyls_title'],
      $result['datecreated'], $user[0]['users_name'], $country, $stats['completed_responses'],
      $stats['incomplete_responses'], $stats['full_responses']));
 
    $_SESSION['completeResponses'] +=  $stats['completed_responses'];
    $_SESSION['incompleteResponses'] +=  $stats['incomplete_responses'];
    $_SESSION['allResponses'] +=  $stats['full_responses'];
    if ($result['active'] == "Y") {
      $_SESSION['activeSurveys']++;
    }
    else {
      $_SESSION['inactiveSurveys']++;
    }
    $_SESSION['allSurveys'] ++;
    if ($_SESSION['completeResponses'] + $_SESSION['incompleteResponses'] != $_SESSION['allResponses']) {
      echo "OPS!" . $newline;
    }
 
  }

Is it me, so I'll have to study more about php code performance tuning, or it is common to have such a long time?
The server uses SSL.

Thank you
Rita
Last edit: 4 years 1 month ago by ritapas.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose