You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Michael McCaffrey <mm...@ittvis.com> on 2010/03/10 01:03:34 UTC

Erlang View performance

Put some more timings in there to try and figure where the performance
problem is.

Couch is doing something periodically that takes about 15 milliseconds.

It's happening at all different spots in the fold function but
periodically at the very beginning where I have this code. These are the
first lines of code in the function.

                io:fwrite(\"~nWalk ~p\", [now()]),
                io:fwrite(\"~nGetRec1 ~p\", [now()]),

There will be a 15 millisecond delay between the two. 

What the heck is couch doing to cause this delay? 

Saw something about delay_commits in ini but it is set to true.

There is nothing else running against the db, all in dev.

Mike

-----Original Message-----
From: Randall Leeds [mailto:randall.leeds@gmail.com] 
Sent: Tuesday, March 09, 2010 1:06 PM
To: user@couchdb.apache.org; dev@couchdb.apache.org
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...

src/couchdb/couch_native_process.erl

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.

Cheers!

-Randall

On Tue, Mar 9, 2010 at 08:46, Michael McCaffrey <mm...@ittvis.com>
wrote:
> 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,
however...
>
> When I run thru a document locally (in Eclipse) I can fold thru the
doc
> 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
>
>
>
>