ogallagher / tejos_textiles

An online arts journal for publishing works in a new medium
MIT License
1 stars 0 forks source link

Cache server paths entry not set #36

Closed ogallagher closed 8 months ago

ogallagher commented 4 years ago

No error is thrown when calling cache.set(), but whenever the cache server attempts to retrieve the paths for a puzzle, the result always seems to be null. I wonder if the size of the value to be cached is too large?

ogallagher commented 4 years ago

It turns out the max size for a memcached entry is 1MB; the paths for a typical textile will definitely be bigger than this, so I should create a way for larger cache entries to be split for store, and joined for retrieval (... or switch to a Redis cache server, which is a newer alternative and permits customization of entry size...). This will be difficult 😣

ogallagher commented 4 years ago

I may have figured out an easier way to make a full paths fetch fit nicely into a memcached entry, by compressing it. I’m planning on using brotli (accept-encoding: br) compression to, for now, just shrink database fetch_puzzle_paths results, since these are by far the worst offenders in terms of page load time, and size when trying to cache them. Here are some results from testing:

- quality = 11
    - in file           2.4 MB
    - out file          600 KB
    - time elapsed      30964 ms (30 seconds)

- quality = 10
    - in file           2.4 MB
    - out file          621 KB
    - time elapsed      11406. ms (11 seconds)

- quality = 8
    - in file           2.4 MB
    - out file          695 KB
    - time elapsed      1036 ms (1 second)

I’ll probably use a compression quality of 8 or 9, which seems a good balance between speed and size.

ogallagher commented 4 years ago

Well, I finished implementing the compression of cache server entries for puzzle paths db requests, but apparently they’re still not being stored as memcached entries, even though the size of each entry appears to be less than 1MB... I’m not sure why it’s not working now.

ogallagher commented 4 years ago

I’ve gotten to the point where I’m storing some sort of brotli compressed version of the stringified paths result for a puzzle, but I can’t convert it back to a string and parse it into an object again.

ogallagher commented 4 years ago

... well, as of earlier today I thought I had figured out how to properly compress, store, retrieve, and decompress, but now the store step is not working again. I’m stumped :L

ogallagher commented 8 months ago

The separate cache server is not currently used, so this issue can be abandoned for now.