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

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

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

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

pascalchevrel opened this issue Jan 19, 2016 · 0 comments
Assignees
Labels

Comments

@pascalchevrel
Copy link
Member

@pascalchevrel 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 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
…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
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant