Forums | Mahara Community

Developers /
Latency smarty header_logo_small


Aurelien Besson's profile picture
Posts: 12

03 May 2019, 3:25

public function header_logo_small() {
          if (!empty($this->headerlogosmall)) {
                    returnget_config('wwwroot') .'thumb.php?type=logobyid&id='.$this->headerlogosmall;
          }
          else {
                    require_once('ddl.php');
                    $table = newXMLDBTable('institution');
                    $field = newXMLDBField('logoxs');
                    if (field_exists($table, $field) && $sitelogosmallid = get_field('institution', 'logoxs', 'name', 'mahara')) {
                              returnget_config('wwwroot') .'thumb.php?type=logobyid&id='.$sitelogosmallid;
                    }
          }
          returnfalse;
}
 
 
In this function compare to header_logo, why using ddl.php and newXMLDBTable / Field. It's not ncessary and that's create many latency when i test with a profiler.
 
Thank You
Robert Lyon's profile picture
Posts: 773

03 May 2019, 12:24

Hi Aurelien,

The reason we have the field_exists() call for when one is upgrading from an older version that field wont exist yet and so breaks site / not allow them to upgrade.

Having said that we should use a more direct test to see if table column exists rather than creating the table / field xml objects and testing via adodb.

As we only use support mysql / postgres we could have a simplified function to do this and hopefully reduce the overhead

I've begun a bug report https://bugs.launchpad.net/mahara/+bug/1827445 and created a patch https://reviews.mahara.org/#/c/9950/ to deal with this.

From my initial tests there does seem to be an improvement in doing the check directly via a database call in both  postgres and mysql

Cheers

Robert

Aurelien Besson's profile picture
Posts: 12

04 May 2019, 0:29

Thank you for your reply,

Good news, i continue my work to try to improve performance.

Regards

Kristina Hoeppner's profile picture
Posts: 4863

04 May 2019, 9:42

Hi Aurelien,

It would be wonderful if you tested the change that Robert made at https://reviews.mahara.org/#/c/9950/ over the course of the development work and checked from your end if you see improvements.

You can use your Launchpad ID to log into the review system and add yourself as reviewer to be notified when changes are made.

Thank you

Kristina

Aurelien Besson's profile picture
Posts: 12

09 May 2019, 0:22

Hi Kristina,

Here the result for 125 users concurrent in 30 minutes (using Jmeter), see the graphs

Before your modification :

responseTimeDistribution_before.png

After your modification :

responseTimeDistribution_after.png


There is a major improvement in response time. We should continue our work to identify where the code consume more ressources and returns a long reponse time.

Regards

 

Kristina Hoeppner's profile picture
Posts: 4863

12 May 2019, 11:29

Thank you for the testing and sharing the results, Aurelien.

Cheers

Kristina

6 results