Project title:Thinking about Entity Usages and how to optimize them
Brief summary: After some investigation, we found out many cases where Wikidata entity usages where the value or the entity is not directly related/needed for the Wikipedia article. However, they are still required for categorization related reasons. In this session we will see some common examples and patterns we found out.
Expected outcomes: Brainstorming around the problem with participants during the presentation and after.
Skills preferred: Skills are not required.
Experience level: all levels welcome
Project leads: Neslihan Turan, Phab: Neslihan_Turan_WMDE, Mediawiki: Flanoz
Starting tasks: T403008 , T381098 , T410630
Why are you proposing this project? I believe Entity Usage and modules can be optimised. That would effect many wikis and Wikibase clients in general. We could reduce the size of Entity Usage table and Recent Changes table if we can optimize.
What is the expected impact? Hearing new ideas for optimization and challenging already existing ideas.
Any other additional information for contributors: none
Raw session notes
Thinking about Entity Usages and how to optimize them
What is entity usage
Whena WP article is using a WD itmes property
Usually displayed as a value in the WP page
What happens when a WD item is editiitng
Change is propogated async to the WP to be written to RC tables of the WP etc
What we want
Small entity usage table
small RC table
Relevant changes in RC
Solutions
Try to discover poor coding practices such as "dead" branching - querying property P18, and if it doesn't exist do nothing; if it does exist also do nothing. When we remove templates employing such bad practices we reduce usage across the wiki noticeably.
Lil diff, if there is no cahnge, dont send the log
- Reduces number of not needed RC logs when nothing changed in the WP article
- Limitaiton: can only work for pages that are cached already, otherwise we can't see if there is a html change
Mark some entity usage as unimportant or weak on module or parser function level leads to no RC log
- Limitation: hard to know if there logs are actually useless
Your ideas? Questions?
Do you know any other creative entity usage behaviour other than direct value use, moderation category.
Can you think of any other patterns that we can look for bad module programming practices?
Any ideas around distinguishing important updates and unimportant ones, when sending logs to RC table?
Any other ideas?
Anton
This parser language is very limited in terms of what you can do
you can only address 1st statement value, no 2nd or 3rd
cant access qualifiers
cant filter
To do any of the more fancy stuff, you need to go to LUA
Non technical users have to go to this parser language, which doesnt give them what thye want
They can end up coming up with very tricky solutions to solve their problems which are not very efificent in temrs of computing time
A template can include other templates, and they can both independantly come to the same entity from direct directions
There is a deduplication process, os even if template make the same entity usage, its deduplicated and already sorted out
I understand you have this need over more flexible parser functions, and this is noted
Lucas
Some LUA modules that get passed the entity ID and load all of the data that they might use, depending on soem other params they then filter down showing small bits of data from the overall entity
This is probably a bad programming practice
no idea how we would search for that
The function call starts with a funch of get statement calls, these end up as variables, then they go through IF conditions and may or may not actually get used
Do you think docs for module writers might be useful?
Lucas: Maybe. Best practises on how to use and or not use wikibase LUA could be good
Anton
about important updated vs unimportant updates
I thought this meant that it meant it didnt refresh automatically, and if you wanted it to refresh you would use action=purge? (refresh immedialety / manually)
Otherwise you just wait until the proper time has elapsed for it to refresh itself
QU
Do we need to always update the log for every change in the properties
Not all properties are that imporant
If I added a new item to an entity I dont think that is that important
maybe we can just restrict the numebr of Props that lead to an update in the logs
Doing something like this might lead to some disfunction in the modules and templates that use properties
Interesting observation around this topic:
french wikipedia
isSubclass
subclass of property is not used that much, this lead to ~5k rows in RC table, even though the function is widely used?
QU: What do you think about central modules?
River: there was an intesting session about it yesterday (gitlab hosted central modules, requesting modules from LUA on gitlab, load it locally) Produnto - https://phabricator.wikimedia.org/T424197
By centralizing modules, you mean instead of 100 modules doing seperate things you combine them into 1 big module?
A: Single source of truth for the modules, you can still take it, customaize it, but iut starts from one place
<refers back to bad module on enwikipedia that was then copy and pasted aroud to toher wikis>g
centralization would prevent or make some of these things easier to deal with
A lot of the copying around of modules is regarding localization
you dont want ...
I'd oppose a proactise of creating 1 big module for each wikipedia, because the more functions that 1 module defines, the more important it becomes, the more restrictions that are imposed on it
An example on X wikipedia is that editing is only restricted to admins.
Admins dont know how to edit it but are the only people with access
People that know how to edit it, can't actually edit the module
I wrote a module that is used very often, it needs maintianing but becasue it is used 20k time it is restircted to be edited by admin only, so i can't properly maintain it, i have to write to admin, asking them to replace lines in the module
The idea of a central module system is not that it does everything
The idea is there would be a generic infobox module for example that everyone can use
100s of centralized modules
Instead of copying and customizing, you have one that works for all languages
at least that is the idea
When we are using too many enittyes, we bump into the entity usage limit
Then we .... bundling ..... ?
We need to be wise about waht we are using and if it is really helpfull
Lucas: I think that limit needs ot be bumped, as we have way more propertie snow and this has not been increaseed in many years
Even just showing all external identifies, this is going to query them all, even if they are ont used
It has maybe been 33 since 2015
I wonder if it would be possible to have manually configured sets of properties
we have these 500 proepties that are alwasy used together becase external identifiers?
If it is using these properties, and fewer other propeties... let it use them?
If I remember the limit is not more than 400 entities per 1 page
Lucas: normally if you use the main entity a page is about, the usage tracking will liekly use the main properties from this, but not the rest of the usages from other items etc
About changing this number, ther ei a trade off
If it is above this number, it is recoreded a single line record in the entity usage table
If it is above this limit then there would be 33+ lines in the table
Arent we moving that tbale to a seprate DB now?
I think we are moving thr RC table, but not the EU table