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
Config INI files are parsed on EVERY tracking request #14367
Comments
There is no caching across requests on purpose. Ini parsing is fast compared to the whole tracking request. It looks like you weren't actually profiling a proper tracking request. At least I cannot find any queries to the DB etc and a lot of other calls that would be usually executed. |
Yes, that percentage isn't relevant with normal request. But it is still pointless 6ms per request on i9-9900k CPU. That doesn't sound like a lot but for a file that is executed 500 times per second it sums up. Do I undestand correctly that I shouldn't bother with pull request? |
Right now we wouldn't really be interested. We could potentially use it optionally but people would need to remember to invalidate caches when changing the config file etc. and it gets more difficult when using multiple servers and you have maybe the config file in an EFS/shared drive and need to invalidate all local caches etc. A workaround could be to build the cache key based on the Maybe check if you find there's a big performance improvement when caching eg content based on a key built with eg public function readFile($filename)
{
$timer = new Timer();
$ini = $this->getContentOfIniFile($filename);
$test = $this->readString($ini);
echo $timer->getTimeMs() . 'ms'; exit;
} On my slow local computer, with a rather slow HD, it takes on average 3ms for me and it makes only 1% of total request time. I think on our production server it's also only about 1%. |
On our production server it takes 0.4ms. |
It is getting called a lot of time while browsing the dashboard, because every widget loading does reread the INI file. At this point there might be optimization potential? Like only read the file one time per user interaction? |
It it possible that it depends on activated plugins? But I don't think that I have activated something that isn't active by default.
|
It should for sure not depend in the number of activated plugins, and that's a normal number anyway (we have way more activated) |
just fyi: for some completely different reason quickly looked into possibility of caching the config and it's not even possible. The caching would need to be done in the ini reader or so... but the problem is we cannot cache content, because caching would require the config to be already loaded. Without the config, we cannot detect the tmp path for caches etc (especially important when using instanceIds). |
I was planning to use APC cache. Even 1-2s TTL would help a lot on high traffic sites - but I was operating with 6ms config loading time which was probably some weird issue only on my server. |
Hi,
I am getting 100% CPU usage from tracking script on 3.9.1 with PHP 7.3. I have tried to disable tracking in config but CPU is still 100% (after webserver restart).
I have tried to run Blackfire on tracking script and it shows that 38% of time is spent on INI files parsing.
It seems pointless to parse the files on every request. Is it a bug or is it by design that there is no cache?
https://blackfire.io/profiles/b13eb852-e071-470f-8a96-d3690e5e5d9d/graph
The text was updated successfully, but these errors were encountered: