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

Use the $expand parameter when querying collections #340

Open
Arno500 opened this issue May 20, 2024 · 1 comment
Open

Use the $expand parameter when querying collections #340

Arno500 opened this issue May 20, 2024 · 1 comment

Comments

@Arno500
Copy link

Arno500 commented May 20, 2024

When querying subcollections, gofish is currently iterating manually 3 by 3 to get the data. This is painfully slow, especially when the collections are big and the server is far away.

I would propose to include support for the $expand OData parameter when supported (this needs to be checked when querying a collection for the first time on this entity). It would allow the device to answer once for all the sub elements when asked, making the query much faster and reducing the impact of latency.

My specific case was requesting a PDU with 48 plugs, that is pretty slow in Redfish already. Querying all of them individually is not exactly fun as you can guess :P

@stmcginnis
Copy link
Owner

Thanks for bringing this up. It is an interesting idea. The Redfish service can be a little slow responding, but that network latency of making multiple calls to get the elements is definitely the bigger bottleneck.

I haven't spent a ton of time on this, but what I had thought about doing was to set a flag if it's supported. Luckily, the ServiceRoot object that you get at the root of the object hierarchy should contain ServiceRoot.ProtocolFeaturesSupported.ExpandQuery.ExpandAll. So right away on connection it should be possible to determine if the service will support expanding collections or not.

The trickier part is probably including that in a uniform interface for the library consumer. But I think during the custom unmarshalling that we need to do, we could try to collect that array of sub-objects in a private property. Then the consumer would still call the same method as they would if expand wasn't being used (e.g. outlets, err := pdu.Outlets()). Then internally, if the expanded data is there we can just return the collection of objects. If it is not there, then we can use the existing method of getting the collection of objects the slower way.

I will try to get some time to try this out some time soon.

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

No branches or pull requests

2 participants