使用事件日志作为临时日志存储

发布于 2024-11-17 19:02:23 字数 256 浏览 2 评论 0原文

我们目前正在设计一个组织范围的日志记录机制(基于 C#)。要求之一是将日志记录写入临时存储,然后将它们移动到中央数据库,以节省性能。

我们目前正在评估两种临时存储选项 - 一种是内存数据库,例如 SQL CE,另一种是 Windows 的事件日志。 我们不确定事件日志是否适合此任务。我们需要能够承受重负载(每秒约 50 次调用)、易于读取且可靠的东西。

你对此有何看法?事件日志是否适合满足这些要求?其表现如何? 任何见解都将受到高度赞赏。

谢谢!

We're currently designing an organization-wide logging mechanism (based on C#). One of the requirements is to write the log records to a temporary storage, and later move them to a central database, to save performance.

We're currently evaluating two options for the temporary storage - one is an in-memory db, such as SQL CE, and the other is windows's Event Log.
We're not sure if the event log is suitable for this task. We need something that can stand heavy loads (~50 calls a second), easy to read from, and reliable.

What do you think about it? Is the event log a good candidate for these requirements? How does is perform?
Any insight will be highly appreciated.

Thanks!

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

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

发布评论

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

评论(3

白鸥掠海 2024-11-24 19:02:23

首先,这是一个解决方案,但不一定是最佳解决方案,因为它实际上取决于您的需求。我们有一个固定大小的文件文本文件,用作循环日志。我们有固定长度日志消息的好处,所以这对我们有用。每天一次,在比较安静的时间,服务器提取它尚未读取的日志条目。它每秒可以毫不费力地处理几百个条目。如果服务器没有及时提取,则存在旧条目被新条目覆盖的风险,但文件的大小使得这种情况不太可能发生,因为我们还可以提前了解大致的内容。每天的最大条目数为。

但正如我所说,哪种解决方案最好在很大程度上取决于您的需求。我没有使用过 C# 事件日志,但如果它们与旧的 Windows NT 事件记录器类似,那么它的优点是无需客户端程序执行任何操作即可从外部读取。

Firstly, this is a solution but not necessarily the best solution, since it really depends on your needs. We have a fixed size file text file that is used as a circular log. We have the benefit of fixed-length log messages so this works for us. Once a day, at a quieter time, a server extracts the log entries it has yet to read. It can handle a couple of hundred entries per second without breaking a sweat. There is a risk that older entries will get overwritten by newer if the server hasn't extracted enough in time, but the size of the file is such that this is unlikely to happen since we also have the benefit of knowing in advance roughly what the maximum number of entries per day will be.

But as I say, it depends on your needs to a large degree as to which solution is best. I haven't used C# event logs but if they're anything like the old Windows NT event loggers, it has the benefit of being able to be read externally without the client program doing anything.

何以心动 2024-11-24 19:02:23

我建议您使用 MongoDB。因此,也许您也可以使用相同的中央存储,为本地和中央获得相同的基础设施。

I will suggest you to use MongoDB. So maybe you can use the same as a central storage too, gaining the same infrastructure for both local and central.

望笑 2024-11-24 19:02:23

将本地日志条目传输到中央数据库可能是一项艰巨的任务。您必须处理所有可能的异常、中断等。因此,我建议考虑使用 SQL Server Compact 4.0 和 Microsoft Sync Framework 的解决方案。

我认为可以实现一种单向的面向服务的同步解决方案。

此外,SQL Server Compact 4.0 的数据库大小限制为 4GB,可处理超过 250 个并发连接。您还可以选择将 x86 和 x64 引导程序包包含在您的单击一次应用程序中。

Transferring local log entries to a central database can be a hard job to do. You have to handle all possible exceptions, interruptions etc. For that reason i would suggest considering a solution using SQL Server Compact 4.0 with Microsoft Sync Framework.

I think it is possible to implement a one-way service oriented synchronization solution.

In addition SQL Server Compact 4.0, has a DB size limit of 4GB and handle >250 concurrent connections. Also you have the option to include x86 and x64 bootstrapper packages with your click-once applications.

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