A slight clarification, JS itself is multi-threaded. Couchjs is just not implemented as a threaded view server. I've contemplated giving view servers the ability to exectute multiple jobs simultaneously but there are a couple of things that make it not a priority.
Firstly, view computation is generally reported to be rate limited by disk write throughput. Secondly, why move all that complicated threading logic into the view server when erlang can just spawn four os processes. There's definitely room for improvement in OS process handling but I would place any major parallelization type changes post 1.0. HTH, Paul Davis On Fri, Mar 20, 2009 at 3:05 AM, Daniel Friesen <[email protected]> wrote: > JavaScript is single-threaded, views are written in JavaScript thus a view > can only make use of a single core. > > On the positive side, it does mean that while doing a view, you still have > the cpu power to handle two other views, and handle couch requests with > dedicated cores. > > ~Daniel Friesen (Dantman, Nadir-Seen-Fire) > > Anand Chitipothu wrote: >> >> I have created a new couchdb database on a quad-core machine, loaded >> the database with 30 million documents and created a view. >> >> I accessed the view for the first time, to start the view computation. >> From whatever I can see from the output of top command, beam.smp is >> taking around 70% of cpu and couchjs around 30%. >> >> Shouldn't the view computation process use all the 4 cores for doing >> the computation? >> >> Thanks, >> Anand >> > >
