couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCaffrey" <>
Subject RE: Erlag View performance
Date Tue, 09 Mar 2010 20:31:20 GMT
I'm doing a straight lists:foldl call on one of the fields in the

I've done some timings and the time is all in the fold function. The
call into the view for each document and the emit is insignificant.

So it doesn't seem to be the i/o of the document and emit but the
performance of the erlang code.

Maybe there's some contention in the view server causing an issue.


-----Original Message-----
From: Randall Leeds [] 
Sent: Tuesday, March 09, 2010 1:06 PM
Subject: Re: Erlag View performance

If there's discussion to be had here, it should maybe go over to dev@,
so I'm crossposting there.

I looked at the code (only briefly), but you can take a look too...


It looks like the functions are (as per the view server api) parsed
only once and then just applied to the documents.
Now, the foldrows function is not just a call to lists:foldl, so maybe
there's a little extra overhead here.
Also, there might be more i/o contention when the results are being
written to the view index rather than just output in your eclipse
console (or maybe I don't understand your benchmark exactly).

If you are writing erlang views you must know some erlang, so maybe
take a look and see if you can't optimize the view server a bit.



On Tue, Mar 9, 2010 at 08:46, Michael McCaffrey <>
> Reposting, to try and get some traction on this. Baffled as to why the
> view takes 10-20 times longer per record in couch than running in pure
> erlang environment.
> When each record takes almost a second, things run forever...
> Any help appreciated.
> Hello,
> I'm using an erlang view to fold thru large deep lists and have a
> performance issue.
> Being a relative erlang newbie I thought it was a codingsue,
> When I run thru a document locally (in Eclipse) I can fold thru the
> in 47000 micro seconds.
> When I fold thru the same document during the view, it takes almost a
> full second (900000 micro seconds). All the documents take about this
> long.
> Any thoughts on why this may be happening?
> Thanks

View raw message