casbin-redis-watcher icon indicating copy to clipboard operation
casbin-redis-watcher copied to clipboard

Casbin Redis Watcher update by re-loading the whole casbin policy table

Open bingmwu opened this issue 3 years ago • 6 comments

We are using Casbin Redis Watcher to help synch-up the policies among different Casbin nodes. The way the Watcher is implemented is to re-load the whole policy table during update. This could be really slow if the size of the table grows to 1 million to 10 million records, which is the size of policy we are seeing to grow into. Is there a better way to synch-up the policies among nodes, using the Watcher? Or if the Dispatcher is only viable alternative?

bingmwu avatar Mar 24 '21 17:03 bingmwu

@bingmwu you can use WatcherEx: https://casbin.org/docs/en/watchers#watcherex

hsluoyz avatar Mar 26 '21 05:03 hsluoyz

@billcobbler

hsluoyz avatar Mar 26 '21 05:03 hsluoyz

@hsluoyz So we will need to do our own implementation for watcherEx interface, since there is no implementation yet? Just to confirm. Thanks.

bingmwu avatar Mar 27 '21 15:03 bingmwu

@bingmwu yes, can you make a PR to implement it?

hsluoyz avatar Apr 04 '21 02:04 hsluoyz

@hsluoyz we looked at the WatcherEx, but not sure how to access the in-memory model of enforcer, from a WatcherEx. What we need is to update the in-memory model, without saving the policies to the database through JDBC adaptor, when the watcher got an updated policy event.

bingmwu avatar Apr 06 '21 16:04 bingmwu

@bingmwu we will implement the Redis WatcherEx: https://github.com/casbin/redis-watcher/issues/1

hsluoyz avatar Apr 13 '21 05:04 hsluoyz