FAQ
Hi There! First of all, thanks a ton for CouchDB )

I've couple of strange memory issues with R15B03 and couch db internals.
It'd be great to have a clearance for questions.

Let's consider short code snippet:

db_and_doc() ->
{<<"seed_labeled_prod">>, <<"medianet:album:10000053">>}.

write(Body) ->
{DbName, DocId} = db_and_doc(),
{ok, Db} = couch_db:open_int(DbName, []),
couch_db:update_doc(Db, Body, []),
couch_db:close(Db).

read() ->
{DbName, DocId} = db_and_doc(),
{ok, Db} = couch_db:open_int(DbName, []),
{ok, Doc} = couch_db:open_doc(Db, DocId),
{Body} = couch_doc:to_json_obj(Doc, []),
couch_db:close(Db),
Body.


And few cases:


run(Scenario) ->
spawn(fun() -> in_case(Scenario) end).

in_case(single_process) ->
Seq = lists:seq(1, 30000),
Try = fun(_) -> write(read()) end,
lists:foreach(Try, Seq);

in_case(spawned_processes) ->
Seq = lists:seq(1, 5000),
Try = fun(_) ->
spawn(fun() -> write(read()) end)
end,
lists:foreach(Try, Seq);

in_case(spawned_update_processes) ->
Seq = lists:seq(1, 30000),
Try = fun(_) ->
Doc = read(),
spawn(fun() -> write(Doc) end)
end,
lists:foreach(Try, Seq).


My questions are:

1] Why `in_case(single_process)` produces so many `inactive` memory on Mac
OS X in case when `<<"medianet:album:10000053">>` document size is 67.19Kb?;
-- besides, `in_case(spawned_processes)` doesn't;

2] moreover, `in_case(spawned_update_processes)` still continue produce an
`inactive` memory;

I think that Linux env has same behavior.

Thanks for help!)

Search Discussions

  • Paul Davis at Feb 7, 2013 at 4:43 pm
    I'm confused by what's generating the inactive memory messages. Some
    sort of Erlang tracing?

    On Thu, Feb 7, 2013 at 10:36 AM, Алекс Zatvornitskiy
    wrote:
    Hi There! First of all, thanks a ton for CouchDB )

    I've couple of strange memory issues with R15B03 and couch db internals.
    It'd be great to have a clearance for questions.

    Let's consider short code snippet:

    db_and_doc() ->
    {<<"seed_labeled_prod">>, <<"medianet:album:10000053">>}.

    write(Body) ->
    {DbName, DocId} = db_and_doc(),
    {ok, Db} = couch_db:open_int(DbName, []),
    couch_db:update_doc(Db, Body, []),
    couch_db:close(Db).

    read() ->
    {DbName, DocId} = db_and_doc(),
    {ok, Db} = couch_db:open_int(DbName, []),
    {ok, Doc} = couch_db:open_doc(Db, DocId),
    {Body} = couch_doc:to_json_obj(Doc, []),
    couch_db:close(Db),
    Body.


    And few cases:


    run(Scenario) ->
    spawn(fun() -> in_case(Scenario) end).

    in_case(single_process) ->
    Seq = lists:seq(1, 30000),
    Try = fun(_) -> write(read()) end,
    lists:foreach(Try, Seq);

    in_case(spawned_processes) ->
    Seq = lists:seq(1, 5000),
    Try = fun(_) ->
    spawn(fun() -> write(read()) end)
    end,
    lists:foreach(Try, Seq);

    in_case(spawned_update_processes) ->
    Seq = lists:seq(1, 30000),
    Try = fun(_) ->
    Doc = read(),
    spawn(fun() -> write(Doc) end)
    end,
    lists:foreach(Try, Seq).


    My questions are:

    1] Why `in_case(single_process)` produces so many `inactive` memory on Mac
    OS X in case when `<<"medianet:album:10000053">>` document size is 67.19Kb?;
    -- besides, `in_case(spawned_processes)` doesn't;

    2] moreover, `in_case(spawned_update_processes)` still continue produce an
    `inactive` memory;

    I think that Linux env has same behavior.

    Thanks for help!)
  • Алекс Zatvornitskiy at Feb 7, 2013 at 4:59 pm
    +1 ) I don't think that `gdb` will give me answers. I've not had enough
    knowledge about `couch_db`, `couch_doc` modules.

    On Thu, Feb 7, 2013 at 6:42 PM, Paul Davis wrote:

    I'm confused by what's generating the inactive memory messages. Some
    sort of Erlang tracing?

    On Thu, Feb 7, 2013 at 10:36 AM, Алекс Zatvornitskiy
    wrote:
    Hi There! First of all, thanks a ton for CouchDB )

    I've couple of strange memory issues with R15B03 and couch db internals.
    It'd be great to have a clearance for questions.

    Let's consider short code snippet:

    db_and_doc() ->
    {<<"seed_labeled_prod">>, <<"medianet:album:10000053">>}.

    write(Body) ->
    {DbName, DocId} = db_and_doc(),
    {ok, Db} = couch_db:open_int(DbName, []),
    couch_db:update_doc(Db, Body, []),
    couch_db:close(Db).

    read() ->
    {DbName, DocId} = db_and_doc(),
    {ok, Db} = couch_db:open_int(DbName, []),
    {ok, Doc} = couch_db:open_doc(Db, DocId),
    {Body} = couch_doc:to_json_obj(Doc, []),
    couch_db:close(Db),
    Body.


    And few cases:


    run(Scenario) ->
    spawn(fun() -> in_case(Scenario) end).

    in_case(single_process) ->
    Seq = lists:seq(1, 30000),
    Try = fun(_) -> write(read()) end,
    lists:foreach(Try, Seq);

    in_case(spawned_processes) ->
    Seq = lists:seq(1, 5000),
    Try = fun(_) ->
    spawn(fun() -> write(read()) end)
    end,
    lists:foreach(Try, Seq);

    in_case(spawned_update_processes) ->
    Seq = lists:seq(1, 30000),
    Try = fun(_) ->
    Doc = read(),
    spawn(fun() -> write(Doc) end)
    end,
    lists:foreach(Try, Seq).


    My questions are:

    1] Why `in_case(single_process)` produces so many `inactive` memory on Mac
    OS X in case when `<<"medianet:album:10000053">>` document size is 67.19Kb?;
    -- besides, `in_case(spawned_processes)` doesn't;

    2] moreover, `in_case(spawned_update_processes)` still continue produce an
    `inactive` memory;

    I think that Linux env has same behavior.

    Thanks for help!)
  • Алекс Zatvornitskiy at Feb 7, 2013 at 6:04 pm
    Here worked example.
    https://gist.github.com/AZatvornitskiy/4732830(simple_couch_db_doc_behavior.erl)

    On Thu, Feb 7, 2013 at 6:58 PM, Алекс Zatvornitskiy wrote:

    +1 ) I don't think that `gdb` will give me answers. I've not had enough
    knowledge about `couch_db`, `couch_doc` modules.

    On Thu, Feb 7, 2013 at 6:42 PM, Paul Davis wrote:

    I'm confused by what's generating the inactive memory messages. Some
    sort of Erlang tracing?

    On Thu, Feb 7, 2013 at 10:36 AM, Алекс Zatvornitskiy
    wrote:
    Hi There! First of all, thanks a ton for CouchDB )

    I've couple of strange memory issues with R15B03 and couch db internals.
    It'd be great to have a clearance for questions.

    Let's consider short code snippet:

    db_and_doc() ->
    {<<"seed_labeled_prod">>, <<"medianet:album:10000053">>}.

    write(Body) ->
    {DbName, DocId} = db_and_doc(),
    {ok, Db} = couch_db:open_int(DbName, []),
    couch_db:update_doc(Db, Body, []),
    couch_db:close(Db).

    read() ->
    {DbName, DocId} = db_and_doc(),
    {ok, Db} = couch_db:open_int(DbName, []),
    {ok, Doc} = couch_db:open_doc(Db, DocId),
    {Body} = couch_doc:to_json_obj(Doc, []),
    couch_db:close(Db),
    Body.


    And few cases:


    run(Scenario) ->
    spawn(fun() -> in_case(Scenario) end).

    in_case(single_process) ->
    Seq = lists:seq(1, 30000),
    Try = fun(_) -> write(read()) end,
    lists:foreach(Try, Seq);

    in_case(spawned_processes) ->
    Seq = lists:seq(1, 5000),
    Try = fun(_) ->
    spawn(fun() -> write(read()) end)
    end,
    lists:foreach(Try, Seq);

    in_case(spawned_update_processes) ->
    Seq = lists:seq(1, 30000),
    Try = fun(_) ->
    Doc = read(),
    spawn(fun() -> write(Doc) end)
    end,
    lists:foreach(Try, Seq).


    My questions are:

    1] Why `in_case(single_process)` produces so many `inactive` memory on Mac
    OS X in case when `<<"medianet:album:10000053">>` document size is 67.19Kb?;
    -- besides, `in_case(spawned_processes)` doesn't;

    2] moreover, `in_case(spawned_update_processes)` still continue produce an
    `inactive` memory;

    I think that Linux env has same behavior.

    Thanks for help!)
  • Алекс Zatvornitskiy at Feb 9, 2013 at 3:49 pm
    #Closed. Reproduced only on OS X environments. Linux reduces a memory for
    all available cases as need it.

    On Thu, Feb 7, 2013 at 8:04 PM, Алекс Zatvornitskiy wrote:

    Here worked example. https://gist.github.com/AZatvornitskiy/4732830(simple_couch_db_doc_behavior.erl)


    On Thu, Feb 7, 2013 at 6:58 PM, Алекс Zatvornitskiy <
    a.zatvornitskiy@gmail.com> wrote:
    +1 ) I don't think that `gdb` will give me answers. I've not had enough
    knowledge about `couch_db`, `couch_doc` modules.

    On Thu, Feb 7, 2013 at 6:42 PM, Paul Davis wrote:

    I'm confused by what's generating the inactive memory messages. Some
    sort of Erlang tracing?

    On Thu, Feb 7, 2013 at 10:36 AM, Алекс Zatvornitskiy
    wrote:
    Hi There! First of all, thanks a ton for CouchDB )

    I've couple of strange memory issues with R15B03 and couch db
    internals.
    It'd be great to have a clearance for questions.

    Let's consider short code snippet:

    db_and_doc() ->
    {<<"seed_labeled_prod">>, <<"medianet:album:10000053">>}.

    write(Body) ->
    {DbName, DocId} = db_and_doc(),
    {ok, Db} = couch_db:open_int(DbName, []),
    couch_db:update_doc(Db, Body, []),
    couch_db:close(Db).

    read() ->
    {DbName, DocId} = db_and_doc(),
    {ok, Db} = couch_db:open_int(DbName, []),
    {ok, Doc} = couch_db:open_doc(Db, DocId),
    {Body} = couch_doc:to_json_obj(Doc, []),
    couch_db:close(Db),
    Body.


    And few cases:


    run(Scenario) ->
    spawn(fun() -> in_case(Scenario) end).

    in_case(single_process) ->
    Seq = lists:seq(1, 30000),
    Try = fun(_) -> write(read()) end,
    lists:foreach(Try, Seq);

    in_case(spawned_processes) ->
    Seq = lists:seq(1, 5000),
    Try = fun(_) ->
    spawn(fun() -> write(read()) end)
    end,
    lists:foreach(Try, Seq);

    in_case(spawned_update_processes) ->
    Seq = lists:seq(1, 30000),
    Try = fun(_) ->
    Doc = read(),
    spawn(fun() -> write(Doc) end)
    end,
    lists:foreach(Try, Seq).


    My questions are:

    1] Why `in_case(single_process)` produces so many `inactive` memory on Mac
    OS X in case when `<<"medianet:album:10000053">>` document size is 67.19Kb?;
    -- besides, `in_case(spawned_processes)` doesn't;

    2] moreover, `in_case(spawned_update_processes)` still continue
    produce an
    `inactive` memory;

    I think that Linux env has same behavior.

    Thanks for help!)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouperlang @
categoriescouchdb
postedFeb 7, '13 at 4:36p
activeFeb 9, '13 at 3:49p
posts5
users2
websitecouchdb.apache.org
irc#couchdb

People

Translate

site design / logo © 2021 Grokbase