增加自动读写分离 #17

Closed
opened 2013-09-30 06:45:13 +00:00 by insionng · 4 comments
insionng commented 2013-09-30 06:45:13 +00:00 (Migrated from github.com)

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

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

同时连接两个数据库,建议支持不同类型数据库间主从\双主等方式,如果我读选了sqlite,写选了pgsql,希望这样也可以. 主的允许读写,从的只允许读等等.. 可以提高性能,ORM内部自动切换..
wukehong commented 2013-10-10 10:21:52 +00:00 (Migrated from github.com)

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

这个我本人认为,可以不支持,你可以同时连接两个数据库,在应用层面自己解决这个问题。
insionng commented 2013-10-10 11:12:29 +00:00 (Migrated from github.com)

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

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

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

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

referenced #78

referenced #78
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#17
No description provided.