Re: Prefetching VS HATEOAS
Shea Levy <[email protected]>
| Newsgroups | gmane.comp.web.services.rest |
|---|---|
| Message-ID | <[email protected]> |
On 04/17/2013 03:21 PM, Erik Wilde wrote: > hello shea. > > On 2013-04-17 12:13 , Shea Levy wrote: >> Often when designing REST interfaces for relational resources, I run >> into a tension between the efficiency of prefetching a related resource >> when one is requested on the one hand and the simplicity, elegance, and >> generality of referencing related resources via hypermedia. Does anyone >> have any advice on how best to manage that tension? > > maybe i am misreading what you're saying, but i don't really see a > tension in the sense of a conflict, more a design trade-off. > prefetching is on the implementation level (it seems) Well, yes and no. I was specifically thinking of a server-side prefetch, where a single request returns multiple resources (rather than a client intelligently pulling more than it needs). That's a difference in interface, not just implementation. > , and you would prefetch something based on the assumption that a > request to a linked resource would be received soon, right? the tricky > part probably is to avoid making prefetching stateful, assuming that > the request for the related resource will be processed by the same > server (if you have more than one). so if you make prefetching > stateful, you run the risk of making it unlikely to actually provide > you the benefit it can provide in a more stateful setting. so i guess > in the end my answer would be: don't start implementing stateful > patterns based on perceived performance benefits that rely on your > service behaving in a stateful way. > > cheers, > > dret. >