-
Notifications
You must be signed in to change notification settings - Fork 133
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
parallel data querying principes #974
Comments
@ahoyahoy Generally speaking, Orbit's request and sync queues are designed to give you control over your application's data flows. Queries and updates may be interleaved in a source's request queue, and Orbit provides a guarantee that these requests will be processed in the order they are received. For example, if a request deletes a note, then a subsequent query for all notes will not include that note. Furthermore, if there is a network outage, then there is a guarantee that this order will be maintained as requests are periodically retried.
Yes, this is the mechanism that allows for default parallelization of fetch requests when processing a query. Updates can also optionally be parallelized (via the
Given your example, I would tend to aggregate data loading at a boundary that is clear for the user: like a route or page. Depending on your framework, you could also use a higher order component. In general, I avoid loading data in components unless it is acceptable to show loading state within that individual component. Otherwise, data flashes into components almost randomly throughout the page just based on the timing of many individual fetch requests, which can be disorienting. With all that said, there are exceptions to every rule, and my goal with Orbit is to provide a configurable general purpose data library and not to force your hand with UX decisions about where and when you should show spinners in your app. I am open to providing an option (e.g. |
thanks for the clarification :) I'm calling orbit queries in asynchronously loaded components, which is even put together by the user and not the programmer... low code A visual example could be on the page https://remix.run/ `skipRequestQueue' sounds like a great idea to me. :) |
@dgeb Hello Dan, |
Please help me understand why all queries (jsonapi) are executed only serially and what are the recommended approaches for ideal data retrieval.
Let's say I have an entity "notes". I have a left menu where I load a list of articles with limited fields. Only name and id for example.
Then there is a content section where you can see several "last edited" notes. For example, 6 tiles, where each one individually executes a query to get the complete Note data.
As long as the user does not have the data stored in the cache, these tiles will be loaded one by one with a delay of 200 ms, which is quite visible.
If there are several different entities and their queries on a page, the whole page will load quite visibly slowly (for the user).
From 0.17 there is the possibility of multiple expressions, where I can make multiple queries in parallel. So it is theoretically possible to make some kind of "throttle" aggregator that will load all "last edited notes" tiles at once.
But according to the documentation: "but query will only resolve when all have completed successfully".
This exposes the application to potentially bigger crash than if only one Note tile fails for some reason.
And it seems strange to me to merge queries from several entities across the page.
Can you please explain me the reasons for this (only serial) architecture and how I should design the querying to be as fast as possible?
The text was updated successfully, but these errors were encountered: