cache-handler icon indicating copy to clipboard operation
cache-handler copied to clipboard

can't figure out badger

Open tve opened this issue 2 years ago • 1 comments

I'm trying to cache a 2.7MB response and I get a badger error (see #8):

Oct 10 09:12:24 cloud caddy[2743409]: {"level":"debug","ts":1665418344.1734848,"logger":"http.stdlib
","msg":"http2: panic serving 0.0.0.0:56316: Impossible to set value into Badger, Value with si
ze 2779485 exceeded 1048576 limit. Value:\n00000000  48 54 54 50 2f 30 2e 30  20 32 30 30 20 4f 4b 0

Looks like there's a 1MB limit. The README points to "See the Badger configuration for the options" which links to https://dgraph.io/docs/badger/get-started/. Well, I'm probably blind, but I don't see any documentation about configuration there.

I'm also not finding any information on how the cache handler uses badger (store metadata, store responses, store ...?). Nor on what the default configuration is. E.g. is it used as in-memory cache, or on disk? If the latter, where is the data stored on disk? ...

I tried the following, but it doesn't change the error:

        route /data/* {
                cache {
                        badger {
                                configuration {
                                        MemTableSize 8000000
                                        ValueThreshold 4000000
                                }
                        }
                }
                reverse_proxy https://motus.org {
                        header_up Host motus.org
                }
        }

Putting the badger config in the global cache directive has the same results.

tve avatar Oct 10 '22 16:10 tve

Personally I would recommend using the nutsdb setup, badger has been nothing but unstable for myself. (I am also caching pretty big full page responses).

In the latest version redis support has also been added which may be an even better option. Caddy caching in general is still pretty flakey but its definitely getting better with the latest releases.

mattvb91 avatar Oct 13 '22 08:10 mattvb91

Hi @tve can you retry with the latest version please?

darkweak avatar Dec 23 '22 10:12 darkweak

I also had this issue with the latest master commit and traced it down to: https://github.com/dgraph-io/badger/issues/60

jpds avatar Jul 30 '23 21:07 jpds

@jpds same as explained here https://github.com/caddyserver/cache-handler/issues/55#issuecomment-1638919674

darkweak avatar Jul 31 '23 10:07 darkweak