Addshore added a comment.

So the logging I added only ran for 7 minutes, but already gives us some idea of the usage of this thing:

getPropertyInfoForDataType was not called at all. After a quick look through the code the only place this seems to be called is on https://www.wikidata.org/wiki/Special:ListProperties

addshore@mwlog1001:/srv/mw-log$ cat AdHocDebug.log |grep "dataType" | wc -l
0

getPropertyInfo (by ID) is far more heavily used. Some requests can apparently call this many thousands of times. The below request involves http://wikidata.org/wiki/Q56596767 which is pretty large:

addshore@mwlog1001:/srv/mw-log$ cat AdHocDebug.log |grep W5jEGwpAAK4AAKd9eigAAAAV |grep "for property" | wc -l
23100

It might make sense to have cache keys per property instead. That would result in around cache entries instead.
We would still have to cover the case of wanting to retrieve all property info at once, but the main key holding all data could remain, but the traffic to it would be greatly decreased.

The request above would have result in 11 separate calls to the cache:

addshore@mwlog1001:/srv/mw-log$ cat AdHocDebug.log |grep W5jEGwpAAK4AAKd9eigAAAAV |grep "for property" | cut -c 130- | sort | uniq -c
     10 P1433
     10 P1476
   9170 P1545
     91 P1932
  13636 P2093
     10 P31
     10 P356
     10 P433
     10 P478
    133 P50
     10 P577

The number of calls to memcached essentially matches up to the number of properties referenced on the entity being touched.
I guess in the worst situation this would be ~6000, if an entity touched every single property, but this case would essentially never happen.
I'll try and get some numbers for the most number of properties used on a single entity.
If we were cleverer we could have some modifiable threshold to choose between hitting the cache of all property info vs the caches per property (if we go down this route)


TASK DETAIL
https://phabricator.wikimedia.org/T97368

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Addshore
Cc: Stashbot, gerritbot, Jdforrester-WMF, Joe, mark, Addshore, jijiki, akosiaris, Krinkle, JanZerebecki, thiemowmde, aude, daniel, Aklapper, hoo, AndyTan, Gaboe420, Versusxo, Majesticalreaper22, Giuliamocci, Davinaclare77, Adrian1985, Qtn1293, Cpaulf30, Imarlier, Lahi, Gq86, Baloch007, Darkminds3113, Bsandipan, Lordiis, GoranSMilovanovic, Adik2382, Th3d3v1ls, Hfbn0, Ramalepe, Liugev6, QZanden, LawExplorer, Vali.matei, Lewizho99, Zppix, Maathavan, Wong128hk, Wikidata-bugs, ArielGlenn, faidon, He7d3r, Mbch331, Jay8g, fgiunchedi, greg
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to