#ActivityPub developers only please: how many items should be in a full collection page?
#ActivityPub developers only please: how many items should be in a full collection page?
So, here's the trade-off: adding embedded objects can reduce the number of extra HTTP requests required to render the page of objects. For example, if showing a `followers` collection, adding each actor's name, avatar, and so on can be a real savings.
However, it puts a lot of costs on the server -- looking up cached or local data about each object.
Long story short: adding embedded objects is a pressure towards having smaller page sizes.
If you're not showing embedded objects, then filling up a collection page is usually just a couple of database queries. And adding more items to the page has very little extra cost.
The bigger your pages are, the fewer requests a client has to make to get all the data.
So, I think if you're not doing embedded objects, the pressure is towards bigger pages.
There are a couple of other confounding factors.
Adding embedded objects makes supporting HTTP Caching harder. The `ETag` header isn't too hard, but `Last-Modified` is difficult. You need to check not only what the collection page modification date is, but also each of the embedded objects (and take the max date!). It's a pain and most folks don't even implement it.
@[email protected] I don't support polls on NodeBB yet so can't vote, but...
Default perPage is 20*. This is configurable in the admin control panel.
* except for user outboxes. That uses a cursor, not pages.
@[email protected] As an opinion that is likely to be very unpopular... the page size ideally should be set by the client. Only they know their resource makeup and ability to process the returned information.
Otherwise, we tend to run page size between 60 and 100 depending on the content. And if it's less than 100 entries (and especially when returning an id-list rather than a list of activities), we'll usually just send them out without paging.
The desire is to balance resource usage to get the highest rate of information transfer, and those are the only levers we have available, and they (currently) aren't settable by clients, so it seems the best we can do is default to "large chunks".
I admit that I'm not fond of the page size of 12 that I found in Eugen's followers list of over half a million entries (some years ago). That's a lot of network requests and makes their clients work a lot harder than they need to.
perPage style value that could be passed to servers.
@[email protected] in reverse chron every page changes when a new item is pushed to the stack.
Even in chronological sets if you need to account for deletions you've basically given up already because there's no immutability guarantee! This is why caching headers exist, no?
@julian that's the way to do reverse chron that messes with caches!
Instead, number your pages from oldest to newest. So page 1 was the first page created. After PAGE_SIZE items have been added, create page 2, make it the `first` page, and now page 1 never changes (unless one of its items gets `Remove`d). All your volatility is in the most recent page, and older pages rarely change.
You can also use UUIDs or other IDs for pages.
@[email protected] @[email protected] -- Now I see why I missed it. These additional properties aren't actually defined in the AS spec but only the FEP(?) immediately after implying that the pagination properties were all specified in the AS spec. I get it now, but maybe a wee bit of word-smithing in the FEP could make this a bit clearer.
I guess the question remains how to determine if a site offers cursor-based pagination or recognises 'maxItems' per FEP-9f9f. Guess you need to just try it, maybe with an odd number like 19, and see if what you get back is "consistent" with your request, to see if you should continue trying to use client defined pagination for this site. (This might be another good use case for the server 'capability' mechanism.)