There are some reoccuring themes when it comes to mnesia:
1 Mnesia handles partitioned networks poorly
2 Mnesia doesn't scale
3 Stay away from transactions
I've argued that Mnesia provides the tools to handle [1],
and that most DBMSs that guarantee transaction-level
consistency are hard-pressed to do better. A few offer
functionality (e.g. MySQL Cluster's Arbitrator) that could
be added on top of the basic functionality provided by
Mnesia. DBMSs that offer 'Eventual consistency' may fare
better. OTOH, one should really think about what the
consistency requirements of the application are, and pick
a DBMS that aims for that level.
Regarding [2], there are examples of Mnesia databases that
have achieved very good scalability. It is not the best
regarding writes/second to persistent storage, but as with
[1], think about what your requirements are. Tcerl, just
to name an example, gives much better write throughput, but
requires you to explicitly flush to disk. Chances are that
your data loss will be much greater if you suffer e.g.
a power failure. Don't take this as criticism of tcerl, but
think about what your recovery requirements are.
I am very wary about [3], mainly because I've seen many
abuses of dirty operations, and observed that many who use
dirty updates do it just because "it has to be fast",
without having measured performance using transactions, or
thought about what they give up when using dirty updates.
In some cases, transactions can even be faster than dirty.
This is mainly true if you are doing batch updates on a
table with many replicas. With dirty, you will replicate
once for each write, whereas a transaction will replicate
all changes in the commit message. Taking a table lock will
more or less eliminate the locking overhead in this case,
and sticky locks can make it even cheaper.
Apart from the obvious problems with dirty writes (no
concurrency protection above object-level atomicity,
no guarantee that the replicas will stay consistent),
there is also a bigger problem of overload.
If you have a write-intensive system, and most writes
take place from one node, and are replicated to one or
more others, consider that the replication requests all
go through the mnesia_tm process on the remote node,
while the writers perform the 'rpc' from within their
own process. Thus, if you have thousands of processes
writing dirty to a table, the remote mnesia_tm process(es)
may well become swamped.
This doesn't happen as easily with transactions, since all
processes using transactions also have to go through their
local mnesia_tm.
One thing that can be done to mitigate this is to use
sync_dirty. This will cause the writer to wait for the
remote mnesia_tm process(es) to reply. If you have some
way of limiting the number of writers, you ought to be able
to protect against this kind of overload.
My personal preference is to always start with transactions,
until they have proven inadequate. Most of the time, I find
that they are just fine, but YMMV.
BR,
Ulf W
--
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com
目前确实存在这个问题
分享到:
相关推荐
C++ Gotchas Avoiding Common Problems in Coding and Design 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
【避免垃圾邮件】 在互联网发展的历程中,从最初的物理学数据分享平台,到如今成为文化、教育,特别是商业生活的核心部分,网络已经变得无处不在。数以百万计的用户现在通过网页进行各种金融交易,包括购物、预订...
气候变化研究中关于温度极端指数的处理方法Using a Monte Carlo simulation, it is demonstrated that percentile-based temperature indices computed for climate change detection and monitoring may contain ...
Avoiding Read While Write Errors When In-Software Flash
在IT领域,尤其是在数据存储与保护的技术探讨中,《Avoiding the Disk Bottleneck in the Data Domain Deduplication File System》一文提供了深入的见解和技术解决方案,旨在优化基于磁盘的重复数据删除...
ARDUINO_OBSTACLE_AVOIDING_CAR 避开基于arduino的车辆的障碍在此存储库中,我仅给出了避开arduino基础车辆的障碍物的源代码。 您可以单击链接以获取源代码。 链接:
A note on cover-avoiding properties of finite groups,刘建军,郭秀云,A subgroup H of a group G is said to be a CAP*-subgroup of a group G if, for any non-Frattini chief factor K/L of G, we have HK=HL...
自回避行走(Self-Avoiding Walk,简称SAW)是一种在数学、物理和化学领域广泛研究的统计力学模型。在该模型中,一个行走者在二维或三维空间中移动,但不能与其之前走过的路径重叠,即行走的每一步都不能与之前的...
1Avoiding AVX-SSE Transition PenaltiesTransitioning between 256-bit Intel:registered: AVX instructions and legacy Intel:registered: SSE instructions within a program may cause performance penalties ...
An-OARSMan: An Obstacle-Avoiding Rectilinear Steiner Tree Algorithm with Good Length Performance,胡昱,经彤,Routing is one of the important steps in VLSI/ULSI physical design. The rectilinear ...
当构建使用动态VI的可执行文件时,必须确保在LabVIEW Application Builder规范的'always include'部分指定动态VI的名称。不这样做会导致问题,表现为LabVIEW应用程序将无法加载您的动态Vl,并将引发各种错误或导致...
是讲述安全编程的好书!!!
【Server Virtualization: 避免I/O陷阱】 在服务器虚拟化的过程中,企业通常能体验到应用程序部署的简化和整体服务器利用率的提升。然而,如果不考虑相应的存储I/O性能调整,这种快速整合可能会导致性能影响的隐患...
根据提供的文件信息,本书《C++ Gotchas: Avoiding Common Problems in Coding and Design》由Stephen C. Dewhurst撰写,出版商为Addison Wesley,出版日期为2002年11月29日,ISBN号为0-321-12518-5,全书共有352页...
Although I wrote the first edition of this book more than 25 years ago, my goals for it remain the same. I want students to receive a solid intro- duction to the traditional topics....
### 如何避免在量化政治学中使用统计数据时犯错 #### 概述 本文由纽约大学的Gary King撰写,旨在揭示量化政治科学文献中频繁出现的一系列严重理论错误。这些错误通常基于错误的统计理论或不当的统计分析方法。...
介绍了一个结合模型预测控制(Model Predictive Control, MPC)技术的自动避障和汽车跟踪项目。通过建立精确的车辆动力学模型和环境感知模型,实现了对车辆行为的实时预测和控制,有效避免了障碍物并实现了稳定的汽车...