问题描述
我有一个服务应用程序,通过TCP处理客户端请求并将任何事件写入Windows EventLog。由于这个应用程序预计将在短时间内为每个客户端提供许多客户端和大量请求(比如每秒1到50个请求之间),我很好奇地知道如何密集(CPU智能和时间智能)和写入Windows EventLog的速度有多快?更具体来说,连接,阅读和写入EventLog的操作有多密集?
我使用我的2个事件日志类进行了测试,一次写入文件(每个 log_event()
写入并刷新已打开的文件),另一个基于已经注册的EventSource上的EventLog( ReportEvent()
调用)。在我的情况下,文件日志比EventLog快10倍。在多线程环境中,我将添加关键部分来保护文件的写入。
在我看来,文件更好:它们在grep等工具中很容易解析。速度对我来说不太重要。
I have a service application that is processing client requests over TCP and writing any events into Windows EventLog. Since this application is expected to service many clients and lots of requests from each client in a short amount of time (let's say between 1 and 50 requests per second), I'm curious to know how intensive (CPU wise and time wise) and how fast can writing into Windows EventLog be?
More specifically, how intensive are the operations of connecting to, reading from and writing to EventLog?
I made a test with my 2 event log classes, one writing to file (each log_event()
writes to and flushes already opened file) and one based on EventLog (ReportEvent()
call on already registered EventSource). In my case file log was about 10 times faster than EventLog. In multithread envirnonment I would add critical section to protect writing to file.
In my opinion files are better: they are easily parsed in tools such as grep. Speed is less important for me.
这篇关于Windows EventLog:操作速度有多快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!