[squid-users] TCP_MISS only

Amos Jeffries squid3 at treenet.co.nz
Thu Sep 29 12:03:46 UTC 2022


On 28/09/22 07:56, Andy Armstrong wrote:
> Okay – but what happens if you are communicating with a non REST 
> endpoint.

You are still communicating over HTTP. To interact with and benefit from 
HTTP agents like caches you need to comply to the HTTP semantics they use.

IMO, REST is just a useful tool to define (in abstract) an API's 
operation when considering what/how it needs to be implemented.


> Consider a Web services endpoint for example where a request 
> is only interacted with via POST but the operation for example may 
> frequently be a read based function akin to a HTTP GET?

That is by definition a broken implementation of HTTP. The agent is 
using a *delivery* API (POST) for retrieval (GET).

If you can separate the delivery and fetch operations HTTP becomes much 
easier to use.


> Is Squid just 
> simply not going to help cache those requests?

Not *by default*, no.

POST implies changing some arbitrary resource *other* than the URL 
presented. Based on data and logic which may not be provided in the 
request message URL+headers.

To use POST with caching both the client *and* the server have to 
explicitly tell the HTTP cache agent(s) what to do on every single HTTP 
message.

  - The client has to tell the cache whether a stored response is able 
to be produced as reply, what object-ID it is trying to retrieve, what 
object-ID's it already knows about (if any), and how old the stored 
object is allowed to be.

  - The server has to tell the cache whether the response can be stored, 
what to use for a unique-ID of the reply object, how old it already is, 
how long it can be stored for, how and when to update it when it becomes 
stale.

The Squid refresh_pattern can provide defaults for the storage times 
when they are omitted. But all the ID related things and whether to use 
cache at all can only come from the client/server.


As you can see by limiting yourself to POST-only you have imposed a huge 
amount of complexity. Using GET instead for fetches makes all the above 
*optional* where now it is mandatory.


> It is only helpful for 
> more strict alignment to REST principles?
> 

You lost me here. Squid implements HTTP.

REST is a very abstract simplification of basic HTTP/1.0 semantics. So 
the closer ones code aligns to REST the *easier* it is to implement HTTP 
properly. But HTTP/1.1+ are vastly more than REST.

HTH
Amos


More information about the squid-users mailing list