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

REST: excessive authors requests on sites with many authors when editing #15985

Closed
rogertheriault opened this issue Jun 4, 2019 · 3 comments
Closed
Labels
REST API Interaction Related to REST API [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Performance Related to performance efforts

Comments

@rogertheriault
Copy link

Describe the bug
The REST API is used to request authors to support the Authors module in the Gutenberg editor.

That's problematic on sites with many thousands (or more) of authors.

Even disabling post type support for author, the REST requests still fire continually.

e.g.

wp-json/wp/v2/users?who=authors&per_page=100&_locale=user&page=42

On a site with thousands of authors, this results in hundreds of REST requests from each browser, for each currently open draft or post.

The resulting queries can cause DB performance issues.

To reproduce

  1. On a site with 40,000 editors, open a new draft
  2. Open the browser's developer tools, network tab, and inspect the XHR requests
  3. Watch the number of requests to wp-json/wp/v2/users?who=authors&per_page=100&_locale=user&page={n}
  4. Open several editor tabs (or have several editors do this)
  5. Check the DB health

Expected behavior
Fewer resulting DB queries to accomplish this functionality.

Most of the time, authors will not be changed, so it seems one alternative might be to only obtain authors when actually needed.

Possible solutions:

  • being able to disable the requests on the browser
  • alternate functionality to modify authors only as needed

Additional context
WordPress core 5.2.1

@swissspidy
Copy link
Member

Sounds like a duplicate of #7384 which has a PR at #7385.

@rogertheriault
Copy link
Author

Thanks @swissspidy it does look like that would solve this, as a much more user friendly refactor. I’ve chimed in on the other issue.

@aduth
Copy link
Member

aduth commented Jun 5, 2019

Let's consolidate this to #7384. I'll add a clarifying note there about the network impact described in this issue.

@aduth aduth closed this as completed Jun 5, 2019
@aduth aduth added [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed REST API Interaction Related to REST API [Type] Performance Related to performance efforts labels Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REST API Interaction Related to REST API [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Performance Related to performance efforts
Projects
None yet
Development

No branches or pull requests

3 participants