Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to cache the config file #14617

Merged
merged 5 commits into from Aug 4, 2019
Merged

Support to cache the config file #14617

merged 5 commits into from Aug 4, 2019

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Jul 2, 2019

refs #14367

This supports caching the config ini file. It would be enabled through $matomoDir/bootstrap.php by putting this code in there (we cannot use DI or config file for this because they don't exist at the time of the config loading):

<?php

$GLOBALS['ENABLE_CONFIG_PHP_CACHE'] = true;
$GLOBALS['MATOMO_PLUGIN_DIRS'] = array(); // this line is unrelated... just another setting we added recently by using bootstrap.php

It would pretty much only work for single server environments... all others would have the problem that the cache invalidation when the config changes wouldn't be synced. Also we do not want to have to document that users need to invalidate the cache when they make changes to it. It would pretty much only help us and I would probably not even document it. When loaded from a regular filesystem, it should be still very fast with the regular ini. If it works nicely, we could document it eventually.

By caching it, it would come from opcache instead of filesystem... and we would not need to do things like all these decodings etc https://github.com/matomo-org/component-ini/blob/master/src/IniReader.php#L149-L384

Any thoughts on this @mattab

refs DEV-1692

@tsteur tsteur added the Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. label Jul 2, 2019
@tsteur tsteur added this to the 3.11.0 milestone Jul 2, 2019
@tsteur tsteur added RFC Indicates the issue is a request for comments where the author is looking for feedback. and removed Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. labels Jul 2, 2019
@tsteur tsteur added Needs Review PRs that need a code review RFC Indicates the issue is a request for comments where the author is looking for feedback. and removed RFC Indicates the issue is a request for comments where the author is looking for feedback. labels Jul 5, 2019
@tsteur
Copy link
Member Author

tsteur commented Jul 5, 2019

As discussed we're wanting to give this a try.

@tsteur tsteur removed the RFC Indicates the issue is a request for comments where the author is looking for feedback. label Jul 5, 2019
@mattab mattab modified the milestones: 3.11.0, 3.12.0 Jul 23, 2019

private function makeCacheDir($host)
{
return PIWIK_INCLUDE_PATH . '/tmp/' . $host . '/cache/tracker';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check somewhere if this directory is writable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diosmosis the directory might only be created when actually caching a file (the file backend does that). We already check if PIWIK_INCLUDE_PATH . '/tmp/' is writable as part of the system check not sure if it's enough?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like enough 👍

@diosmosis diosmosis merged commit 9877f0b into 3.x-dev Aug 4, 2019
@diosmosis diosmosis deleted the configcache branch August 4, 2019 20:59
@mattab mattab added the c: Performance For when we could improve the performance / speed of Matomo. label Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Performance For when we could improve the performance / speed of Matomo. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants