POS应用的最佳解决方案是什么?
我目前正在进行 POS 项目。用户要求该应用程序可以在线和离线工作,这意味着他们需要本地数据库。我决定在每个商店和总部之间使用 SQL Server 复制。每个商店都需要安装SQL Server Express,总公司已经有SQL Server Enterprise Edition。复制将按计划每 30 分钟运行一次,我选择合并复制,因为数据在商店和总部都可能发生变化。
当我做 POC 时,我发现这个解决方案不能正常工作,有时作业出错,我需要重新初始化它。这种解决方案也需要很长的时间,这显然是用户无法接受的。
我想知道,有没有比我现在正在做的更好的解决方案?
更新1:
系统的约束是
- 几乎所有的交易都可以发生在 商店和总部。
- 话虽这么说,有些交易需要在实时模式下工作, 用户将数据保存到本地商店后,该数据也应该在总部进行更新。 (如果他们当前在线)
- 即使他们的商店与总部数据库断开连接,用户也可以工作。
- 我们估计每天最多 2,000 行数据。
- 总部服务器操作系统为Windows 2003,所有客户端操作系统为Windows XP。
更新 2:
- 目前他们大约有 15 个客户,但这个数字将以相当缓慢的速度增长。
- 每个复制的数据大小约为 100 到 200 行,我认为可能不会超过 5 MB。
- 客户端通过租用线路连接到服务器; 128 kbps。
我遇到的情况是,复制需要很长时间(大约 55 分钟,而我们只有 5 分钟左右),如果我不重新初始化,几乎很多时候我都需要重新初始化作业才能再次开始复制工作,它根本无法复制。在我的 POC 中,我发现重新初始化后总是需要很长时间进行复制,时间量并不取决于数据量。顺便说一句,重新初始化是我发现它适用于我的问题的唯一解决方案。
如上所述,我的结论是,复制可能不适合我的问题,我认为它可能有另一个更好的解决方案可以满足我在更新1:中的需求
I'm current on POS project. User require this application can work both online and offline which mean they need local database. I decide to use SQL Server replication between each shop and head office. Each shop need to install SQL Server Express and head office already has SQL Server Enterprise Edition. Replication will run every 30 minutes as schedule and I choose Merge Replication because data can change at both shop and head office.
When I'm doing POC, I found this solution not work properly, sometime job is error and I need to re-initialize its. This solution also take a very long time, which obviously unacceptable to user.
I want to know, are there any solutions better than one that I'm doing now?
Update 1:
Constraints of the system are
- Almost of transactions can occur at
both shop and head office. - Some transaction need to work in real-time mode, that being said,
after user save data to their local shop that data should go to update at head office too. (If they're currently online) - User can working even their shop has disconnected from head office database.
- Our estimation about amount of data is at-most 2,000 rows in each day.
- Windows 2003 is OS of Server at head office and Windows XP is OS of all clients.
Update 2:
- Currently they're about 15 clients, but this number will growing in fairly slow rate.
- Data's size is about 100 to 200 rows per replication, I think it may not more than 5 MB.
- Client connect to server by lease-line connection; 128 kbps.
I'm in situation that replication take a very long time (about 55 minutes while we've only 5 minutes or so) and almost of times I need to re-initialize job to start replicate again, if I don't re-initialize job, it can't replicate at all. In my POC, I find that it always take very long time to replicate after re-initialize, amount of time doesn't depend on amount of data. By the way, re-initialize is only solution I find it work for my problem.
As above, I conclude that, replication may not suitable for my problem and I think it may has another better solution that can serve what I need in Update 1:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您可能需要推出自己的双向复制引擎。
花费这么长时间的部分原因是,在如此狭窄的链接(128kbps)上,两个数据库必须保持一致(因此它们需要检查所有行)才能开始复制。正如您可以想象的那样,这可能(并且确实)需要很长时间。通过此链接传输即使 5Mb 也需要大约一分钟。
在编写自己的引擎时,确定需要复制的内容(使用项目更改时的时间戳),找出冲突解决方案(如果在复制周期之间同一记录在两个位置都发生更改,会发生什么情况)等等。这并不容易。
Sounds like you may need to roll your own bi-directional replication engine.
Part of the reason things take so long is that over such a narrow link (128kbps), the two databases have to be consistent (so they need to check all rows) before replication can start. As you can imagine, this can (and does) take a long time. Even 5Mb would take around a minute to transfer over this link.
When writing your own engine, decide what needs to be replicated (using timestamps for when items changed), figure out conflict resolution (what happens if the same record changed in both places between replication periods) and more. This is not easy.
我的建议是本地使用MS access,并在一定时间间隔后不断向服务器更新数据。向每个表添加更新的列。添加或更新记录时,设置更新的列。对于删除,您需要有一个单独的表,您可以在其中放置主键值和表名称。同步时获取所有未设置更新字段的本地记录并将其更新(修改或插入)到中央服务器。使用本地删除表删除所有记录,就完成了!
我假设您的中央服务器仅用于收集数据。
My suggestion is to use MS access locally and keep updating data to the server after a certain interval. Add a updated column to every table. When a record is added or updated, set the updated coloumn. For deletion you need to have a seprate table where you can put primary key value and table name. When synchronizing fetch all local records whose updated field not set and update (modify or insert) it to central server. Delete all records using local deleted table and you are done!
I assume that your central server is only for collecting data.
我目前使用为 Web 同步配置的 SQL Server 合并复制完全按照您所描述的操作。我让我的代理按照 1 分钟的时间表运行并取得了成功。
您看到什么样的错误消息?
I currently do exactly what you describe using SQL Server Merge Replication configured for Web Synchronization. I have my agents run on a 1-minute schedule and have had success.
What kind of error messages are you seeing?