大型 iPhone 用户数据库的在线存储/同步:在服务器上还是在设备上执行?
我正在为一个流行的基于 SQLite 的 iPhone 抽认卡应用程序开发在线用户数据库备份/同步系统;这是相当大的规模 - 我们可以很快获得 1 亿个单独的抽认卡记录或更多(10,000 个用户,每个用户 10,000 张卡片) - 我们需要在设计系统时考虑到这种可扩展性。但我们并不是真正从事基于网络的软件业务,至少最初我们并不打算提供除帐户管理之外的这么多网络界面——所有用户数据的实际操作都将离线进行。
因此,我们似乎有两个基本选项来实现这一点:
在服务器上执行同步;将所有用户数据存储在 MySQL 数据库中(或者在我们扩展时将其存储在一堆)中,并仅下载/上传更改列表。
本地执行同步;从服务器下载最新版本的数据库,在设备上检查/应用更改,然后上传合并的数据库。
看来本地同步选项意味着我们端的编程工作会少得多,托管成本也会低得多,但也意味着我们的用户会使用更多的带宽 - 每个同步操作可能需要 2-4 MB 左右的带宽基于网络的同步需要几十K。
有人觉得其中一种选择明显优于另一种吗?还有其他我们没有考虑过的方法吗?
谢谢。
I'm working on an online user database backup / sync system for a popular SQLite-based iPhone flashcard app; this is fairly large-scale - we could pretty quickly get to 100 million individual flashcard records or more (10,000 users, 10,000 cards each) - and we need to design the system with that sort of scalability in mind. But we're not really in the web-based software business, and at least initially we're not planning to actually give this much of a web interface except for account administration - all of the actual manipulation of user data would occur offline.
So it seems like we have two basic options for how to implement this:
Perform the sync on the server; store all the users' data in a MySQL database (or a bunch of them as we scale up) and download / upload lists of changes only.
Perform the sync locally; download the latest version of the database from the server, check for / apply changes on-device, then upload the merged database.
It seems like the local sync option would mean a lot less programming work and much lower hosting costs on our end, but would also mean significantly more bandwidth usage for our users - probably something on the order of 2-4 MB for each sync operation versus a few dozen K for a web-based sync.
Does anybody feel like one of these options is clearly better than the other? Is there some other way of doing this we haven't considered?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可能不太理解这种工作方式,但是,由于这是同步,为什么数据库的本地副本无法记录可以在服务器端复制的更改列表?这仅适用于单个设备,当然不能将多个设备同步到同一数据集。
更改可以通过多种方式记录:例如您可以对iPhone上的记录进行校验,并在同步时再次校验,然后上传已更改的记录,删除则需要单独记录。
I could be way off with the way this works but, as this is synchronisation, why would the local copy of the database not be able to record a list of changes that can then be replicated on the server side? THis only works for a single device of course not syncing multiple devices to the same data set.
The changes could be noted in various ways: eg you could checksum the records on the iPhone and checksum them again when synchronising, then upload the ones that have changed, deletions would need to be recorded seperately.