I'm experimenting the small objects cache feature in 1.8, maybe I'm
doing something obviously wrong, but I don't get what...

Here is my setup:

(...)

cache static_assets
     total-max-size 100
     max-age 60

(...)

frontend fe_main # HTTP(S) Service
    bind *:80 name http

    acl cached_service-acl hdr_dom(host) -i cached_service.localdomain
    use_backend be_cached_service if cached_service

backend be_cached_service
    acl static_cached_paths path_end -i my/resource/path
    http-request cache-use static_assets if static_cached_paths
    http-response cache-store static_assets
    server srv0 127.0.0.1:8000

In that case I can request on /my/resource/path and I'll have something
stored in the cache:

$ $ curl -v -L http://127.0.0.1/my/resource/path -H "Host:
cached_service.localdomain"
(...)
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Tue, 09 Jan 2018 18:32:05 GMT
< Content-Length: 14
<
[
    "tmp"
]

$ echo "show cache static_assets" | sudo socat stdio /var/lib/haproxy/stats
0x7fbfa94df03a: static_assets (shctx:0x7fbfa94df000, available
blocks:102400)
0x7fbfa94e11ac hash:3952565486 size:190 (1 blocks), refcount:0, expire:54

But, if I request something else, it currently override the first cached
asset and will be served then...

$ curl -v -L http://127.0.0.1/my/other/resource/path -H "Host:
cached_service.localdomain"
(...)

< HTTP/1.1 200 OK
< Content-Type: application/json
< X-Consul-Index: 77
< X-Consul-Knownleader: true
< X-Consul-Lastcontact: 0
< Date: Tue, 09 Jan 2018 18:33:30 GMT
< Content-Length: 547
<
{    "something_more_verbose(...)"   }

$ echo "show cache" | sudo socat stdio /var/lib/haproxy/stats
0x7f4c5ea5a03a: static_assets (shctx:0x7f4c5ea5a000, available
blocks:102400)
0x7f4c5ea5a4cc hash:3952565486 size:797 (1 blocks), refcount:0, expire:55

The entry has been flushed and replaced by the new one, independently
from the expiration state.

In that case it's consul that answer, so it explains these X-Consul
headers for the 2nd response.

Does it ring a bell to someone ?

Thanks,

Pierre


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to