View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0005433 | mantisbt | performance | public | 2005-04-13 01:38 | 2009-06-26 12:05 |
| Reporter | allenwagner | Assigned To | grangeway | ||
| Priority | normal | Severity | crash | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 0.19.2 | ||||
| Summary | 0005433: Performance issues with view all issues | ||||
| Description | We are having major performance problems with view all issues. Time is at best 6 second when running from the same box. When running remotely we get fatal errors due to 30 second timeout. If we set the filters to only return 25 issues, instead of the default 50 it will come back to us, but is still very slow. I tried to update the PHP.ini file to allow 60 seconds, and that does not seem to take effect, even after restarting IIS and finally rebooting the server. Any other location that I should try to set this? This is info from a fairly quick return on this system, filtering with 25 issues instead of 50.Mantis 0.19.2 | ||||
| Additional Information | The Server is Windows 2003 Server, IIS 6.0, running Mantis 19.2, PHP 4.3.10, and MYSQL 4.1.10. | ||||
| Tags | No tags attached. | ||||
| Attached Files | ldap_email.diff (963 bytes)
diff --git a/core/user_api.php b/core/user_api.php
index d41d0d6..83f2103 100644
--- a/core/user_api.php
+++ b/core/user_api.php
@@ -37,6 +37,7 @@
# being spoofed if register_globals is turned on
$g_cache_user = array();
+ $g_cache_ldap_email = array();
# --------------------
# Cache a user row if necessary and return the cached copy
@@ -708,12 +709,22 @@
# lookup the user's email in LDAP or the db as appropriate
function user_get_email( $p_user_id ) {
$t_email = '';
+
if ( ON == config_get( 'use_ldap_email' ) ) {
- $t_email = ldap_email( $p_user_id );
+ global $g_cache_ldap_email;
+
+ if ( isset( $g_cache_ldap_email[$p_user_id] ) ) {
+ $t_email = $g_cache_ldap_email[$p_user_id];
+ } else {
+ $t_email = ldap_email( $p_user_id );
+ $g_cache_ldap_email[$p_user_id] = $t_email;
+ }
}
+
if ( is_blank( $t_email ) ) {
$t_email = user_get_field( $p_user_id, 'email' );
}
+
return $t_email;
}
| ||||
|
The filter code has been improved over the last few months. I've measured 25-50% faster in my experiments. Would it be possible to retest this with a CVS image? |
|
|
I did grab the latest version of view_all_bug_page.php, view_all_inc.php, and filter_api.php from CVS. What else would you recommend that I try? |
|
|
I'd have a look on MySQL configuration. I know of a large institution using mantis that had problems with large number of issues and MySQL was the problem, not Mantis. |
|
|
I have experience poor Mantis peformance in many circumstances - I finally noticed the very large number of queries executed to do thing like display a list of bugs. Rendering such a screen should take 10 queries or less, even if it needs to gather configuration, rights, etc. data from the DB. In particular things like this exhibit the dreaded "N+1" problem: 63 0.0004 SELECT last_modified FROM mantis_bugnote_table WHERE bug_id='136' ORDER BY last_modified DESC and other things that are just silly, like running the same query 3 times: 7 0.0005 SELECT id FROM mantis_custom_field_table ORDER BY name ASC I will sponsor this issue, we will happily kick in $50 for a version that doesn't do these things. |
|
|
Can you retest this with 1.0.0rc5? As I said, there have been significant changes in the filters since 0.19.2. |
|
|
yes; I had tested it with Mantis 1.0.0rc5. Here is a list of SQL queries from Mantis 1.0.0rc5; 82 queries to populate the "View Issues" screen. 1 0.0591 SELECT id FROM mantis_user_table WHERE cookie_string='e974aa6fca8cf495770a24c929245a8aa83d452d2c3b2ea07e7d948923d704a6' |
|
|
I also noticed, at the bottom of this very page, that it 1.0.0rc5 (running here) uses 53 queries to get the data for this bug detail page. Wow. |
|
|
The many references to bugnote_table is fixed in 1.1 (CVS HEAD). The multiple reads of the custom_field table needs to be fixed. |
|
|
I am happy to hear the worst of it (the N+1 fetch of that field) is fixed. I will continue to sponsor any effort towards fixing the rest of the superflous queries. |
|
|
Could you note which files were modified for the bugnote_table fix (describe in Note 0011978)? I tried examining the nightly tarball, but there don't appear to have been any changes since the release of 1.0.0rc5. Thanks! |
|
|
fix for custom field caching submitted to CVS core/custom_field_api.php -> 1.58 |
|
|
I've written a query which eliminates query 12 and queries 29-79 (with the exception of the mantis_user_table queries). This can be further modified to return all of this data in one query, but I lost motivation once this was complete. I'll post the entire thing here in the hopes that someone more familiar with the Mantis structure can incorporate it. Note that this was written using the query output, so will probably need heavy updating. SELECT DISTINCT mantis_bug_table.*, count(mantis_bugnote_table.id) as num_notes |
|
|
Hi all, Looking at the above: And comparing to the bugs.mantisbt.org on 50 queries: kylecordes: how do you find 1.1.0a3 ? Paul |
|
|
Do we still have issues to fix with the 1.1.0a3? |
|
|
I am having a similar performance problem with the "View Issues" page (not any other pages). Consistent timings of up to 21sec to load page, however SQL queries only appear to take up a small portion of that total time: Time: 11.468594 seconds. We only have 120 bugs! System info: Please help, my users are threatening to go back to a paper-based system! |
|
|
I have changed the following setting in config_inc.php OLD NEW We are using LDAP for authentication. I do not understand why this would affect performance, but now our View Issues page loads in under 1 sec! I have concerns about new users, having read posts that this setting provides a confirmation email and the ability to log into the system. |
|
|
I have had to do the same thing regarding the LDAP setting. I was activating LDAP on our development box today and when it has email=ON it slows to a crawl. With it OFF it runs like a champ. |
|
|
Option 1: This specifies the access level that is needed to get the mailto: links.
Option 2: To Do:
|
|
|
Since adding view_user_page.php I think the LDAP stuff won't be causing too much grief. I'd be interesting to know if i'm right on this, i.e. ldap_email can be set to ON now. If i'm correct, I think this issue can probably be marked as resolved. Paul |
|
|
Option 1: Try to use mysql 5.x and then optimize my.ini for myISAM not innoDB mantis_bugnote_table Do one by one and test.. NOTE: I do not know what effect this will have on overall mantis. I dont think it will do anything since the engine type is controlled on the mysql db program level and does NOT effect connection type ect in php. Will there be a relational effect? I dont know. Backup and test.. if problem restore. BACKUP RESTORE NOTE: In windows there is NO space between the -p switch and the password. Dont know what is up with that. I think in NIX this is not a problem. ANYWAY, 226 total queries executed. 89 unique queries executed. 11 seconds.. HOLY COW!!!.. Using version 1.1.4 with mysql 5.x on php 5.x, I have a 40 row view all page.. I have 17 columns of data most of which are custom feilds.. I have moded filters to include searches for custom feilds which increaes the query overhead slightly.. I currently get the following: Time: 1.221699 seconds. This is on a slow core 2 e2140 (like 1.6 ghz x 2) with 2 gig ram test box with vista (not even server 2008 which is roughly 30% faster kernel). My time is slightly better using my IIS7 test server versus apache 2.x.. Yes IIS7 is FINALLY FASTER than apache. I am supprised as well. Has to do with compression and a well tuned fast-cgi which beats apache now. PROBLEM BACKGROUND. See http://www.mantisbt.org/bugs/view.php?id=9876 ..Basicaly I resolved a simular performance issue that made my page load time 25 times faster.. had 2000 projects grouped into 8 subprojects.. load times went from 30 seconds to 1.x seconds on a 40 row view all page. I dont have an explaination other than innodb is known to provide faster performance for many items. P.S. If you have a dual core processor on your sever.. make sure to check affinity to see if both CPUs are used when php is exacuted. |
|
|
Sorry - I forgot to tell you the storage engine type for option 3. "Charge Storage Engine type for the folowing tables.. to INNODB</>: |
|
|
tmatijas: I'm somewhat surprised, as my understanding with myisam was slightly faster than innodb. What optimisation/changes had been made to my.cnf ? regarding IIS vs apache - with the optimisations MS have done to php/fastcgi, I'm not sure i'm necessarily surprised at this. 540 total queries executed. Is that rnning 1.1 ? I wouldn't expect to be seeing those sorts of query numbers in 1.2.x alphas. If you are, i'd be interested to know on what page. Paul |
|
|
Hi grangeway. I am not a mysql expert. But my undertsanding is that for small amounts of data, INNODB is faster than MYISAM by 6 to 9%.. With large transactions, MyISAM is supposed to be better. However, for some reason and I do not know why, in my test when i had the 2000 projects ungrouped into subprojects VERSUS 2000 subprojects that are now grouped into 8 projects; the difference was night and day... 30 second load time with myISAM versus 2 seconds with INNODB. I am still unclear as to why. Perhaps it had to do with the ">>" character in subprojects. I applied a fix for the strang characters with amphersands (&). This uses a nonstandard character. I read somewhere about problems in myISAM with nonstandard "foreign" characters. Other than that, I cannot explain why this is.. But i am confident that it is replicateable using info in http://www.mantisbt.org/bugs/view.php?id=9876 Right now I am developing around 1.1.4 since there is something about 1.2x that I dont like. I do have test versions for 1.1.1, 1.1.4, 1.1.5 and 1.2.x that I have been experimenting with. The reason so many queries I think is because
Essentially ROWS x COLUMNS = TOTAL QUERIES. I think this is the way it works. I also understand that this changes with optimizations in the mantis core that I guess groups query data into some kind of array - I am not sure how this works but I do know that the community has come up with ways to reduce the load on sql by doing less queries. Question: Lets say I want to optimize queries and continue to use 1.1.x which is my real choice at this point until the dev team (and community) fixes all the problems with 1.2.x.. What code (or files) from 1.2.x in terms of optimization code for queries can I try to merge/replace in 1.1.4 to make this more efficient. With my dual core test server (which is really my desktop), 1.22 seconds to veiw 40 rows is considered acceptable. However, ON the final server, I am running a pair of xeons of older design and they are slower and I will run on apache web server NOT IIS which will also run a little slower.. 1.2 seconds will probably become 4 seconds under normal load which is what I expect all the time since the end users will be realtivly small group with no anonymous transactions or viewings. Perhaps using mantis 1.2x optimizaions is actually a very good idea in any case. As for my.ini.. I mainly tweaked it for use with myisam and not even innodb per recommendations on www.mysqlperformanceblog.com .. Main ones include the following: default-storage-engine=MyISAM At some point I tried to juice BOTH myisam and innodb performance since I am using a mixed environment that uses both.. I got realy good results with the following: default-storage-engine=MyISAM Many of these depend on how much system memory you have. www.mysqlperformanceblog.com gives EXCELLENT explainations. See http://www.mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation/ |
|
|
I'm going to try and do some testing with your structure - against 1.2. i.e. a large number of projects, a large number of subprojects and a large number of custom fields. If you don't mind pasting it, record counts from /admin/db_stats.php would be interesting to see. I've just assigned 0006325 to me to remind me to take a look at it. And final question, given that 1.2 will replace 1.1, 'there is something about 1.2x that I dont like' -> i'm just wondering what you don't like about the direction 1.2 is heading Paul |
|
|
ABOUT THE DB STATS: ABOUT VERSION 1.2 One thing you guys are missing is a real-time chatting system. I have integrated the one by crafty which is an excellent solution. It allows you to have a live operator that can answer questions.. As you know, there are a ton of open source GPL version... Would probably be very easy for you guys to integrate one of your own design I’m sure. From what I can see, mantis is one of the most well designed open source php projects I have come across. You guys have put a lot of thought into the engineering of global controls ect. and I am thoroughly impressed. You guys get a 10 out of 10 in my book. As soon as I can, I am going to start donating a few bucks here and there to you guys to help support the effort. Paul I do have an off topic question. Is there some sort of backdoor alerting system that notifies you of every implementation of mantis (built into mail_api perhaps)? Funny thing happened.. I am not yet complete with my project and my mantis builds are preproduction. I have not published this site officially and only have 12 test accounts and only 1 (mine) is in use. However, someone from mantistracker@yahoo.com who calls himself clipper12 has tried to sign up for an account. I traced his IP to Romania... 79.117.11.115 I then did a Google search using keywords "mantis clipper12" and what do you know - there are countless versions of mantis all over the place in many countries who have a registered user using that clipper12 name. Try yourself: http://www.google.com/search?hl=en&rls=com.microsoft:*&q=mantis+clipper12&start=0&sa=N I really don’t care all that much as we have nothing to hide.. but this seems a little suspicious and I am not sure I want management members of our team accidentally giving permissions that they should not give to this person. If you want to address this personally, please send me an email at portcharlottedisposal - AT - hotmail.com. Please let me know. Best, P.S. One more thing about having a ton of projects.. The project management page lists all projects in an array. I had to set the timeouts on php and mysql higher to finish loading the page when I was running the 2000 project test. Perhhaps breaking it down alphabetically like in user mangament would be a worthwhile effort for those with lots of projects. This is particularly helpfull for developers who develop plugins for like photoshop ect. It is not uncommon for them to have 20 or 30 open developments at one time. I bet you can rehash much of the same code from user management to make it so. I will see what I can slap together as well as soon as I get some free time. My php kindoff sucks but I have some degree of skill. |
|
|
Ok thanks tom - regarding the other points, I'll move to email as it's gone off topic. Regarding notifications - afaik, we have no way of knowing where mantis is installed, so no. Paul |
|
|
Sound good Paul. Please feel free to email me any time. As for clipper12, I think I might know what is going on.. but it is just a hunch. Will discuss in email. Best, Tom |
|
|
Hi paul - I have the results.. keep in mind I only have about 50 bug report tickets give or take in both tests: -- db_stats.php on 2000 projects NOT grouped into subprojects: -- db_stats.php on 2000 projects GROUPED into 8 subprojects: For these time tests below, i am only changing innodb for mantis_project_hierarchy_table ONLY.. I have not bothered to retweek my.ini for performance either. I could probbaly gain 30% boost overall performace if I wanted to which would match what I reported earlier. However this is not nessesary for testing purposes and I will eliminate those tweaking variables. In any case, these tests are for 2000 projects grouped into 8 subprojects Load time - news page with myisam results (HOLY COW!): Load time - news page with innodb results:
|
|
|
I believe the issues covered in this bug report are mainly fixed in git trunk i.e. (ldap +lots of bugnote queries). There's a seperate issue tracking how we handle large number of projects If there's any issues remaining in git trunk, please open a new issue covering those specific problems. Paul |
|