网络服务数据存储

发布于 2024-10-09 13:41:21 字数 341 浏览 0 评论 0原文

我有一个网络服务,可以在连接的客户端之间共享数据。连接的客户端能够修改此数据。该数据最初从 XML 文件加载,并在服务关闭时保存回来。

我想定期(或在每次修改时)保存这些数据,因为服务应 24/24 7/7 执行,实际上我需要找到一种方便的方法来存储服务中的数据。 在每次修改时保存数据是不可行的,因为用户请求可能很频繁(每秒 10/50 个请求),并且某些数据一旦序列化可能会占用多达 4/8 MB。

现在我定期保存数据,在一段时间后没有修改数据,但我不喜欢这种方法。有其他方法可以保存数据吗?

可以有每个客户端操作描述,说明哪个类的哪个字段/属性已被修改;使用此信息可以在以后修改数据结构,就像“宏”系统所做的那样。

I have a network service which shared data among connected clients. Connected clients are able to modify this data. This data is initially loaded from XML files, and saved back when the service shutdown.

I'd like to save this data periodically (or at each modification) because the service shall be in execution 24/24 7/7, indeed I need to find a convenient way to store the data from service.
Saving data at each modification could not be feasible, since user requests could be frequent (10/50 requests per second), and some data could occupy up to 4/8 MB once serialized.

Now I'm saving the data periodically, after it is not modified after some time, but I don't like this approach. Is there some alternative to save data?

There is the possibility to have each client operation description, which say which field/property of which class has been modified; using this information it is possible to modify the data structure at later time, like a "macro" system does.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

诗化ㄋ丶相逢 2024-10-16 13:41:21

也许你可以尝试缩放差异?

您可以每秒测试您的数据,如果现在与前一秒之间的差异大于 1 MB,则可以保存它。如果没有,请跳过这一秒。

周期和差异大小可以根据您的要求进行更改。

Maybe you can try scaling the diff?

You can test your data every second, and if difference between now and previous second is greater then 1 MB, you can save it. If not, you skip for this second.

Period and diff size can be changed due to your requirements.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文