guardian / frontend

The Guardian DotCom.
https://theguardian.com
Other
5.85k stars 555 forks source link

Facia: Decommission `/lite.json` endpoint & `renderFrontJsonMinimal()`, reduce memory consumption #27143

Open rtyley opened 6 months ago

rtyley commented 6 months ago

See https://github.com/guardian/frontend/pull/26338#issuecomment-1664215110 - back in November 2017, https://github.com/guardian/frontend/pull/18364 & https://github.com/guardian/frontend/pull/18365 introduced the /lite.json representation of fronts:

https://github.com/guardian/frontend/blob/8bc978e662702c3972d86d504eeab9b7d2c0c41e/facia/conf/routes#L36-L39

The lite.json versions are actually not significantly smaller:

% aws --profile frontend s3 ls s3://aws-frontend-store/PROD/frontsapi/pressed/live/uk/fapi/
2024-05-14 12:38:40     501886 pressed.v2.adfree.json
2024-05-14 12:38:39     508012 pressed.v2.json
2024-05-14 12:38:40     352779 pressed.v2.lite.adfree.json
2024-05-14 12:38:39     358778 pressed.v2.lite.json

...and having 2 versions actually takes up additional memory that we could free up. Consequently I believe the the 'lite' versions should be completely removed.

Things to check...

See if the output of the endpoints that use the 'lite' versions (renderFrontHeadline(), renderFrontPressResult() & renderFrontJsonMinimal()) stays the same, depending whether they perform their own trimming that will work on the full versions of PressedPage, or if were relying on the trimmed nature of the 'lite' version at all.

alinaboghiu commented 5 months ago

We should pull this into our next health sprint

domlander commented 2 months ago

Steps:

  1. Create 0% test that stops using lite versions of fronts #27389
  2. Check fronts still work correctly, then set experiment to 1%. #27435
  3. Check metrics (what are we looking for?), then set experiment to 20% (10% or 50% also options).
  4. Check metrics, then remove experiment and stop using lite versions of fronts
  5. Removed unused code and refactor
domlander commented 2 months ago

Cannot find any metrics for users in the 1% test: https://logs.gutools.co.uk/s/dotcom/goto/7f66b430-65e8-11ef-9afb-57c59e22107a

UPDATE: I had forgot to switch the test on! https://frontend.gutools.co.uk/dev/switchboard

Test switched on at 11:30am 3/9/24

domlander commented 1 month ago

When restarting work on this ticket, give the Fairground team a heads up, as they are working on the fronts and this may affect them