incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Roebuck <paul_roeb...@comcast.net>
Subject Need Strategy for Dealing with Large List Output
Date Thu, 18 Jul 2013 13:05:38 GMT
Have a couchapp whose list() can't seem to output its information
before OS timeout  occurs. We initially just increased the OS timeout,
but still have issues depending on whatever else is going on.

What is the recommended means of paginating the output with
multiple calls (i.e., pieces parts instead of the whole enchilada)?

list(head, req) {
    provides("json") {
        // generate time consuming output
    }
    provides("xml") {
        // generate time consuming output
    }
}

Had initially thought of adding a response header and doing a HEAD
call, but had problems kept getting badarg exceptions (does using
provides() preclude using start()?).

list(head, req) {
    start({
        headers: {
            "X-NRows": head.total_rows
        }
    });

    provides("json") {
        if (req.method === 'HEAD')
            return "";

        // generate time consuming output
    }
    provides("xml") {
        // generate time consuming output
    }
}

Assuming I can retrieve this value, then the idea was to make a series
of GETs to same list function with its view using 'limit=' and 'start=', 
collating the output using mbostock's QueueJS on HTML page prior
to display.

Or is there a better way?

Thx.

Mime
View raw message