couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Kocoloski <kocol...@apache.org>
Subject Re: mochiweb socket options discriminating against slow connections
Date Sun, 08 Nov 2009 00:03:45 GMT
Hi Oliver, it's entirely possible, especially if couchapp is using  
_bulk_docs for the upload (I don't know if that's the case).  Best,

Adam

On Nov 6, 2009, at 5:35 AM, Oliver Oli wrote:

> sometimes i'm getting connection errors from couchapp over a slow DSL
> connection. is this related?
>
> On Wed, Nov 4, 2009 at 10:42 PM, Adam Kocoloski  
> <kocolosk@apache.org> wrote:
>> Hi, Zachary Zolton, Joe Williams and I stumbled on an awkward part of
>> CouchDB's (actually MochiWeb's) configuration that makes working  
>> over a slow
>> connection problematic.  When receiving a large unchunked upload,  
>> MochiWeb
>> calls
>>
>> gen_tcp:recv(Socket, Length = 1048576, Timeout = 10000)
>>
>> which says "pull 1MB off the socket in 10 seconds, or timeout".   
>> This is a
>> bit crazy, as we'd definitely like to support e.g. replication with  
>> CouchDB
>> servers over slower links than 100KB/s.
>>
>> I tried to do a little digging to see what recourse we have.  We  
>> can of
>> course play the tuning game adjusting the length and timeout until  
>> we're
>> happy, but I think it'd be nicer to never timeout a connection that  
>> is still
>> sending data.  From the gen_tcp man page
>>
>>> The Length argument is only meaningful when the socket is in raw
>>> mode and denotes the number of bytes to read. If Length = 0, all
>>> available bytes are returned. If  Length  >  0,  exactly  Length
>>> bytes  are  returned, or an error; possibly discarding less than
>>> Length bytes of data when the socket gets closed from the  other
>>> side.
>>>
>>> The  optional Timeout parameter specifies a timeout in millisec-
>>> onds. The default value is infinity.
>>
>> I don't know what the behavior is when there are 0 bytes available  
>> on the
>> socket -- does gen_tcp:recv just keep returning 0 and leave it to  
>> us to
>> implement the timeout, or can we do something like
>>
>> gen_tcp:recv(Socket, 0, 10000)
>>
>> Best, Adam
>>


Mime
View raw message