Erlang ETS Study Notes

Source: Internet
Author: User

ETS stands for "Erlang Term Storage" Erlang term storage.

ETS breaks the "unchanged data" principle of Erlang so that data can be shared between processes. The first reason is why ETs appears? The following is a collection and analysis of network data:

<Why: Why is ETS introduced?>

<Strong 2002>

ErlangList can be used to express the set data, but if the data size is very large, the access to elements in the list will be slow; this is mainly because most of the List operations are completed based on traversal.

ErlangThe design goal is soft real-time (reference: http://en.wikipedia.org/wiki/Real-time_computing), in a large amount of data retrieval time is not only fast but also requires constant.

Questions,ErlangThe provided mechanism isETS(ErlangTerm Storage) and dets (DiskErlangTerm Storage). This article only focuses onETS.

</Strong 2002>

<Gao Peng's blog>

ETS and dets are the basis of mnesia

The list of Erlang can be used to process a small amount of data. However, when there is more data, the performance will decrease. Its time complexity is O (n). As the data volume performance declines linearly, therefore, ETS (Erlang Term Storage) is introduced. In addition, Erlang is immutable variables, and sometimes mutable variable is required. In this case, ETS can be used for implementation, however, it introduces side effects ETS, which will not be garbage collected. You can use ETS: delete/1 to manually delete it. In addition, ETS is bound to the process that created it, when the process that creates the program exits, the corresponding ETS will automatically delete the program with limited support for concurrent writes. If the lock is not used to ensure conflict processing, the system will throw an exception, only applications can handle conflicts: ETS: safe_fixtable/2 </Gao Peng's blog> <Yu Feng> ETSYes ErlangFor more information about the meaning of term strorage, see erl5.5.5/lib/stdlib-1.14.5/doc/html/index.html. This is a core function in beam. ETS, Dets, and mnesia constitute ErlangNote that mnesia itself does not have a storage mechanism. Its storage is ETSAnd dets. ErlangThe implementation of the kernel and stdlib libraries of is dependent on this ETS </Yu Feng >

</Why: ETS stores global data in the project, as far as I know, the solution is that each process writes its own data items. If multiple processes share data items, write operations to one process>

<Character>

User Manual ETS module translation http://blog.csdn.net/johnson_erlang/article/details/7829231

</Character>

  

Erlang ETS Study Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.