本地与远程数据同步
我们有一个带有访问数据库的本地服务器,它将数据提供给同一域中的客户端。现在我们还有一个外部托管的网站,并在桥接系统上工作,提供产品、类别和订单等的上传/下载功能。
产品、类别和客户等只能在本地添加,但是可以添加订单本地和网站上。我们正在尝试通过使用 Web 服务的桥接应用程序来同步这些内容。我们已经完成了这项工作,但遇到了更多问题。我们当前的方法是:
- 每个单独的记录都有一个本地 id (luid) 和一个 Web 服务器 id (suid),一个使用示例是当在网站上添加一个项目时,它会被赋予一个唯一的 suid,并且 luid 为 -1 ,一旦桥接应用程序下载了该项目,就会应用并更新 luid。这与本地服务器上添加的项目相反。
- 每个单独的记录还有一个标志字段(突出显示插入、更新、删除(从网站)和删除)。
上面的方法运行良好 - 除了 luid 和 suid 方法使得在下载项目后无法轻松跟踪记录关系之外。这种方法似乎只适用于单向数据 - 即只需将产品上传到网站以供查看(并动态更新和删除它们)。
为了解决这个问题,我考虑过使用 GUID 或 COMB GUID 方法,这意味着可以在两侧添加项目并适当同步,但性能影响让我有些担忧。
一些要点是:
- 本地服务器是数据“大本营”,所有内容都需要(最终)存储在其中。
- 由于 Web 服务,只有本地桥接应用程序可以向 Web 服务器发出请求。
- 需要支持可能并不总是有互联网连接的情况,因此从 Web 服务器请求唯一 ID 并不理想。
有谁对处理这种“同步”的更好的编程方法有意见吗?
We have a local server with an access database which feeds data to clients in the same domain. Now we also have a website which is hosted externally, and working on a bridge system to provided upload/downloaded functionality of products, categories and orders etc.
Products, categories and customers etc. can only be added locally, however, orders can be added both locally and on the website. We are trying to have these synchronised by the bridge application which uses Web Services. We have had this working but have come across more issues. Our current approach is:
- Every individual record has a local id (luid) and a web server id (suid), one example of usage is when an item is added on the website, it is given a unique suid and the luid is -1, once the item is downloaded by the bridge application, an luid is applied and updated. This is the inverse for items added on the local server.
- Every indivdual record also has a flag field (highlighting insert, update, remove(from the website) and delete).
The above works well - apart from the luid and suid approach has made it impossible to easily track record relationships once an item is downloaded. This approach only seems to work well for one-way data - i.e. just uploading products to the website for viewing (and updating and removing them dynamically).
To solve this problem I have considered using GUIDs or perhaps COMBs GUID approach which means that items can be added on both sides and synced appropriately, thought the performance hit concerns me slightly.
Some important points are:
- The local server is the data "base camp" where everything needs to be (eventually) stored.
- Only the local bridge application can make requests to the web server due to web services.
- Needs to support the chance the there may not always be an internet connection, so requesting unique IDs from the web server is not ideal.
Does anyone have an opinion on a much better programming approach to handling this sort of 'synchronisation'?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
唯一的 ID 肯定会让事情变得简单。我不明白为什么你需要关心性能,GUID 可以从特定于机器的东西构建,或者 id 可以分批发布,这样 normalid 构建就纯粹是本地活动。
A unique id is surely going to simplify things. I don't see why you need to be concerned about performance, the GUID can be constructed from something machine-specific or ids can be issued in tranches so that normalid construction is a purely local activity.