`
mryufeng
  • 浏览: 982404 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Can one mnesia table fragment be further fragmente

阅读更多
Login : Register
Can one mnesia table fragment be further fragmented?
View: New views
5 Messages — Rating Filter:   Alert me 


Can one mnesia table fragment be further fragmented?
Click to flag this post

by devdoer bird Jun 18, 2008; 12:33am :: Rate this Message: - Use ratings to moderate (?)

Reply | Reply to Author | Print | View Threaded | Show Only this Message
Hi:
I spilit one mnesia table into 3 fragments which distributed on 3 machines  named A,B and C,but now the the machine "A" is very busy,
so I decide split the fragment on the machine "A" into small fragments.Does mnesia support this?
Thanks.

_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions


Re: Can one mnesia table fragment be further fragmented?
Click to flag this post

by Scott Lystig Fritchie Jun 19, 2008; 08:21am :: Rate this Message: - Use ratings to moderate (?)

Reply | Reply to Author | Print | View Threaded | Show Only this Message
devdoer bird <devdoer2@...> wrote:

dd> I spilit one mnesia table into 3 fragments which distributed on 3
dd> machines named A,B and C,but now the the machine "A" is very busy,

dd> so I decide split the fragment on the machine "A" into small
dd> fragments.Does mnesia support this?

No, that isn't possible with Mnesia, not as you wish/state above.

If you have a table 'tab' split into fragments 'tab', 'tab_frag2', and
'tab_frag3', you can add more fragments: 'tab_frag4', 'tab_frag5', etc.
You can choose to put only 1 fragment on node A, 4 fragments on node B,
and 4 fragments on node C.  Assuming that access to the table is evenly
distributed over all fragments, then node A should be getting only 1/9
of the load, and B & C will get 4/9 of the load.

-Scott
_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions


Re: Can one mnesia table fragment be further fragmented?
Click to flag this post

by devdoer bird Jun 19, 2008; 10:03am :: Rate this Message: - Use ratings to moderate (?)

Reply | Reply to Author | Print | View Threaded | Show Only this Message
Thanks.

Thant means ,I need fragment table many times not for load balance but for decreasing one specific node's (the node is not as powerful as others ) load.

Eg. Node A has 2 fragments,Node B has 2 fragments. Each fragment has equal records(say 100 records each fragment).

Now the Node B is heavily loaded.If I adding one or two   fragments in Node A , the load of Node B won't be

decreased ,for the records from Node A will be splited and moved to the new fragments,the records on Node A is 50+50+50+50=200 ,the total number of  Node B's record  is still 200.

In order to decreas the load on Node B,I have to calcaulate carefully how many new fragments should be added.

If there's a way for mnesia to specify which node's fragment should be splited when addin a new fragment,the problems above will be solved.Take the example above ,when  adding a new fragment,I can tell mnesia to split Node B's fragment.

2008/6/19, Scott Lystig Fritchie <fritchie@...>:

    devdoer bird <devdoer2@...> wrote:

    dd> I spilit one mnesia table into 3 fragments which distributed on 3
    dd> machines named A,B and C,but now the the machine "A" is very busy,

    dd> so I decide split the fragment on the machine "A" into small
    dd> fragments.Does mnesia support this?

    No, that isn't possible with Mnesia, not as you wish/state above.

    If you have a table 'tab' split into fragments 'tab', 'tab_frag2', and
    'tab_frag3', you can add more fragments: 'tab_frag4', 'tab_frag5', etc.
    You can choose to put only 1 fragment on node A, 4 fragments on node B,
    and 4 fragments on node C.  Assuming that access to the table is evenly
    distributed over all fragments, then node A should be getting only 1/9
    of the load, and B & C will get 4/9 of the load.

    -Scott



_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions


Re: Can one mnesia table fragment be further fragmented?
Click to flag this post

by Paul Mineiro Jun 19, 2008; 03:14pm :: Rate this Message: - Use ratings to moderate (?)

Reply | Reply to Author | Print | View Threaded | Show Only this Message
Re: picking what gets split, not with the default frag_hash.  You can see
what it's doing in mnesia_frag_hash.erl ... it basically splits the
fragments in order.  This means that unless there is a power-of-two number
of fragments they will be of different magnitudes.  You could leverage
that for your load balancing by placing bigger fragments on less noded
nodes, etc.  In fact, maybe this is why you are seeing
an uneven distribution to begin with?

-- p

p.z. If you are feeling your wheaties, you can make your own frag hash,
and specify the module in the frag_properties when you create the table.

http://www.erlang.org/doc/apps/mnesia/Mnesia_chap5.html#5.3

Don't be tempted to just use phash2 or something like that; in order to go
from N fragments to M fragments you have to pass through all the
intermediate stages N + 1, ..., M - 1, M ; you do not want to rehash all
the data in all the buckets at each step.

On Thu, 19 Jun 2008, devdoer bird wrote:

> Thanks.
>
> Thant means ,I need fragment table many times not for load balance but for
> decreasing one specific node's (the node is not as powerful as others )
> load.
>
> Eg. Node A has 2 fragments,Node B has 2 fragments. Each fragment has equal
> records(say 100 records each fragment).
>
> Now the Node B is heavily loaded.If I adding one or two   fragments in Node
> A , the load of Node B won't be
>
> decreased ,for the records from Node A will be splited and moved to the new
> fragments,the records on Node A is 50+50+50+50=200 ,the total number of
> Node B's record  is still 200.
>
> In order to decreas the load on Node B,I have to calcaulate carefully how
> many new fragments should be added.
>
> If there's a way for mnesia to specify which node's fragment should be
> splited when addin a new fragment,the problems above will be solved.Take the
> example above ,when  adding a new fragment,I can tell mnesia to split Node
> B's fragment.
>
> 2008/6/19, Scott Lystig Fritchie <fritchie@...>:
> >
> > devdoer bird <devdoer2@...> wrote:
> >
> > dd> I spilit one mnesia table into 3 fragments which distributed on 3
> > dd> machines named A,B and C,but now the the machine "A" is very busy,
> >
> > dd> so I decide split the fragment on the machine "A" into small
> > dd> fragments.Does mnesia support this?
> >
> > No, that isn't possible with Mnesia, not as you wish/state above.
> >
> > If you have a table 'tab' split into fragments 'tab', 'tab_frag2', and
> > 'tab_frag3', you can add more fragments: 'tab_frag4', 'tab_frag5', etc.
> > You can choose to put only 1 fragment on node A, 4 fragments on node B,
> > and 4 fragments on node C.  Assuming that access to the table is evenly
> > distributed over all fragments, then node A should be getting only 1/9
> > of the load, and B & C will get 4/9 of the load.
> >
> > -Scott
> >
>
... [show rest of quote]

In an artificial world, only extremists live naturally.

        -- Paul Graham
_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions


Re: Can one mnesia table fragment be further fragmented?
Click to flag this post

by devdoer bird Jun 20, 2008; 01:23pm :: Rate this Message: - Use ratings to moderate (?)

Reply | Reply to Author | Print | View Threaded | Show Only this Message
Thanks ,Paul. I decide to replace the mnesia_frag_hash with  my own hash module   .With this customized hash module,I hope I can explicitly pass a fragment number to make the fragment splited.
I decide to use a mnesia table or other persitent-able  data structure in erlang which can globally seen  by all nodes to store the mapping relations between key value range  and fragment(Eg. [1..999]-> frag 1,[1000-1999]->frag2), so when I need to split a specifed fragment ,I can rejust the mapping relation table.

Here's my plan,any suggestions are welcome.


2008/6/19, Paul Mineiro <paul-trapexit@...>:

    Re: picking what gets split, not with the default frag_hash.  You can see
    what it's doing in mnesia_frag_hash.erl ... it basically splits the
    fragments in order.  This means that unless there is a power-of-two number
    of fragments they will be of different magnitudes.  You could leverage
    that for your load balancing by placing bigger fragments on less noded
    nodes, etc.  In fact, maybe this is why you are seeing
    an uneven distribution to begin with?

    -- p

    p.z. If you are feeling your wheaties, you can make your own frag hash,
    and specify the module in the frag_properties when you create the table.

    http://www.erlang.org/doc/apps/mnesia/Mnesia_chap5.html#5.3

    Don't be tempted to just use phash2 or something like that; in order to go
    from N fragments to M fragments you have to pass through all the
    intermediate stages N + 1, ..., M - 1, M ; you do not want to rehash all
    the data in all the buckets at each step.

    On Thu, 19 Jun 2008, devdoer bird wrote:

    > Thanks.
    >
    > Thant means ,I need fragment table many times not for load balance but for
    > decreasing one specific node's (the node is not as powerful as others )
    > load.
    >
    > Eg. Node A has 2 fragments,Node B has 2 fragments. Each fragment has equal
    > records(say 100 records each fragment).
    >
    > Now the Node B is heavily loaded.If I adding one or two   fragments in Node
    > A , the load of Node B won't be
    >
    > decreased ,for the records from Node A will be splited and moved to the new
    > fragments,the records on Node A is 50+50+50+50=200 ,the total number of
    > Node B's record  is still 200.
    >
    > In order to decreas the load on Node B,I have to calcaulate carefully how
    > many new fragments should be added.
    >
    > If there's a way for mnesia to specify which node's fragment should be
    > splited when addin a new fragment,the problems above will be solved.Take the
    > example above ,when  adding a new fragment,I can tell mnesia to split Node
    > B's fragment.
    >
    > 2008/6/19, Scott Lystig Fritchie <fritchie@...>:
    > >
    > > devdoer bird <devdoer2@...> wrote:
    > >
    > > dd> I spilit one mnesia table into 3 fragments which distributed on 3
    > > dd> machines named A,B and C,but now the the machine "A" is very busy,
    > >
    > > dd> so I decide split the fragment on the machine "A" into small
    > > dd> fragments.Does mnesia support this?
    > >
    > > No, that isn't possible with Mnesia, not as you wish/state above.
    > >
    > > If you have a table 'tab' split into fragments 'tab', 'tab_frag2', and
    > > 'tab_frag3', you can add more fragments: 'tab_frag4', 'tab_frag5', etc.
    > > You can choose to put only 1 fragment on node A, 4 fragments on node B,
    > > and 4 fragments on node C.  Assuming that access to the table is evenly
    > > distributed over all fragments, then node A should be getting only 1/9
    > > of the load, and B & C will get 4/9 of the load.
    > >
    > > -Scott
    > >
    >

    In an artificial world, only extremists live naturally.

           -- Paul Graham
    _______________________________________________
    erlang-questions mailing list
    erlang-questions@...
    http://www.erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions
分享到:
评论

相关推荐

    Mnesia table fragmentation 过程及算法分析

    为了解决这个问题,Mnesia 提供了表分片(table fragmentation)的功能。通过使用 Linear Hashing 算法,Mnesia 可以将大表分散存储在多个节点上,从而提高表的可扩展性和性能。 在分析 Mnesia 表分片的过程和算法...

    Mnesia User's Guide

    • Mnesia provides an introduction to Mnesia. • Getting Started introduces Mnesia with an example database. Examples are included how to start an Erlang session, specify a Mnesia database directory, ...

    Mnesia用户手册.zip

    《Mnesia用户手册》是专为理解和操作Erlang编程语言中的Mnesia数据库管理系统而编写的详尽指南。Mnesia是Erlang OTP (Open Telephony Platform) 库中的一个核心组件,它是一个强大的分布式数据库系统,特别适用于...

    Mnesia用户手册(docx版)

    - **数据模型**:Mnesia 支持两种主要的数据模型:*正交表(Table)* 和 *活动数据表(Active Data Table, ADT)*。正交表用于存储静态数据,而ADT则用于动态数据,支持实时更新和查询。 - **启动 Mnesia**:启动...

    erlang——Mnesia用户手册.pdf

    1.2.Mnesia.数据库管理系统(DBMS 2、开始.Mnesia 2.1.首次启动.Mnesia 2.2.一个示例 3、构建.Mnesia.数据库 3.1.定义模式 3.2.数据模型 3.3.启动.Mnesia 3.4.创建新表 4、事务和其他上下文存取 ...

    mnesia数据库文档

    ### Mnesia数据库:Erlang中的分布式数据库管理系统 #### 引言 Mnesia,作为Erlang编程语言的一部分,是一款由爱立信公司开发的分布式数据库管理系统(DBMS)。自1997年以来,Mnesia一直是Open Telecom Platform...

    Mnesia用户手册 4.4.10版.rar

    Mnesia是一个分布式数据库管理系统(DBMS),适合于电信和其它需要持续运行和具备软实时特性的Erlang应用。 目 录 1 、介绍 . . .. . .. . . .. . 4 1.1 关于 Mnesia . . .. . .. . . .. . 4 1.2 Mnesia ...

    Mnesia 用户手册中文版 pdf

    Mnesia是一个分布式数据库管理系统,特别适用于需要持续运行和具备软实时特性的Erlang应用,如电信系统。它作为开放式电信平台(OTP)的一部分,是用Erlang编程语言实现的。Mnesia的设计初衷是为了解决电信应用中的...

    mnesia_pg:Postgres后端通过mnesia_ext到Mnesia

    “mnesia_pg:Postgres后端通过mnesia_ext到Mnesia” 这个标题揭示了一个项目,它的目标是将PostgreSQL数据库作为Erlang的Mnesia分布式数据库系统的一个后端。Mnesia_ext是Mnesia的一个扩展,它允许添加自定义的数据...

    Mnesia Overview

    ### Mnesia概述与关键知识点 #### 一、Mnesia数据库管理系统简介 Mnesia是一个专为电信应用设计的分布式、容错数据库管理系统(DBMS)。它由爱立信公司的计算机科学实验室开发,旨在解决传统商用数据库管理系统...

    erlang mnesia 数据库基本查询

    Mnesia是一个分布式数据库管理系统,适合于电信和其它需要持续运行和具备软实时特性的Erlang应用,越来越受关注和使用,但是目前Mnesia资料却不多,很多都只有官方的用户指南。下面的内容将着重说明 如何做 Mnesia ...

    备忘录:Mnesia分布式数据库的简单+强大接口

    **Mnesia:分布式数据库的简单而强大的接口** Mnesia是一个高度可扩展的分布式数据库管理系统,主要为实时系统设计,尤其适用于Erlang和Elixir编程语言。它作为OTP(Open Telephony Platform)的一部分,提供了对高...

    cachet:Mnesia的内存光盘分派器

    Mnesia数据库对于您的可用内存而言开始变得太大了? 对于ram_copies和disc_copies ,整个表都保留在内存中,因此数据大小受可用RAM的限制。 对于disc_only_copies ,由于后端dets缘故,每个表限制为2 GB。 cachet...

    mnesiam:Mnesiam使Mnesia数据库的群集变得容易

    Mnesiam使Mnesia数据库的群集变得容易。 可以在上找到模块文档。 安装 该软件包可以通过添加安装mnesiam你在依赖列表mix.exs : def deps do [{ :mnesiam , " ~&gt; 0.1.1 " }] end 在您的应用程序之前,请确保已...

Global site tag (gtag.js) - Google Analytics