incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zoltan Lajos Kis <ki...@tmit.bme.hu>
Subject Re: chunked response and couch_doc_open
Date Fri, 23 Oct 2009 18:04:31 GMT
Paul Davis wrote:
> On Fri, Oct 23, 2009 at 1:27 PM, Norman Barker <norman.barker@gmail.com> wrote:
>   
>> Hi,
>>
>> is there a way (in Erlang) to open a couchdb document and to iterate
>> over the document body without having to open up all of the document
>> in memory?
>>
>> I would like to use a chunked response to keep the system having a low
>> memory overhead.
>>
>> Not a particular couch question, is there a method in erlang to find
>> the size (as in number of bytes) of a particular term?
>>
>> many thanks,
>>
>> Norman
>>
>>     
>
> Norman,
>
> Well, for document JSON we store Erlang term binaries on disk so
> there's no real way to stream a doc across the wire from disk without
> loading the whole thing into RAM. Have you noticed CouchDB having
> memory issues on read loads? Its generally pretty light on its memory
> requirements for reads.
>
> The only way to get the size of a Term in bytes that I know of is the
> brute force: size(term_to_binary(Term)) method.
>
> Paul Davis
>   
Hello,

You can use the erts_debug:size(Term) and erts_debug:flat_size(Term) 
functions. They are somewhat
documented here: 
http://www.erlang.org/doc/efficiency_guide/processes.html . Note that 
the returned
value is in words and not bytes (see erlang:system_info(wordsize). ).

Zoltan.

Mime
View raw message