Bug #5014
closedSlow loading of new SP papers
Added by Matt Gold almost 9 years ago. Updated almost 9 years ago.
0%
Description
Tried to create a paper tonight on the live site and after 30 seconds the paper was still loading. Can others try to replciate?
Updated by Boone Gorges almost 9 years ago
- Target version set to Not tracked
Load times were normal for me in a few tests just now. So we're all on the same page, the intended flow is:
a. From /papers/, click "Create New Paper"
b. You are directed to /papers/new/, which has the "Loading new paper message"
c. An AJAX request is fired to create the new paper on the server (you can see it in your JS console)
d. Once the AJAX request returns a result (the ID of the newly created paper), the page redirects to a URL like https://commons.gc.cuny.edu/?post_type=cacsp_paper&p=45237#edit=true, where 45237 is the ID of the newly created paper
If you do experience slowness, please take careful note of where in this flow it's happening.
Updated by Matt Gold almost 9 years ago
Hi Boone,
I'm still seeing enormously slow loading of papers.
about 15-20 seconds here - b. You are directed to /papers/new/, which has the "Loading new paper message"
and 15-20 seconds here -d. Once the AJAX request returns a result (the ID of the newly created paper), the page redirects to a URL like https://commons.gc.cuny.edu/?post_type=cacsp_paper&p=45237#edit=true, where 45237 is the ID of the newly created paper
Updated by Boone Gorges almost 9 years ago
Matt - Can you see whether you're able to reproduce the slowness (a) with a different Commons account, and (b) with a different browser?
Updated by Matt Gold almost 9 years ago
Reported problem -- Chrome w/my admin account
New Tests:
Chrome w/ teststudent account -- 11 second load total (could be better, but not terrible and didn't feel like it was really hanging
Firefox w/ my admin account -- 11 second load total
Firefox w/ teststudent -- quick load (sorry, didn't count)
So maybe this is localized to Chrome and my account?
Updated by Boone Gorges almost 9 years ago
I don't know what Chrome could be doing here, but I wouldn't be surprised if your account in particular was problematic. For example, you're a member of a huge number of groups, which means that lots more markup is built for the Groups selector in the settings sidebar, as well as the admin menu. I will try to benchmark this a little.
Updated by Boone Gorges almost 9 years ago
- Status changed from Assigned to Resolved
- Target version changed from Not tracked to 1.9.1
I ran some profiling and found that the query for pre-populating the "Readers" dropdown was taking a long time, especially for users who have lots of friends and are members of lots of groups. This is why Matt, the most popular person on the Commons, is experiencing the problem so severely.
When building the Readers interface, I opted to pre-load potential Readers, because it makes the interface feel much faster than when we do AJAX autocomplete. For this reason, I don't want to roll back the pre-loading altogether (which is one possible solution here).
Instead, I've added a caching layer for the Readers dropdown. It's pretty crude and coarse-grained, which is mostly the fault of BuddyPress; if BP had better caching for friendship and group-member queries, I could do laser-focused caching for paper Readers only. As things stand, in the interest of time, I've chunked together the entire potential-reader cache so that a big array is cached for each combination of logged-in user + paper. All such caches are controlled by a single last_changed incrementor, so any reader/group-member/friendship action across the entire site will invalidate all caches. This is far from ideal, but it's the best I can do on short notice. I'll make a note to make some of these improvements in BP, at which point we can improve the cache implementation here. (Adding Ray as a watcher.)
I'm going to put this ticket in 1.9.1 under the assumption that I've identified the main culprit behind the loading delay. Matt, after the release, could I ask you to let me know whether you notice a difference? If not, we can reopen for more investigation.
Updated by Matt Gold almost 9 years ago
Hi Boone,
I have some bad news. I just tried to start a new paper. Here were the results:
first stage of the load -- 27 seconds
second stage of the load - 60 seconds
Updated by Boone Gorges almost 9 years ago
Matt, can you please View Source of the page, copy the entire source, and then provide it to me somehow? Eg as an attachment to #5023 (make the ticket private if you want)