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

RFC 72: Store routes in content-store only #72

Closed
wants to merge 1 commit into from
Closed

Conversation

govuk-rfc-bot
Copy link
Contributor

No description provided.


### Changes required to content-store

Content-store should start storing routes (including redirects) as separate collections in its own datastore. This could be achieved by copying over the Route and Backend models from router-api. (Although in theory it should be possible to modify router to read the routes and redirects from the existing ContentItem model structure, attempts to do so made route reloading impractically slow.) A migration will be needed to create all the existing routes and backends.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By paul.bowsher on 2017-05-11 13:43:19.341

Can you talk more about or link to this experiment? Was this tried in Ruby code or by writing a map/reduce function to run inside Mongo? It *feels* (with absolutely no evidence whatsoever) that writing a query for the JS engine to execute should be able to return things quickly enough. It'd also be good to know how slow is impractical.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By danielroseman on 2017-05-11 15:05:40.263

I originally did an experiment with rewriting the router app to read from the content_items collection. But the slowness was in the iteration over the data in Mongo itself, not in the Go code; it seems that (at least in the old MongoDB version we are running), doing any kind of iteration over documents that contain large amounts of data, even if those fields are excluded via projection, is slow - I measured it as taking 37 seconds, vs < 5 seconds in the original. My concern was that this would lead to a return of the kind of issues that led us to introduce the async reloading last year.

I don't think mapreduce or aggregation would help; we just need to iterate over a dataset.

But in any case, having rejected this option I now do think we can get a better outcome by splitting out the routes and redirects anyway; it simplifies the data as well as the lookup code.


Whitehall's organisation\_slug\_changer task is the only other place in our stack that calls router-api directly. This should be rewritten so that it send redirects to the publishing-api.

All publishing applications should send explicit routes to the publishing platform for documents that contain sub-pages. Travel-advice-publisher is already doing this, but publisher is not.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By tijmen.brommet on 2017-05-11 15:37:45.260

What would happen if we didn't do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By danielroseman on 2017-05-11 15:57:21.861

You're right that this may not be required. My thinking was that it would make it hard to find the content item related to a sub-page - but the same argument could be made about any prefix route, and we clearly do need to continue to support those for things like smart-answers and local transactions. But extending the travel-advice change to guides in publisher would probably be a good cleanup nonetheless.


### Changes required to content-store

Content-store should start storing routes (including redirects) as separate collections in its own datastore. This could be achieved by copying over the Route and Backend models from router-api. (Although in theory it should be possible to modify router to read the routes and redirects from the existing ContentItem model structure, attempts to do so made route reloading impractically slow.) A migration will be needed to create all the existing routes and backends.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Router currently allows things that router-api doesn't - for example an exact and a prefix route at the same level is allowed in router, but not in router-api
Is the intention to reuse the router-api behaviour, try and get closer to router's capabilities, or something else?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know the history of that difference? If router-api prevents it, then the only way this can happen is via router-data, which we're also killing anyway.

@sihugh
Copy link

sihugh commented May 19, 2017 via email

@boffbowsh
Copy link
Contributor

This proposal moves us away from the idea of dumbing down Content Store so it could in theory be just a bunch of files or S3 keys. We've never truly cemented that idea and agreed on it, but we should discuss the implications.
I'm still pretty keen on that idea - it has a lot of knock-on benefits such as simple caching, easier disaster recovery / static mirroring, and simpler deployment of frontend applications.
I think the Q2 work on the API for Content will end up informing this decision too. The outcome of that might be a replacement for Content Store, or it might add lots of additional complexity to the Content Store.

@tijmenb
Copy link
Contributor

tijmenb commented Nov 7, 2017

@danielroseman should we close this until there's consensus?

@danielroseman
Copy link

Yeah, probably. I still think it would be a useful simplification on balance, albeit at the cost of adding some extra complexity in content-store. But since there is little prospect of anyone having time to do the work in the near future anyway, we might as well close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants