Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

增加自动读写分离 #17

Closed
insionng opened this issue Sep 30, 2013 · 4 comments
Closed

增加自动读写分离 #17

insionng opened this issue Sep 30, 2013 · 4 comments

Comments

@insionng
Copy link
Contributor

同时连接两个数据库,建议支持不同类型数据库间主从\双主等方式,如果我读选了sqlite,写选了pgsql,希望这样也可以.

主的允许读写,从的只允许读等等..
可以提高性能,ORM内部自动切换..

@wukehong
Copy link

这个我本人认为,可以不支持,你可以同时连接两个数据库,在应用层面自己解决这个问题。

@insionng
Copy link
Contributor Author

的确应用层什么都能解决,就像缓存一样,xorm本来可以没有缓存,也可以在应用层解决.
但为什么建议在orm内部就支持呢?因为从底层支持和应用层支持有本质上的区别,应用层支持很多时候粒度非常大,成本很高,在底层就处理这个的话就比较容易做到,而且事成之后在基于xorm的架构里就可以轻松通过开关设置开启这样的功能,这对于用户节约开发时间和提升程序性能都极有好处!

@nashtsai
Copy link
Member

this is a good and actually common use case, but I would solved the problem by writing proxy driver, which allow multiple hosts, and declaring roles inputted as part of dataSourceName param

@lunny
Copy link
Member

lunny commented May 31, 2014

referenced #78

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants