Page MenuHomePhabricator

Run load tests for the rec-api-ng and update production resources to meet expected load
Open, Needs TriagePublic3 Estimated Story Points

Description

In T308164, the ML team migrated the Content Translation Recommendation API to LiftWing.

The Product Team shared (T308164#9815882) an estimate of the expected traffic that the Content and Section Translation features will generate on LiftWing.

We are going to run load tests, measure the rec-api-ng performance, and then tune production to handle the expected load effectively.

Event Timeline

Change #1035868 had a related patch set uploaded (by Kevin Bazira; author: Kevin Bazira):

[research/recommendation-api@master] test: add locust load test

https://gerrit.wikimedia.org/r/1035868

klausman set the point value for this task to 3.Tue, May 28, 2:27 PM
klausman moved this task from Unsorted to In Progress on the Machine-Learning-Team board.

Change #1035868 merged by jenkins-bot:

[research/recommendation-api@master] test: add locust load test

https://gerrit.wikimedia.org/r/1035868

Change #1038346 had a related patch set uploaded (by Kevin Bazira; author: Kevin Bazira):

[research/recommendation-api@master] locust: use multiple payloads for load testing

https://gerrit.wikimedia.org/r/1038346

Change #1038346 merged by jenkins-bot:

[research/recommendation-api@master] locust: use multiple payloads for load testing

https://gerrit.wikimedia.org/r/1038346

I ran load tests for the rec-api-ng hosted on LiftWing using the locust configurations set in the repo. As shown in the test results below, over a 60s period, the API received 33 requests, and all of them were successfully processed without any failures, indicating stable performance:

TimestampTypeNameRequest CountFailure CountMedian Response TimeAverage Response TimeMin Response TimeMax Response TimeAverage Content SizeRequests/sFailures/s50%66%75%80%90%95%98%99%99.9%99.99%100%
20240606090807GET/api/33018001979.9090909090917673566336.39393939393940.57632045481788090.018002000260027003100340036003600360036003600

Additionally, I compared the performance of the rec-api instance hosted on LiftWing with that of wmflabs.org, and the test results showed that they are within the same range:

# rec-api hosted on wmflabs.org
$ time curl -s "https://recommend.wmflabs.org/api/?s=en&t=fr&n=3&article=Apple"
[{"pageviews": 1067, "title": "White_currant", "wikidata_id": "Q621670", "rank": 499.0}, {"pageviews": 33, "title": "Sphaceloma_perseae", "wikidata_id": "Q7576474", "rank": 498.0}, {"pageviews": 84, "title": "Cadra_calidella", "wikidata_id": "Q5016600", "rank": 497.0}]

real	0m3.913s
user	0m0.028s
sys	0m0.011s

# rec-api-ng hosted on LiftWing
$ time curl -s "https://api.wikimedia.org/service/lw/recommendation/v1/api?s=en&t=fr&n=3&article=Apple"
[{"pageviews": 1067, "title": "White_currant", "wikidata_id": "Q621670", "rank": 499.0}, {"pageviews": 33, "title": "Sphaceloma_perseae", "wikidata_id": "Q7576474", "rank": 498.0}, {"pageviews": 84, "title": "Cadra_calidella", "wikidata_id": "Q5016600", "rank": 497.0}]

real	0m3.281s
user	0m0.050s
sys	0m0.009s

Based on these results, the current resources allocated to the rec-api LiftWing instance will be able to effectively handle the expected load.