Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike: Can we serve content directly from Publishing API? #2602

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

aldavidson
Copy link
Contributor

@aldavidson aldavidson commented Jan 15, 2024

Trello card / Spike notes document

A short spike to answer the question: could we, if we so decided, serve the GET requests which currently go to content-store, directly from publishing-api?

This does the minimum viable work to prove that concept. It adds a content_store/content_items_controller to serve unauthenticated GET requests on /content-store/(live or draft)/(base_path) and respond with the appropriate DownstreamPayload representation of the relevant edition:

image

Testing on a local laptop shows a response time that can vary between 35ms for pages with few links, to 1.5s for pages with hundreds of links such as FCDO. This isn't fast enough for production use as-is, but it's at least sufficiently close at the faster end to the c10ms content-store response time that we could imaging getting there with additional performance engineering and caching.

(There are many other reasons why this PR is a long way from production-ready, discussed in the Spike notes document linked above.)

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

This application is owned by the publishing platform team. Please let us know in #govuk-publishing-platform when you raise any PRs.

Follow these steps if you are doing a Rails upgrade.

@aldavidson aldavidson force-pushed the spike-serve-content-directly branch from 10a34e9 to 3119c5c Compare January 15, 2024 11:40
Basic copy-and-paste of find_by_path, which now works on editions.
Add controller in new content-store namespace to prove concept
of serving content-store requests directly from publishing-api.

The new controller responds on /content-store/(live or draft)/(path)
and uses the DownstreamPayload to present the relevant edition as JSON.

It takes just under 0.5s to respond on a local laptop. We'd need to
speed that up for production use, with some combination of optimisations
and caching. That's out-of-scope for this spike, we've proved that it's
potentially possible and that's enough.

linting
@aldavidson aldavidson force-pushed the spike-serve-content-directly branch from 3119c5c to 90779b8 Compare January 15, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant