This request is being filed in advance, honoring the timelines set forth at mw:Wikimedia Performance Team/Performance Review. Please note that this task will be updated as more code is written.
Description
Community-Tech is currently developing a new feature called Real Time Preview (not to be confused with Live Preview). The basic functionality is to continually make a request to the action=parse API just like Live Preview, but debounced to keyboard input like DiscussionTools has, and with some performance safeguards.
Preview environment
For now, this can be tested on Patch Demo at https://patchdemo.wmflabs.org/wikis/85ef14e849. It will soon be deployed to the Beta Cluster and Test Wikipedia.
You can test the feature by editing any article and clicking on the "Preview" button in the top-right of the editing window. The feature is only available to WikiEditor (the 2010 wikitext editor).
Which code to review
- https://gerrit.wikimedia.org/r/c/mediawiki/core/+/745962 (merged) – this is the base patch that makes the existing Live Preview functionality available to other JS modules. By itself it should have no impact performance-wise from how production was prior to it being deployed.
- https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiEditor/+/739770 – this is the patch that introduces the new Real Time Preview feature that makes use of the new doPreview() added with aforementioned patch.
We spoke with a Performance engineer over email and were informed we didn't need to have all the code up for review yet. The performance safeguards that will be added soon (T302282) include:
- Ensure there's no more than one in-flight request to the API at any time
- Average the response time from the server over N requests (perhaps three), and if it is greater than say, 10 seconds, disable Real Time Preview.
- Don't load Real Time Preview at all for very large pages (say 300K bytes)
- The debounce time (time after the user stops typing at which we make the action=parse request) is to be determined, but it will be set to something sensible that is certainly no less than a second or two.
- These thresholds will have corresponding configuration settings and may be adjusted according to how the feature performs once it's tested in a production environment.
Performance assessment
- What work has been done to ensure the best possible performance of the feature?
- See T302282 for what is to be done
- What are likely to be the weak areas (e.g. bottlenecks) of the code in terms of performance?
- We are only hitting the action=parse API, so in theory without proper safeguards we could see performance bottlenecks from an increase in action=parse requests.
- Are there potential optimisations that haven't been performed yet?
- Yes but they will be added soon. See T302282
- Please list which performance measurements are in place for the feature and/or what you've measured ad-hoc so far.
- None yet, however we plan to create a Grafana dashboard to monitor the performance of the action=parse endpoint. We invite suggestions on how to best monitor for any performance overhead. We can also add event logging to measure how many users have the feature disabled because of persistent slow requests to action=parse.