View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
14859 | Feature requests | Survey taking | public | 2019-05-07 20:10 | 2019-12-18 12:32 |
Reporter | ollehar | Assigned To | ollehar | ||
Priority | none | Severity | feature | ||
Status | assigned | Resolution | open | ||
Summary | 14859: Cache result from createFieldmap etc | ||||
Description | How much can be cached and reused in the front-end loading of LS? Can we save the result from createFieldmap in file or database to be reused for the next participant? | ||||
Additional Information | Spec here: https://project.limesurvey.org/T264 | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 4 | ||||
Story point estimate | |||||
Users affected % | |||||
@DenisChenu Thoughts? |
|
I think i already put a Dev part about this. And it's a really good idea. The point :
|
|
|
|
Maybe we must remove some part for
For example : i‘m unsure we need question.text : i think it's to have it in js expression : but it false : https://bugs.limesurvey.org/view.php?id=14817 , then we can, call it in EM from DB when needed (One DB line call : quick). PS : i really think it's a REALY complex system and come with a lot of issues … |
|
@ollehar : i already think of way to automatically reset cache in model : Question, Answer, Survey : afterSave function maybe. Maybe with conditio (code are updated, relevance are update : reset. Only help are updated : don't reset) You can't remind when we move survey in SESSION (1.92 and 2.00 have a lot of issue about this) : all of issue‘s we have about deprecated survey in SESSION … But in SESSION : it's only for current admin user, in cache : it's for ALL user … |
|
Related commit (local method cache/memoization): https://github.com/LimeSurvey/LimeSurvey/commit/4c56d2025a4ed48d9f73972357df68ee65fbcd8f |
|
It's static var, not caching here … For real aching
I use it for a complex evaluation system, but create an alternative cache : one for cache DB used by LMS core, and one for my evaluation system. The hardest part is «when cache need to be resetted» but after it's easy. Since it was a complete system with filters etc …
(You see my debug system too … :p ) |
|
Lots of good info about Yii caching in the docs: https://www.yiiframework.com/doc/guide/1.1/en/caching.fragment |
|
Example to cache a query: |
|
In case the meaning of the word "memoization" is unclear: https://en.wikipedia.org/wiki/Memoization |
|
getLanguageData seem slow. Everything in gT() could probably be cached. |
|
Bah. gT is only slow when debug = 2 --> no cache enabled. With debug = 0, it's cached. |
|
I could get req/sec up from 7 to 8 by caching getQuestionAttributesForEM in EM. 14% increase. |
|
Pic shows that speed can improve 16% if |
|
Yii already use caching for loadMessageSource : https://github.com/LimeSurvey/LimeSurvey/blob/70d03f7ba093700c28f3727cd04760558dea17bb/framework/i18n/CGettextMessageSource.php#L92 But use (by default) the cache system : https://github.com/LimeSurvey/LimeSurvey/blob/70d03f7ba093700c28f3727cd04760558dea17bb/application/config/internal.php#L200 set here : https://github.com/LimeSurvey/LimeSurvey/blob/70d03f7ba093700c28f3727cd04760558dea17bb/application/config/internal.php#L186 |
|
It's a reason why i add SQLlite DB cache in my plugin : already available, just need runtimePath set out of web browser access. |
|
|
|
Yes, I was working with debug = 2. >< So I didn't notice locale was already cached. Typical.
|
|
Yes , sure :). It the most hard here : updating a big part can broke a lot and have a lot of bug after. Updating a lesser part didn't give you a lot … |
|
Question about different cache : |
|
I think I agree with regard to create a separate cache object called |
|
Some things will not be possible to cache if survey uses randomization. |
|
For createFielsMap : can be cached here : https://github.com/LimeSurvey/LimeSurvey/blob/f62d45ef6c72bd16a65557b43e0c29070888314e/application/helpers/common_helper.php#L1947 no ? For EM : it can be great if we can cache knowVar even partially , and merge it after with : TOKEN value
We can not cache (and review if it's update knowVars ) After get the new order : we merge update knowVars and q2subqInfo with the new I'm happy to make testing and give help on such project. PS: it's awfull i put var name , and i have no idea of usage of this var … |
|
Only bottlenecks should be cached. Use xdebug and kcachegrinde to analyze them. See my pics. But I'll look more into details next week, if I get time. Thanks for discussion! |
|
For bottleneck : what is the survey tested ? It can be very different according to each survey , no ? |
|
The bigger the survey, the more speed-up you will see. I used some I had lying around. The demo surveys included in the repo has a lot of EM logic, but number of questions affect a lot. |
|
qanda might be possible to completely cache BEFORE any answers are posted/put in the session. How to check? |
|
Answers values can be get from default values that can came from previous data entered. Unsure it's a good solution … to cache qanda |
|
What does that mean, default values from previous data entered? Caching qanda = high risk, but pretty high reward (not super high reward). |
|
Yes, for example : qcode Then : «dynamic» part of qanda can not be cached. Maybe there are other part : min max from {TOKEN:value} or value from URL ? When adding this : need specific survey for testing :) |
|
Damn. That's a good catch! Yes, qanda cache will be a little more complicated. We can still roll out emcache as a first step, and test qanda cache after. |
|
@DenisChenu Can't find a manual page about caching in LS. You know of any? |
|
You mean caching in Yii ? I think we never create such page on manual of LimeSurvey … |
|
OK, maybe I'll add something in the installation section. |
|
Maybe i add cache configuration in Installer update project : https://bugs.limesurvey.org/view.php?id=14772 :) |
|
Interesting. Looks like Sam tried to do something similar 5 years ago: https://github.com/LimeSurvey/LimeSurvey/commit/3bcc8b375ad2c217a1345bfcdacb40b25be47a25 It was reverted the same day. Wonder why. Maybe not possible if the |
|
I see you start checking caching qanda, but unsure we can (currently) If we cache qanda : such system must work (and i must hav too an dyn equation question type : if i remind we set it before qanda happen) |
|
Thanks, will check on Monday. I just wanted to see what the possible speedup could be, but yes, it's only possible in a certain setup, so, limited use-case. |
|
Maybe we need to consider adding an option to cache qanda. Seems hopelessly hard to detect it programmatically, like if any plugin subscribes to any event in retrieveAnswer, or if a certain expression is being used. |
|
Changing language also does not work with qanda cache (the new version of the question does not get populated with the $_POST). |
|
Merged with dev branch. |
|
Bump. This could be worked on more if we ever get a R&D team. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2019-05-07 20:10 | ollehar | New Issue | |
2019-05-07 20:10 | ollehar | Status | new => assigned |
2019-05-07 20:10 | ollehar | Assigned To | => ollehar |
2019-05-07 20:10 | ollehar | Note Added: 51816 | |
2019-05-08 10:31 | DenisChenu | Note Added: 51817 | |
2019-05-08 10:54 | ollehar | Note Added: 51818 | |
2019-05-08 11:01 | DenisChenu | Note Added: 51819 | |
2019-05-08 11:06 | DenisChenu | Note Added: 51821 | |
2019-05-08 12:33 | ollehar | Note Added: 51827 | |
2019-05-08 12:45 | DenisChenu | Note Added: 51828 | |
2019-05-08 13:54 | ollehar | Note Added: 51830 | |
2019-05-08 14:06 | ollehar | Note Added: 51831 | |
2019-05-08 14:07 | ollehar | Note Edited: 51831 | |
2019-05-08 14:22 | ollehar | Note Added: 51832 | |
2019-05-08 14:52 | ollehar | File Added: Selection_694.png | |
2019-05-08 14:52 | ollehar | Note Added: 51835 | |
2019-05-08 16:25 | ollehar | Note Added: 51836 | |
2019-05-08 16:43 | ollehar | Note Added: 51837 | |
2019-05-08 17:07 | ollehar | File Added: Selection_695.png | |
2019-05-08 17:07 | ollehar | Note Added: 51838 | |
2019-05-08 18:56 | DenisChenu | Note Added: 51841 | |
2019-05-08 18:57 | DenisChenu | Note Added: 51842 | |
2019-05-08 19:05 | DenisChenu | Note Added: 51843 | |
2019-05-08 20:18 | ollehar | Note Added: 51844 | |
2019-05-09 07:55 | DenisChenu | Note Added: 51847 | |
2019-05-09 14:06 | DenisChenu | Note Added: 51853 | |
2019-05-10 14:14 | ollehar | Note Added: 51863 | |
2019-05-10 17:50 | ollehar | Note Added: 51892 | |
2019-05-10 18:09 | DenisChenu | Note Added: 51893 | |
2019-05-10 18:09 | DenisChenu | Note Edited: 51893 | |
2019-05-10 18:09 | DenisChenu | Note Edited: 51893 | |
2019-05-10 18:11 | DenisChenu | Note Edited: 51893 | |
2019-05-10 18:28 | ollehar | Note Added: 51894 | |
2019-05-10 18:36 | DenisChenu | Note Added: 51895 | |
2019-05-10 18:42 | ollehar | Note Added: 51896 | |
2019-05-23 12:51 | ollehar | Note Added: 52072 | |
2019-05-23 12:52 | DenisChenu | Note Added: 52074 | |
2019-05-23 13:13 | ollehar | Note Added: 52076 | |
2019-05-23 15:35 | DenisChenu | Note Added: 52088 | |
2019-05-23 16:21 | ollehar | Note Added: 52091 | |
2019-05-24 12:38 | ollehar | Note Added: 52102 | |
2019-05-24 12:46 | DenisChenu | Note Added: 52103 | |
2019-05-24 12:49 | ollehar | Note Added: 52104 | |
2019-05-24 12:53 | DenisChenu | Note Added: 52105 | |
2019-05-24 23:11 | ollehar | Note Added: 52110 | |
2019-05-24 23:11 | ollehar | Note Edited: 52110 | |
2019-05-24 23:18 | ollehar | Note Edited: 52110 | |
2019-05-25 12:11 | DenisChenu | File Added: Capture d’écran du 2019-05-25 12-11-28.png | |
2019-05-25 12:11 | DenisChenu | File Added: limesurvey_survey_didQandaCanBeChached.lss | |
2019-05-25 12:11 | DenisChenu | Note Added: 52111 | |
2019-05-25 18:24 | ollehar | Note Added: 52112 | |
2019-05-27 15:30 | ollehar | Note Added: 52116 | |
2019-05-27 16:23 | ollehar | Additional Information Updated | |
2019-05-28 13:18 | ollehar | Note Added: 52127 | |
2019-05-28 16:59 | ollehar | Note Added: 52135 | |
2019-12-18 12:32 | ollehar | Note Added: 55062 |