You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Brad Rhoads <bd...@gmail.com> on 2012/10/24 18:50:33 UTC

couchdb Replication of Large Documents via Ajax

SO question with bounty at
http://stackoverflow.com/questions/12979848/couchdb-replication-of-large-documents-via-ajax

I'm working on a couchapp that may have large documents added to it.
For example, I'm testing with a 446MB video. User A can request to
replicate with user B who may have large files like this. The
replication is then initiated from an ajax call.

I have a few of questions:

In general, am I going about this the right way?
Should timeout = connection_timeout?
Does timeout relate to each document that needs to be synced or the
entire replication?
Does connection_timeout relate to each document that needs to be
synced or the entire replication?
Does retries_per_request mean that I have a total of
(connection_timeout X retries_per_request) for the entire replication?
What if that exceeds timeout?
If I am stuck with a max time for the replication as a whole, how do I
allow replication of many large documents?
Here's my code:

 $.ajax({
            url: "/_replicate",
            timeout : 6000000,
            type: "POST",

            data: JSON.stringify({"source": repFrom, "target": secureHome,
                "userCtx": {"name": homeUser, "roles":["_admin", homeUser]},
                "continuous":continuousRep,
                "connection_timeout": 6000000,
                "retries_per_request": 20,
                "http_connections": 30}),
            contentType:"application/json",
            error: function(){
                alert(libLang.noSyncOnline);
                $.mobile.hidePageLoadingMsg();
            },
            success: function(message){
                if(message){
                    alert(libLang.synced);
                    $.mobile.hidePageLoadingMsg();
                };
            }
        });

---------------------------
www.maf.org/rhoads
www.ontherhoads.org