Skip to content

Storage backends: Redis #859

Closed
Closed

Description

@jrosdahl

Activity

  1. jrosdahl commented on Jun 27, 2021

    @jrosdahl
    MemberAuthor

    The API and framework is now ready:

    @afbjorklund: Would you like to work on a Redis implementation of that interface?

  2. afbjorklund commented on Jun 27, 2021

    @afbjorklund
    Contributor

    I can give it a try, hopefully some of the hiredis code can be reused from 0576d54 :

    0576d54#diff-acef7c5833ac8a6b1a9e6972bc1c48625ce677affe9fc468bbfade72f06e18e6R99

    Note: there will be no SSL support in the initial version, similar to decision for HTTP.

    https://github.com/redis/hiredis#ssltls-support

  3. jrosdahl commented on Jun 27, 2021

    @jrosdahl
    MemberAuthor

    Note: there will be no SSL support in the initial version, similar to decision for HTTP.

    👍

    Here are attributes I think would be good to have available:

    • connect-timeout: Timeout (in ms) for network connection. Default: something quite small. 50? 100? 200?
    • operation-timeout: Timeout (in ms) for Redis commands. Default: something quite large. 5000? 10000?
    • password: Password for the Redis AUTH command.
    • username: Username for the Redis AUTH command.
  4. jrosdahl commented on Jun 27, 2021

    @jrosdahl
    MemberAuthor

    Other suggestions:

    • Connect on the first call to get/put/remove and keep the connection open.
    • Remember connection failure and let subsequent commands fail early if there has been a failed connection attempt already.
    • Disconnect in the destructor.
  5. kilozap commented on Jun 27, 2021

    @kilozap

    hi there- first, a complement, I've been using an early implementation of this redis-based support from afbjorklund in a 'build-only' production environment (i.e. does the code build and link, CI/CD env) for a couple of months and have a fork I'm experimenting with, bravo for doing this. Been working well for the use case I'm testing with, nicely done! In the meantime I'm also reading through other forks with windows CL support and merging into said fork to see where both redis and CL ccache support gets us - really cool! Will be contributing back as soon as reasonable. Thanks

  6. kilozap commented on Jun 27, 2021

    @kilozap

    One suggestion for a feature that I will be adding/needing is 'read-only' from the remote cache (redis or whatever), so folks who can read cannot necessarily write so local changes don't pollute the cache but blessed stuff from the build machines populate instead, if it's not already there.

  7. jrosdahl commented on Jun 28, 2021

    @jrosdahl
    MemberAuthor

    One suggestion for a feature that I will be adding/needing is 'read-only' from the remote cache

    Yep, that's already in place: https://github.com/ccache/ccache/blame/39233da43f8c56e71d2727131bd63ad375898dba/doc/MANUAL.adoc#L905-L906

  8. added a commit that references this issue on Jun 28, 2021
    cdca903
  9. afbjorklund commented on Jun 28, 2021

    @afbjorklund
    Contributor

    I added a mention in the ccache documentation about using RocksDB for redis, similar to using Couchbase* for memcached.

    * Another similar option was using MemcacheDB.

    See https://github.com/afbjorklund/memcachedb (uses LMDB)

    It is up to the ccache user to provide a server for their storage, so they can best decide and make their own trade-offs...


    The default redis-server will fit everything into memory, while optionally keeping a transaction log or dumps for recovery.

    The alternative ardb-server will instead persist data to disk, while mapping frequently used cache entries into memory.

    See https://github.com/afbjorklund/ardb (uses RocksDB/LMDB)

    Default port: redis://localhost:16379

  10. added 3 commits that reference this issue on Jun 28, 2021
    677e26e
    7394b0c
    e93e8b4
  11. afbjorklund commented on Jul 3, 2021

    @afbjorklund
    Contributor

    I ported my python script (from memcached), that will upload the primary storage into the redis secondary storage:

    misc/upload-redis

    If you configure LRU eviction, it will make sure to fill up the cache with the MRU entries. That is, similar to memcached.

    https://redis.io/topics/lru-cache

  12. jrosdahl commented on Jul 10, 2021

    @jrosdahl
    MemberAuthor

    I wrote:

    • password: Password for the Redis AUTH command.
    • username: Username for the Redis AUTH command.

    I just found https://www.iana.org/assignments/uri-schemes/prov/redis and I now lean towards just using username/password from the URL and not have username/password attributes.

  13. afbjorklund commented on Jul 10, 2021

    @afbjorklund
    Contributor

    There is no support for username/password in the Url class (yet?), but when it is it should be simple to replace the attributes with it.

  14. jrosdahl commented on Jul 10, 2021

    @jrosdahl
    MemberAuthor

    There is no support for username/password in the Url class (yet?), but when it is it should be simple to replace the attributes with it.

    It's supported in user_info(), so just util::split_once on : and you should be home free.

  15. jrosdahl commented on Jul 10, 2021

    @jrosdahl
    MemberAuthor

    It's supported in user_info(), so just util::split_once on : and you should be home free.

    I'll have a look at this tomorrow.

  16. afbjorklund commented on Jul 11, 2021

    @afbjorklund
    Contributor

    Thanks for merging! I consider this redis storage backend a full replacement for the previous memcached branch.

    The only thing that is not fully obvious is how to run multiple servers, but that is an upstream issue (Redis Cluster).

    I don't think we need to add ccache support for it, though... It is possible to use a local redis proxy, such as nutcracker.

    Otherwise it would add complexity, with something like hiredis-vip. Similar to replacing memcached with libcouchbase.

    • "Client side partioning" + "Query routing" (-ASK / -MOVED)

    Currently the recommendation is to use multiple servers, possibly with disk-based caching, instead of Couchbase/Cluster...

    There is usually no need to replicate the cache, and the "consistent hashing" will make sure to distribute the keys (and load)

  17. added this to the 4.4 milestone on Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

issue: feature

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions