Don't cache a whole repo string in Utils::getRepoStrings() #591

Closed
pascalchevrel opened this Issue Jan 19, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@pascalchevrel
Member

pascalchevrel commented Jan 19, 2016

While looking at this api call and seeing how we can make it faster:
https://transvision.mozfr.org/api/v1/tm/global/en-US/fr/Cancel/

I noticed that the page renders much faster and wjth less memory if I disable the cache:
With cache:
[Tue Jan 19 16:57:56 2016] Memory peak: 38535168 (36.75MB)
[Tue Jan 19 16:57:56 2016] Elapsed time (s): 0.6915
Whithout cache:
[Tue Jan 19 16:58:15 2016] Memory peak: 23592960 (22.5MB)
[Tue Jan 19 16:58:15 2016] Elapsed time (s): 0.3894

I digged into it and I see that I think I made a conceptual error in the function getRepoStrings()

This function will always return the full included PHP file ({$locale}/cache_{$locale}_{$repository}.php) so we don't need to put that file in cache because that means that everytime we need to work on the full set of strings we serialize/unserialize it.

That is true will all views using getRepoStrings() but it is particularily noticeable on the global api one because it needs to load strings for all reporitories so we spend 30% of the page time view in unserialize().

@pascalchevrel pascalchevrel added the bug label Jan 19, 2016

@pascalchevrel pascalchevrel self-assigned this Jan 19, 2016

pascalchevrel added a commit to pascalchevrel/transvision that referenced this issue Jan 19, 2016

pascalchevrel added a commit to pascalchevrel/transvision that referenced this issue Jan 19, 2016

pascalchevrel added a commit that referenced this issue Jan 19, 2016

Merge pull request #592 from pascalchevrel/issue591-no_caching_in_get…
…RepoStrings

Issue #591: Don't cache the whole repository for a locale in getRepoS…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment