View Issue Details

IDProjectCategoryView StatusLast Update
0013680mantisbtperformancepublic2014-12-22 08:23
ReporterJanHegewald Assigned Todregad  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Target Version1.2.13Fixed in Version1.2.13 
Summary0013680: Configuration page takes a very long time to load
Description

Loading the configuration page (adm_config_report.php) takes a very long time, for example I have got 1,394 configuration entrys in mantis_config_table and the page loads for over 60 seconds.

Is there a way to reduce this loading duration?

TagsNo tags attached.
Attached Files
cachegrind.out.rar (800,634 bytes)
screenshot.png (22,378 bytes)   
screenshot.png (22,378 bytes)   

Relationships

related to 0012113 closeddregad Configuration Report should be located somewhere else in the web interface 
related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
related to 0014559 closeddregad Adding filter for "Configuration report" 
related to 0015347 closeddregad Bad performance and memory issue with print_user_option_list 

Activities

JanHegewald

JanHegewald

2011-12-15 05:25

reporter   ~0030623

Last edited: 2011-12-15 05:26

Additional information: this happens on 1.2.1.

And my php log tells me, that most of the time the problem is because of this line in session_api.php (line 154): $_SESSION[ $this->key ][ $p_name ] = serialize( $p_value );

Edit: removed typo

rombert

rombert

2011-12-16 08:56

reporter   ~0030636

Can you share the contents of your config table? Alternatively, please attach the result of loading the page with xdebug profiling enabled ( http://xdebug.org/docs/profiler ).

JanHegewald

JanHegewald

2011-12-19 05:09

reporter   ~0030653

I attached an output file of xdebug profiler. Because the file has a size of around 34 MB, I had to pack it. I hope this is ok.

One additional information: every time I reload the page, it gets slower. It's slowing down approx. 2 to 5 seconds per reload. When I close the browser (Firefox 8.0), wait for some time, open the browser again and reopen the config page, it loads very much faster (around 5 secondes for the first time, I think).

rombert

rombert

2011-12-19 06:21

reporter   ~0030654

Thanks for the profiling output. It seems that printing a button ( for each modified configuration option ) triggers a lot of work behind the scenes, which creates performance problems. I do not have an immediate solution, but I'll target this towards 1.2.x .

JanHegewald

JanHegewald

2012-01-04 04:27

reporter   ~0030785

Last edited: 2012-01-04 04:40

Thanks for your feedback!

Edit: it seems that commentig out the lines in adm_config_report.php where the button is generated fixes the issue temporary. Now the duration for page load is constant or even decreasing a little bit. I know that this is just a temporary solution, but for now it's perfect for me.

Again, thanks for investigating!

atrol

atrol

2012-01-04 05:52

developer   ~0030786

Maybe another workaround:
If you want the buttons and can live with a possible security risc (protection against Cross-Site Request Forgery) add the following line to config_inc.php
$g_form_security_validation = OFF;

dregad

dregad

2012-01-04 07:33

developer   ~0030791

The bottleneck is actually the serialize/unserialize calls performed while storing/retrieving the token from the PHP session.

Maybe we could shift to json encoding to improve performance ?

https://bugs.php.net/bug.php?id=51267
http://stackoverflow.com/questions/804045/preferred-method-to-store-php-arrays-json-encode-vs-serialize

dhx

dhx

2012-06-02 07:50

reporter   ~0031981

Our CSRF support at present is far from being user friendly or sane from a performance perspective. There is no reason why we need multiple CSRF tokens per page load. We don't even need a unique CSRF token for each page load. This is something we need to fix in a future release.

dregad

dregad

2012-12-14 15:53

developer   ~0034543

@dhx I suppose you were referring to https://github.com/mantisbt/mantisbt/commit/a45d0ef551e9359d3a469287f5de8ef08096e12f ?

dregad

dregad

2012-12-28 19:06

developer   ~0034638

I have implemented basic filtering on the manage config page which I believe would be an effective workaround for the performance issue reported here, thanks to the default filter criteria.

Please have a look at https://github.com/dregad/mantisbt/tree/manage-config - testing and feedback would be appreciated.

dregad

dregad

2013-01-02 09:30

developer   ~0034664

Reminder sent to: dhx

@dhx,

I made an attempt at fixing this issue [1] and would appreciate if you could take a look at the changes I made. Let me know what you think.

[1] https://github.com/dregad/mantisbt/tree/fix-13680

dhx

dhx

2013-01-03 08:31

reporter   ~0034690

@dregad: Thanks for the reminder and proposed patch. I've reviewed https://github.com/dregad/mantisbt/commit/db0e3d3b103750197cbc656323ff2984f803fa47 and it looks good to commit. Keep up the good work :)

dregad

dregad

2013-01-06 19:31

developer   ~0034719

Thanks for feedback dhx.

For the record, I did some benchmarking for this patch, using a sample DB having a bit less than 700 records in mantis_config_table, configuring the filter as appropriate to display all of them, for the following branches:

baseline: current 1.2.x branch HEAD (commit 66050dc2)
case 1: filter branch https://github.com/dregad/mantisbt/tree/fix-14559
case 2: performance fix branch https://github.com/dregad/mantisbt/tree/fix-13680

Average execution times on 3 runs (as reported at page bottom by $g_show_timer) are as follows:

baseline: 13.3 seconds
1: 20.1 seconds (due to displaying 2 buttons per line instead of 1)
2: 1.4 seconds

I have a bit more testing to do on other aspects of the feature branch https://github.com/dregad/mantisbt/tree/manage-config before merging.

grangeway

grangeway

2013-04-05 17:56

reporter   ~0036075

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master-1.2.x 259f95cd

2012-12-14 10:10

dregad


Details Diff
Issue 0014559: improve adm_report_config.php filter

The following changes were made

- revised UI to make it more similar to the issues filter
- make use of existing constants and language strings
- filter defaults to All Users / All Projects / All options which avoids
performance issues in installations having a large number of entries
in the config table (workaround for issue 0013680)
- filter form uses post instead of get method
- comply to coding guidelines
Affected Issues
0013680, 0014559
mod - adm_config_report.php Diff File
mod - lang/strings_english.txt Diff File
mod - lang/strings_french.txt Diff File

MantisBT: master-1.2.x db0e3d3b

2013-01-02 08:13

dregad


Details Diff
Fix performance issue on adm_config_report.php

In systems with large numbers of config items in mantis_config_table, the
Configuration Report page can take a very long time to load.

This behavior is due to each of the 'Delete' buttons being printed with
its own form, each one having a security token. The performance
bottleneck is actually the serialize/unserialize calls executed while
storing/retrieving the token from the PHP session.

To avoid this problem, the print_button() and form_security_field()
functions have been modified to accept a security token as an optional
parameter. This allows the calling page to generate a single token,
which is shared by all buttons.

Furthermore, print_button() also allows the security token parameter to
be 'OFF', which prevents the function from displaying a security field.
This is useful for buttons not resulting in modifications (i.e. not
requiring CSRF protection).

Fixes 0013680
Affected Issues
0013680
mod - adm_config_report.php Diff File
mod - core/form_api.php Diff File
mod - core/print_api.php Diff File

MantisBT: master 5c3ac412

2013-01-02 08:13

dregad


Details Diff
Fix performance issue on adm_config_report.php

In systems with large numbers of config items in mantis_config_table, the
Configuration Report page can take a very long time to load.

This behavior is due to each of the 'Delete' buttons being printed with
its own form, each one having a security token. The performance
bottleneck is actually the serialize/unserialize calls executed while
storing/retrieving the token from the PHP session.

To avoid this problem, the print_button() and form_security_field()
functions have been modified to accept a security token as an optional
parameter. This allows the calling page to generate a single token,
which is shared by all buttons.

Furthermore, print_button() also allows the security token parameter to
be 'OFF', which prevents the function from displaying a security field.
This is useful for buttons not resulting in modifications (i.e. not
requiring CSRF protection).

Fixes 0013680
Affected Issues
0013680
mod - adm_config_report.php Diff File
mod - core/form_api.php Diff File
mod - core/print_api.php Diff File