Skip to content

refactor slot mechanism  #4

@siddontang

Description

@siddontang

Now xcodis use redis/ledisdb db index as slot, ledisdb can only support 256 dbs, this is too small can increase the probability of busy keys in same slot.

I don't want to change ledisdb code and upgrade all data, this is a very huge work and has some risks.

Maybe we can do this, codis saves all data in db 0, and in the inner modified redis, codis uses a slot hash to store slot and its associated keys, this is convenient when migrating a slot from one redis to another, we will not scan all redis keys but only keys in the slot hash.

LedisDB can not use this feature which may cause many code changed. So when migrating slot, we have to scan all keys, find the actual key in the slot, then migrate it. This may be not efficient but acceptable:

  • Migration does not happen frequently.
  • When a slot is migrating, e.g, from group1 to group2 for slot0, if xcodis want to operate a key in slot0, xcodis will force trying to migrate this key whether it is in group1 or already in group2. Migrating a key is very fast.

So migrating a slot does not block whole service, but only a little slow.

@kouhate, how do you think so?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions