View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 19452 | Bug reports | Other | public | 2024-03-01 13:16 | 2024-04-02 14:01 |
| Reporter | tibor.pacalat | Assigned To | |||
| Priority | none | Severity | tweak | ||
| Status | closed | Resolution | fixed | ||
| Product Version | 6.4.x | ||||
| Summary | 19452: Improve usage of getQuestionAttributes | ||||
| Description | This is a follow-up of another ticket where we have found a simple way to improve performance overall, as can be seen at the PR Short description of the improvement: Earlier the method only supported to get integers representing a question through its ID, querying the question and caching it for the next time. However, when I tested this with a survey having 600+ questions and clicked on any of the left menu tabs, the method was called separately for all questions, leading to 1 + 600+ queries to the database, the first query loading all questions together, then looping the questions, passing their id and loading the question from database despite the fact that it was already loaded. The solution to that problem was to allow this method to receive a question object instead of an id and consequently use that object and cache it rather than loading it again, reducing the number of queries for questions in this context from 1 + n to 1 and having this magnitude of speed improvement when the survey had more than 600 questions (image1). What we need in order to further improve is to apply this idea to other usages of the method, with the pattern of the action we desire to do looking like this:
So, we will need to review and refactor the usages of this method with the aim of: Maybe we could create a PR for each of the files referring this method at:
Further research needed in order to improve performance, make the server more reliable and scalable:
This ticket is also available in JIRA https://limesurvey.atlassian.net/browse/MW-1040, but please keep the communication about it here, so we have everything in the same place. | ||||
| Steps To Reproduce | Steps to reproduce(Replace this text with detailed step-by-step instructions on how to reproduce the issue) Expected result(Write here what you expected to happen) Actual result(Write here what happened instead) | ||||
| Additional Information | Add 3. wherever possible : load the needed question objects via a single query | ||||
| Tags | No tags attached. | ||||
| Attached Files | |||||
| Bug heat | 8 | ||||
| Complete LimeSurvey version number (& build) | 6.4.9+240226 | ||||
| I will donate to the project if issue is resolved | No | ||||
| Browser | |||||
| Database type & version | . | ||||
| Server OS (if known) | |||||
| Webserver software & version (if known) | |||||
| PHP Version | . | ||||
| Git branch / Pull Request URL | N/A | ||||
|
Hi @DenisChenu @gabrieljenik! This is the ticket I talked about. Thank you very much in advance! |
|
Maybe start by a PR with existing Question objetc (we already have/use Question object on the function) |
|
I do not understand what you mean. Can you please clarify? |
|
It's more organizational : check if we use getQuestionAttributes($oQuestioon->qid) but : right : seem more easy with file by file PR … |
|
|
Yes, please do it like asked in the ticket. Thank you! |
|
|
Bug or dev ? |
|
|
application/controllers/UploaderController.php https://github.com/LimeSurvey/LimeSurvey/pull/3782 |
|
|
application/controllers/admin/ConditionsAction.php https://github.com/LimeSurvey/LimeSurvey/pull/3783 |
|
|
I stop on this one |
|
|
I stop because: it's not restricted, it's "Fix all possible issue that can happen on this controller" |
|
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=36228 |
|
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=36227 |
|
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=36229 |
|
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=36230 |
|
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=36231 |
|
I really don't want to work on other controller. I really think it's a really bad solution to use a commit to fix other issue's. And here : without analysis the source of the issue (like ExpressionManager without question status …) |
|
|
"I stop because: it's not restricted, it's "Fix all possible issue that can happen on this controller"" This statement is false. I did not intend to delve into long discussions with you about this ticket, because we both have unnecessarily invested considerable amount of time into discussing things, like clarifying that we actually need to improve upon performance, which you inaccurately claimed that was not clarified in the ticket from the start. But your claim that we fix all issues that can happen in a controller, controllers being of thousands of lines unrelated to getQuestionAttributes is untrue, we only fix issues that make our changes not operational, independently of whether they were new or old We focus on improving upon the usages of a given method. We intend to change how we use it, which includes:
|
|
|
It's not related to the way we get Question object i'm OK here. But issues with survey that are totally unrelated I just don't want to work on this commit , it's OK ? |
|
|
No worries, we can handle it. |
|
|
Fixed in Release 6.5.2+240402 |
|
|
LimeSurvey: master 17af24ca 2024-03-21 14:48 Committer: GitHub Details Diff |
Fixed issue 19452 : getQuestionAttributes for UploaderController * Dev: 19452 : getQuestionAttributes for UploaderController |
Affected Issues 19452 |
|
| mod - application/controllers/UploaderController.php | Diff File | ||
|
LimeSurvey: master 17af24ca 2024-03-21 14:48 Committer: GitHub Details Diff |
Fixed issue 19452 : getQuestionAttributes for UploaderController * Dev: 19452 : getQuestionAttributes for UploaderController |
Affected Issues 19452 |
|
| mod - application/controllers/UploaderController.php | Diff File | ||
|
LimeSurvey: master 1f846862 2024-03-21 15:24 Committer: GitHub Details Diff |
Fixed issue 19452: Improve usage of getQuestionAttributes DataEntry (03784) * Dev: 19452: Improve usage of getQuestionAttributes DataEntry * Dev: more optimisation * Dev: Re add QuestionAttribute::model()->getQuestionAttributes(Question::model()->findByPk( when it's neeed Dev: not for other question, and not in other foreach * MW-1040: Improved upon usages of getQuestionAttributes at DataEntry * MW-1040: DataEntry improvements --------- Co-authored-by: Lajos Arpad <arpad@endpoint.com> |
Affected Issues 19452 |
|
| mod - application/controllers/admin/DataEntry.php | Diff File | ||
|
LimeSurvey: master 1f846862 2024-03-21 15:24 Committer: GitHub Details Diff |
Fixed issue 19452: Improve usage of getQuestionAttributes DataEntry (03784) * Dev: 19452: Improve usage of getQuestionAttributes DataEntry * Dev: more optimisation * Dev: Re add QuestionAttribute::model()->getQuestionAttributes(Question::model()->findByPk( when it's neeed Dev: not for other question, and not in other foreach * MW-1040: Improved upon usages of getQuestionAttributes at DataEntry * MW-1040: DataEntry improvements --------- Co-authored-by: Lajos Arpad <arpad@endpoint.com> |
Affected Issues 19452 |
|
| mod - application/controllers/admin/DataEntry.php | Diff File | ||
|
LimeSurvey: master 570b810f 2024-03-21 15:31 Committer: GitHub Details Diff |
Fixed issue 19452: Improve usage of getQuestionAttributes PrintableSurvey (03789) * Dev 19452: Improve usage of getQuestionAttributes PrintableSurvey Dev: simple for question Dev: add specific array for conditions (again array dual scale) * Dev: avoid multiple call of same question attributes * MW-1040: Applied some fixes * Added a comment * MW-1040: Fixed a typo --------- Co-authored-by: Lajos Arpad <arpad@endpoint.com> |
Affected Issues 19452 |
|
| mod - application/controllers/admin/PrintableSurvey.php | Diff File | ||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2024-03-01 13:16 | tibor.pacalat | New Issue | |
| 2024-03-01 13:16 | tibor.pacalat | File Added: image1.png | |
| 2024-03-01 13:16 | tibor.pacalat | Assigned To | => DenisChenu |
| 2024-03-01 13:16 | tibor.pacalat | Status | new => assigned |
| 2024-03-01 13:21 | tibor.pacalat | Note Added: 79700 | |
| 2024-03-01 13:21 | tibor.pacalat | Bug heat | 0 => 2 |
| 2024-03-04 08:12 | DenisChenu | Note Added: 79702 | |
| 2024-03-04 08:12 | DenisChenu | Bug heat | 2 => 4 |
| 2024-03-04 10:50 | tibor.pacalat | Note Added: 79704 | |
| 2024-03-04 12:31 | DenisChenu | Note Added: 79705 | |
| 2024-03-04 13:06 | tibor.pacalat | Note Added: 79708 | |
| 2024-03-04 15:23 | DenisChenu | Note Added: 79711 | |
| 2024-03-04 15:23 | DenisChenu | Project | Bug reports => @10@ |
| 2024-03-06 16:51 | DenisChenu | Note Added: 79748 | |
| 2024-03-06 17:03 | DenisChenu | Note Added: 79749 | |
| 2024-03-11 15:25 |
|
Description Updated | |
| 2024-03-11 19:19 |
|
Description Updated | |
| 2024-03-12 08:49 | DenisChenu | Description Updated | |
| 2024-03-12 08:49 | DenisChenu | Additional Information Updated | |
| 2024-03-12 18:10 | DenisChenu | Description Updated | |
| 2024-03-13 14:36 | DenisChenu | Note Added: 79788 | |
| 2024-03-13 14:36 | DenisChenu | Assigned To | DenisChenu => tibor.pacalat |
| 2024-03-13 14:42 | DenisChenu | Note Added: 79789 | |
| 2024-03-19 19:14 |
|
Description Updated | |
| 2024-03-19 22:10 |
|
Description Updated | |
| 2024-03-20 15:01 |
|
Description Updated | |
| 2024-03-21 13:48 | DenisChenu | Changeset attached | => LimeSurvey master 17af24ca |
| 2024-03-21 13:48 | DenisChenu | Changeset attached | => LimeSurvey master 17af24ca |
| 2024-03-21 13:48 | DenisChenu | Note Added: 79816 | |
| 2024-03-21 13:48 | DenisChenu | Note Added: 79817 | |
| 2024-03-21 13:48 | DenisChenu | Assigned To | tibor.pacalat => DenisChenu |
| 2024-03-21 13:48 | DenisChenu | Assigned To | tibor.pacalat => DenisChenu |
| 2024-03-21 13:48 | DenisChenu | Resolution | open => fixed |
| 2024-03-21 13:48 | DenisChenu | Resolution | open => fixed |
| 2024-03-21 14:44 | DenisChenu | Changeset attached | => LimeSurvey master 1f846862 |
| 2024-03-21 14:44 | DenisChenu | Changeset attached | => LimeSurvey master 1f846862 |
| 2024-03-21 14:44 | DenisChenu | Note Added: 79818 | |
| 2024-03-21 14:44 | DenisChenu | Note Added: 79819 | |
| 2024-03-21 14:49 | DenisChenu | Changeset attached | => LimeSurvey master 570b810f |
| 2024-03-21 14:49 | DenisChenu | Note Added: 79820 | |
| 2024-03-26 08:46 | DenisChenu | Assigned To | DenisChenu => lajosarpad |
| 2024-03-26 08:47 | DenisChenu | Note Added: 79828 | |
| 2024-03-26 12:38 |
|
Note Added: 79830 | |
| 2024-03-26 12:38 |
|
Bug heat | 4 => 6 |
| 2024-03-26 12:53 | DenisChenu | Note Added: 79831 | |
| 2024-03-26 14:18 |
|
Note Added: 79834 | |
| 2024-04-02 14:01 | LimeBot | Note Added: 79857 | |
| 2024-04-02 14:01 | LimeBot | Status | assigned => closed |
| 2024-04-02 14:01 | LimeBot | Bug heat | 6 => 8 |