Propel 中的数据库分片支持
只是想知道 Propel 对数据库分片的支持有多好? 我正在考虑用 PHP 创建我的应用程序,使用 MySQL 作为数据库服务器,使用 Propel 作为 ORM。
我发现从一开始就保持架构可扩展可能是件好事,以防万一我的应用程序起飞。
你怎么看?
Just wonder how good is Propel's support for database sharding? I am thinking about creating my application in PHP, using MySQL as the database server and Propel as the ORM.
I figure out that it may be good to keep the architecture scalable right from the start, just in case my application takes off.
What's your take?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为这是一个非常糟糕的主意。 假设您需要对数据进行分片并不是一个好的假设。 您事先并不知道要如何扩展。 分片是一项非常复杂的业务,需要尽可能避免。 这是一个过早优化的恶劣案例。
I think that's a very bad idea. Assuming that you need to shard your data is not a good assumption. You don't know, in advance, how you're going to want to scale. Sharding is a very complicated business and needs to be avoided if at all possible. This is an obscene case of premature optimisation.
我同意 MarkR 的观点,即现在担心分片还为时过早,但我不同意应该尽可能避免分片。 我想说选择似乎适合您的风格和语言选择的 ORM——而 Propel 可能是适合您的情况的选择。 即使您的应用程序取得了很大的发展,分片也可能没有必要——您可以使用基于 MySQL 的 DBMS 和一些不错的缓存技术轻松获得 2500 万条记录,因此只需专注于使查询更快并进行设计轻松实现内存缓存集成,即使您的应用程序成功,您也会成为一名快乐的露营者。
祝你好运!
I agree with MarkR that it's too early to be worrying about sharding, but I disagree that it should be avoided if at all possible. I'd say go with the ORM that seems to fit your style and language choice -- and Propel is probably the right one in your case. Even if your application takes off in a big way, sharding probably won't be necessary -- you can easily pull off 25 million records with a MySQL-based DBMS and some decent caching techniques, so just focus on making your queries fast and design for easy memcache-integration, and you'll be a happy camper even when your app takes off.
Good luck with it!
Propel 通过连接支持开箱即用的分片。 请查看此处的示例:
http://groups.google.com/group /propel-users/browse_thread/thread/4d19c0668aa17452
Propel supports sharding out of the box through connections. check an example here:
http://groups.google.com/group/propel-users/browse_thread/thread/4d19c0668aa17452
一些数据库分片中间件可以帮助您。
例如:Apache ShardingSphere (https://shardingsphere.apache.org/document /current/en/features/sharding/)
ShardingSphere有2个适配器,JDBC和Proxy。 JDBC是连接数据库的java驱动程序,不适合PHP,但Proxy就像数据库(MySQL或Postgres)一样。
ShardingSphere-Proxy可以隔离数据分片和业务逻辑。 最好使用第三方中间件来处理常见问题。
Some database sharding middleware can help you.
For example: Apache ShardingSphere (https://shardingsphere.apache.org/document/current/en/features/sharding/)
There are 2 adaptors of ShardingSphere, JDBC and Proxy. JDBC is the java driver to connect database which no fit for PHP, but Proxy is just like the database (MySQL or Postgres).
ShardingSphere-Proxy can isolate the data sharding and business logic. It is better to use third party middleware to handle common problems.