Stable Outbox Collection Pages
-
Stable Outbox Collection Pages
1/
ActivityPub uses collections for a number of things:
• followers
• following
• inbox
• outboxAnd, rather than dump everything in the collection into a single document, ActivityPub paginates using collection pages.
That's great.
But, how you divide up a collection into pages matters and affects things. Such as: caching.
I'll explain.
Stable Outbox Collection Pages
2/
Let's say a collection has 23 items, and each page 10 items in length.
That means you will have 2 pages with 10 items and 1 page with 3 items.
Should that page with 3 items be the 3 newest items or the 3 oldest items.
The choice affects caching and static site ease quite a bit.
Here is the answer...
-
Stable Outbox Collection Pages
2/
Let's say a collection has 23 items, and each page 10 items in length.
That means you will have 2 pages with 10 items and 1 page with 3 items.
Should that page with 3 items be the 3 newest items or the 3 oldest items.
The choice affects caching and static site ease quite a bit.
Here is the answer...
Stable Outbox Collection Pages
3/
If the page with 3 items contains the 3 oldest items, then —
Every time a new items is added to the collection, then every single collection page will change. I.e., they all churn.
Which means that all cached copies of any collection pages will be invalidated.
Which means a static site generator will have to regenerate all of them again.
Etc.
BUT, if instead —
-
Stable Outbox Collection Pages
3/
If the page with 3 items contains the 3 oldest items, then —
Every time a new items is added to the collection, then every single collection page will change. I.e., they all churn.
Which means that all cached copies of any collection pages will be invalidated.
Which means a static site generator will have to regenerate all of them again.
Etc.
BUT, if instead —
Stable Outbox Collection Pages
4/
BUT, if instead — if the page with 3 items contains the 3 newest items, then —
Only the newest page would have to be recached. I.e., only 1 page churns not all.
All the other collection pages stay as is, and any cached copies of them as still valid.
Etc.
-
Stable Outbox Collection Pages
4/
BUT, if instead — if the page with 3 items contains the 3 newest items, then —
Only the newest page would have to be recached. I.e., only 1 page churns not all.
All the other collection pages stay as is, and any cached copies of them as still valid.
Etc.
Stable Outbox Collection Pages
5/
To me,, having the newest page of the collection be varying length one feel like a better strategy.
-
Stable Outbox Collection Pages
5/
To me,, having the newest page of the collection be varying length one feel like a better strategy.
@reiver I agree
-
? Guest crossposted this topic to General Discussion
-
@reiver I agree
@reiver I think there's a good trick where if your page size is N then your first page is always less than 2N, it's the volatile one, and when it gets to 2N you move N many to a next page and link it in. So your first page always has enough items.
Also, I think having static page objects, rather than offsets or fencepost items, is best for caching and traversal.
-
Stable Outbox Collection Pages
5/
To me,, having the newest page of the collection be varying length one feel like a better strategy.
@reiver With static/stable collection pages, how do you handle HTTP authorization (which disables HTTP shared caching by default)? For example, an outbox might have a combination of public and non-public activities so different users will see different pages and/or page contents. Also, one might not want to return Create and Updates activities for content that has been deleted (which could affect older static pages).
-
@reiver With static/stable collection pages, how do you handle HTTP authorization (which disables HTTP shared caching by default)? For example, an outbox might have a combination of public and non-public activities so different users will see different pages and/or page contents. Also, one might not want to return Create and Updates activities for content that has been deleted (which could affect older static pages).
I didn't talk about the following in this thread, because I was trying to keep its scope limited, but —
I think some of those things could be more easily addressed if value of the "orderedItems" or "items" was just a list of URLs each pointing to a document containing the activity.
...
-
I didn't talk about the following in this thread, because I was trying to keep its scope limited, but —
I think some of those things could be more easily addressed if value of the "orderedItems" or "items" was just a list of URLs each pointing to a document containing the activity.
...
So, one technique could be that a server lists activity URLs for everything. Including information that requires HTTP authorization.
And the server would return a 401 or 403 for activities that the user is not auth'ed to view.
...
Alternatively, an auth'ed user could be redirected to another collection with other collection pages.
...
-
So, one technique could be that a server lists activity URLs for everything. Including information that requires HTTP authorization.
And the server would return a 401 or 403 for activities that the user is not auth'ed to view.
...
Alternatively, an auth'ed user could be redirected to another collection with other collection pages.
...
Regarding Create and Updates activities for content that has been deleted —
...
These could always be turned into Tombstones.
Which is easier to do with separate activity documents being pointed to from the outbox.
...
But, if the software wants to completely purge this data, then that would force a cache invalidation potentially across many collection pages.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login