在关键实时系统的设计中,日志子系统作为一个基础监控模块有着重要的作用。然而,当监控事件大规模突发时,日志数据的监控与记录反而会对系统性能造成显著影响,严重时甚至会阻塞主程序的逻辑。针对该问题,文章设计并实现了一种既可以保证应用系统的平稳运行,又可以有效地满足监控数据采集的日志系统,通过介绍异步机制和流量控制设计,阐明了解决上述问题的基本方案,并对该系统相关参数的选择进行了理论分析。实验结果证明了该日志系统在提供强大而灵活的日志功能情况下,可以有效地保证系统主程序的平稳运行。
As a fundamental monitoring module, logging subsystem plays an important role in the design of real-time critical systems. However, in cases when enormous monitoring events happen suddenly, the logging data monitoring and recording affects the performance of the whole system dramatically, and it may even block the logic running of the main process. To solve this problem, a logging system is designed and realized, which not only guarantees the steady running of the main process, but also effectively satisfies the requirements of events monitoring and logging. Firstly, the design of asynchronization mechanism and flow control is introduced, demonstrating the general solution of the problem above. Then a theoretical analysis of system parameters for optimization is conducted. The experimental results show that this design can provide powerful and flexible logging functionality without affecting the performance of the whole system.