How to Eliminate Mnesia Overload Events
来源:互联网 发布:有故事的淘宝店铺 编辑:程序博客网 时间:2024/06/05 07:33
If you're using mnesia disc_copies tables and doing a lot of writes all at once, you've probably run into the following message
=ERROR REPORT==== 10-Dec-2008::18:07:19 ===
Mnesia(node@host): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold}
This warning event can get really annoying, especially when they start happening every second. But you can eliminate them, or at least drastically reduce their occurance.
Synchronous Writes
The first thing to do is make sure to use sync_transaction or sync_dirty. Doing synchronous writes will slow down your writes in a good way, since the functions won't return until your record(s) have been written to the transaction log. The alternative, which is the default, is to do asynchronous writes, which can fill transaction log far faster than it gets dumped, causing the above error report.
Mnesia Application Configuration
If synchronous writes aren't enough, the next trick is to modify 2 obscure configuration parameters. The mnesia_overload event generally occurs when the transaction log needs to be dumped, but the previous transaction log dump hasn't finished yet. Tweaking these parameters will make the transaction log dump less often, and the disc_copies tables dump to disk more often. NOTE: these parameters must be set before mnesia is started; changing them at runtime has no effect. You can set them thru the command line or in a config file.
dc_dump_limit
This variable controls how often disc_copies tables are dumped from memory. The default value is 4, which means if the size of the log is greater than the size of table / 4, then a dump occurs. To make table dumps happen more often, increase the value. I've found setting this to 40 works well for my purposes.
dump_log_write_threshold
This variable defines the maximum number of writes to the transaction log before a new dump is performed. The default value is 100, so a new transaction log dump is performed after every 100 writes. If you're doing hundreds or thousands of writes in a short period of time, then there's no way mnesia can keep up. I set this value to 50000, which is a huge increase, but I have enough RAM to handle it. If you're worried that this high value means the transaction log will rarely get dumped when there's very few writes occuring, there's also a dump_log_time_threshold configuration variable, which by default dumps the log every 3 minutes.
How it Works
I might be wrong on the theory since I didn't actually write or design mnesia, but here's my understanding of what's happening. Each mnesia activity is recorded to a single transaction log. This transaction log then gets dumped to table logs, which in turn are dumped to the table file on disk. By increasing the dump_log_write_threshold, transaction log dumps happen much less often, giving each dump more time to complete before the next dump is triggered. And increasing dc_dump_limit helps ensure that the table log is also dumped to disk before the next transaction dump occurs.
ref:http://streamhacker.com/2008/12/10/how-to-eliminate-mnesia-overload-events/
- How to Eliminate Mnesia Overload Events
- How to Eliminate Mnesia Overload Events
- How to: Implement Interface Events
- How to overload a controller
- How to add a node to an mnesia cluster?
- how to enable kvm trace events
- How to overload controller in Magento?
- How to eliminate the compile error "conversion from 'double ' to 'float ', possible loss of data"
- How to sink HTML document events for WebBrowser host -- quoted
- How to use Events in the Context of C#
- How To Use the ADO FetchProgress and FetchComplete Events
- How to monitor the full range of CPU performance events
- How to Hook the Mouse to Catch Events Outside of your application
- How to handle form events after adding a master page to an existing page
- mnesia
- Oracle9i新特点:SPFILE的使用--How to set events with spfile and etc
- How to place all WPF commands and related events centrally in a static class
- How To List All The Named Events Set For A Database
- 30个漂亮网站
- [USACO] OPEN11 Bronze Division
- C#中打开新窗体关闭旧窗体
- LINUX进程控制 笔记
- 原来如此
- How to Eliminate Mnesia Overload Events
- [Three20] Three20系列之Three20概述
- 关于编程
- 动网风格界面模板总管理各部位设置分析
- Opencore之文件解析
- 内联函数
- java程序..
- AS3继续学习之PhotosPlayer使用GIFPlayer包
- Linq查询