Is APCu supported?

More
1 month 1 week ago #159438 by zfocuz
zfocuz created the topic: Is APCu supported?
The Yii framework has a APC(u) cache implementation which is included in LimeSurvey. I could however find no information on using this caching machanic in combination with LimeSurvey.

I've tried to activate it on my development server by changing line 146 in

/application/config/internal.php

to
'class' => defined('YII_DEBUG') && YII_DEBUG ? 'system.caching.CDummyCache' : 'CApcCache',

I also changed line 32 in

/framework/caching/CApcCache.php

to
public $useApcu=true;
to use the apcu caching extension.

After testing I've found some significant changes in LimeSurvey's performance both bad and good. The following things changed:
  • The pagination on /admin/survey/sa/listsurveys is much faster. Loading a next page used to took a few seconds now it's almost instant
  • Loading any admin page will take longer but revisiting these pages is much faster
  • Visiting and navigating a survey (frontend) is so much faster its unbelievable!
  • Visiting a survey through the admin pages (backend) takes longer and seems to not use caching at all(?)

I've used APCu INFO to test the usage of APCu and it seems to be working for most of the pages. Some admin pages (like the viewing of a survey) only generate misses and are actualy slower but overall performance is increased. Some admin pages also seem to clear the memory (maybe by overloading?) but I've not been able to prove this.

I was wondering why there is no official documentation on caching and why there are no caching settings in LimeSurvey? LimeSurvey is resource hungry and spends a lot of time doing I/O, so caching using memory should be a welcome feature. Is this an officialy supported caching mechanic or are there some significant downsides I've not yet discovered?

Please Log in to join the conversation.

More
1 month 1 week ago #159463 by DenisChenu
DenisChenu replied the topic: Is APCu supported?
Because you can use any Yii caching you want. But we use more for DB Caching issue.

Else : NEVER update an included file : you can do in your config.php file (if it's broke : report the bug).
manual.limesurvey.org/Optional_settings#Yii_settings

And we always happy to have more help for update our manual: please help us …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: LouisGac

Please Log in to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #159472 by zfocuz
zfocuz replied the topic: Is APCu supported?
I have put these settings into the global config file: (You are right I should not touch core files)
return array(
	'components' => array(
		'db' => array(),
        'cache'=>array(
           'class' => 'CApcCache',
           'useApcu' => true
        ),
	)
)
This seems to be working.

But as I understand from your comment LimeSurvey still uses some other caching mechanics (like file caching inside the /tmp folder)?

Is it safe to use APCu or other Yii caching mechanics to speed up certain parts of LimeSurvey? I've done some tests and everything seems to work fine.

Also do you have any clue as to why switching to APCu caching seems to decrease loading time for survey pages in the backend (e.g. /admin/survey/sa/view/surveyid/123456)? Are these pages cached? or is there some check that takes a long time?

I think this is important information as caching could significantly increase LimeSurvey's speed and stability in certain situations. I might write something for the documentation when I find out exactly how this works.
Last Edit: 1 month 1 week ago by zfocuz.

Please Log in to join the conversation.

More
1 month 1 week ago #159473 by zfocuz
zfocuz replied the topic: Is APCu supported?
Quick addition.

Visiting an survey page in the backend (e.g. /admin/survey/sa/view/surveyid/123456) directly by typing the url into the browsers address bar is much faster than accessing it trough the overview page (/admin/survey/sa/listsurveys). I'm not sure if this has anything to do with caching or if this might be related to a bug. Can someone tell me if there is a difference in the processing of the page depending on how you access it? or can someone direct me into the direction of the script involved?

Please Log in to join the conversation.

More
1 month 1 week ago #159474 by DenisChenu
DenisChenu replied the topic: Is APCu supported?
About LS and caching, not really. We have some project to use caching for survey generation (Expression Manager take a lot of time and need caching).
But in Yii : you need to ask to use cache. And if i remind : we use it only for DB Caching actually.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
1 month 1 week ago #159475 by zfocuz
zfocuz replied the topic: Is APCu supported?

DenisChenu wrote: About LS and caching, not really.

Not really sure what you are pointing at? Regarding if it is safe to use APCu caching and LimeSurvey or if you have any clue as to why APCu caching might speed up certain parts of the admin pages but not the admin survey page?

DenisChenu wrote: We have some project to use caching for survey generation (Expression Manager take a lot of time and need caching).

Is this what the /tmp folder is all about? These are pre-generated survey templates right?

DenisChenu wrote: But in Yii : you need to ask to use cache. And if i remind : we use it only for DB Caching actually.

Is there a global setting that dictates what kind of caching we do? Atm my LimeSurvey is using huge amounts of I/O time and caching to APCu instead of the database might be usefull if at all possible.

Please Log in to join the conversation.

More
1 month 1 week ago #159478 by DenisChenu
DenisChenu replied the topic: Is APCu supported?

zfocuz wrote:

DenisChenu wrote: About LS and caching, not really.

Not really sure what you are pointing at? Regarding if it is safe to use APCu caching and LimeSurvey or if you have any clue as to why APCu caching might speed up certain parts of the admin pages but not the admin survey page?

It's safe to use any of cache system you want, but cache are not used a lot in LimeSurvey.

zfocuz wrote:

DenisChenu wrote: We have some project to use caching for survey generation (Expression Manager take a lot of time and need caching).

Is this what the /tmp folder is all about? These are pre-generated survey templates right?

pre-generated survey templates is another system , and tmp folder is just here for old system compatibility. It's not really caching.

zfocuz wrote:

DenisChenu wrote: But in Yii : you need to ask to use cache. And if i remind : we use it only for DB Caching actually.

Is there a global setting that dictates what kind of caching we do? Atm my LimeSurvey is using huge amounts of I/O time and caching to APCu instead of the database might be usefull if at all possible.

No, except the one you already update.


In fact there are some part where i think we must use cache : inside github.com/LimeSurvey/LimeSurvey/blob/9b...mon_helper.php#L1780 for example. We DO each times a big part for a lot of user, we must improve this by doing some part in cache. But here need dev

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: LouisGac

Please Log in to join the conversation.

More
1 month 1 week ago #159497 by zfocuz
zfocuz replied the topic: Is APCu supported?
Thanks for elaborating.

I see some performance improvements but the amount of data cached is really small indeed.

It would indeed be nice to have caching on some of these heavy scripts that slow LimeSurvey down. It would make it easier to host LimeSurvey on shared hosting platforms without running into problems (mainly I/O and CPU) with big surveys.

I guess this is on the feature request list already, not sure if it has any priority.

Please Log in to join the conversation.

More
1 month 6 days ago #159556 by DenisChenu
DenisChenu replied the topic: Is APCu supported?
There are some feature for cache some part … but we always happy to have new idea …
Or better : new pull request ;)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!