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
Very slow system when having thousands of sites registered #495
Comments
Scaleability is on the TODO list (e.g., tickets #386 and #409). Assuming your profiling has pinpointed it to this line, try replacing it with: usort($sites, create_function(‘$site1, $site2’, ‘return strcasecmp($site1[$site2[“name”](“name”],));’)); |
Let’s try that again in a code block: ``` |
I don’t think that line of code is the bottleneck. I just ran a simulation using 23,000+ domain names. Before my optimization: 2.83 seconds; After: 1.89 seconds. |
What server side errors are you seeing? |
I get this message: Allowed memory size of X bytes exhausted (tried to allocate Y bytes )… the only thing that helped me “solve” the problem is to give up the sorting. After all the sorting is for the admin interface and in our case is less important. So even when i use the admin to see data, i will not load all these sites into the dropdown. |
Yes, 80K domains would be a problem. The memory exhausted error depends on your memory_limit in php.ini. My test with 23,000 domains maxed out my 32MB limit, which is around the norm. Using strcasecmp() instead of strtolower() would eliminate a lot of string conversions and small string allocations, but transferring 80K domains for the site selection list would still take a hit. FYI showSitesSelection is set to true in several places: ``` I’d like to propose adding a config option (e.g., threshhold) to accommodate larger installations like yours. |
Fixed in 880 fix #495 Adding option in configuration file: show_website_selector_in_user_interface ; if set to true, the website selector will be displayed in the Piwik UI following vipsoft suggestion |
When trying to log in as superuser and having thousands of websites listed. the system is tremendously slow. the reason seems to be line 82 in /core/View.php
the function usort is being used and the sort is very slow causing the many timeouts.
Maybe sort in db? or in other efficient way?
The text was updated successfully, but these errors were encountered: