Initial write to couchbase server times out

We have a two node Couchbase environment with a Sync Gateway for mobile applications. There is also a website that access and writes data to the Couchbase environment. Because we want data written via the website to sync to mobile devices, the website writes via the Sync Gateway rest api when sending data to Couchbase. The problem we are having is, the first time we write to the sync gateway after the site has been idle for some time, the call from the sync gateway to our couchbase cluster times out. It seems like something in the Couchbase cluster is spinning up and it is not responding. Every subsequent write seems to work with no problem once this initial wake up has occurred. I have included log files from Sync Gateway below where you can see the initial timeout and subsequent successful writes. Can anyone provide any suggestions as to what I may have configured incorrectly on the Couchbase side? Is there some process I can periodically run to ensure the Couchbase server is ready at all times?

09:12:11.400145 HTTP: #883: PUT /semgastanktracking/groupdata::10::2015::03::11?rev= (ADMIN)2015/03/11 09:12:30 go-couchbase: call to Do("_sync:seq") in github.com/couchbaselabs/go-couchbase.(*Bucket).Incr took 18.9137519s
09:12:30.334917 WARNING: Error from Incr in _reserveSequences(1): WSARecv tcp 10.10.3.39:58100: A connection attempt failed because the connected party did notproperly respond after a period of time, or established connection failed because connected host has failed to respond. – db.(*sequenceAllocator)._reserveSequences() at sequence_allocator.go:59
09:12:30.341859 WARNING: Couldn’t interpret error type *net.OpError, value WSARecv tcp 10.10.3.39:58100: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. – base.ErrorAsHTTPStatus() aterror.go:63
09:12:30.345846 HTTP: #883: --> 500 Internal error: WSARecv tcp 10.10.3.39:58100: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (18945.7 ms)
09:12:30.370846 HTTP: #884: PUT /semgastanktracking/groupdata::08::2015::03::11?rev= (ADMIN)2015/03/11 09:12:40 go-couchbase: call to Do("_sync:seq") in github.com/couchbaselabs/go-couchbase.(*Bucket).Incr took 10.2419068s
09:12:40.618771 WARNING: Error from Incr in _reserveSequences(1): WSARecv tcp 10.10.3.39:58099: A connection attempt failed because the connected party did notproperly respond after a period of time, or established connection failed because connected host has failed to respond. – db.(*sequenceAllocator)._reserveSequences() at sequence_allocator.go:59
09:12:40.621770 WARNING: Couldn’t interpret error type *net.OpError, value WSARecv tcp 10.10.3.39:58099: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. – base.ErrorAsHTTPStatus() aterror.go:63
09:12:40.624769 HTTP: #884: --> 500 Internal error: WSARecv tcp 10.10.3.39:58099: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10253.9 ms)
09:12:40.646774 HTTP: #885: PUT /semgastanktracking/groupdata::09::2015::03::11?rev= (ADMIN)2015/03/11 09:12:50 go-couchbase: call to Do("_sync:seq") in github.com/couchbaselabs/go-couchbase.(*Bucket).Incr took 10.2488852s
09:12:50.906695 WARNING: Error from Incr in _reserveSequences(1): WSARecv tcp 10.10.3.39:58101: A connection attempt failed because the connected party did notproperly respond after a period of time, or established connection failed because connected host has failed to respond. – db.(*sequenceAllocator)._reserveSequences() at sequence_allocator.go:59
09:12:50.909695 WARNING: Couldn’t interpret error type *net.OpError, value WSARecv tcp 10.10.3.39:58101: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. – base.ErrorAsHTTPStatus() aterror.go:63
09:12:50.912695 HTTP: #885: --> 500 Internal error: WSARecv tcp 10.10.3.39:58101: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10265.9 ms)
09:12:50.931699 HTTP: #886: PUT /semgastanktracking/groupdata::13::2015::03::11?rev= (ADMIN)
09:12:50.950772 HTTP+: #886: --> 201 (19.1 ms)09:12:50.984702 HTTP: #887: PUT /semgastanktracking/groupdata::11::2015::03::11?rev= (ADMIN)
09:12:50.990706 HTTP+: #887: --> 201 (7.0 ms)
09:12:51.019703 HTTP: #888: PUT /semgastanktracking/groupdata::05::2015::03::11?rev= (ADMIN)
09:12:51.026731 HTTP+: #888: --> 201 (7.0 ms)
09:12:51.056704 HTTP: #889: PUT /semgastanktracking/groupdata::04::2015::03::11?rev= (ADMIN)
09:12:51.067710 HTTP+: #889: --> 201 (11.0 ms)
09:12:51.087709 HTTP: #890: PUT /semgastanktracking/groupdata::06::2015::03::11?rev= (ADMIN)
09:12:51.097738 HTTP+: #890: --> 201 (10.0 ms)
09:12:51.120717 HTTP: #891: PUT /semgastanktracking/groupdata::07::2015::03::11?rev= (ADMIN)
09:12:51.127726 HTTP+: #891: --> 201 (7.0 ms)
09:12:51.144725 HTTP: #892: PUT /semgastanktracking/groupdata::12::2015::03::11?rev= (ADMIN)
09:12:51.160744 HTTP+: #892: --> 201 (16.0 ms)
09:12:51.183722 HTTP: #893: PUT /semgastanktracking/groupdata::14::2015::03::11?rev= (ADMIN)
09:12:51.194729 HTTP+: #893: --> 201 (11.0 ms)
09:12:51.221728 HTTP: #894: PUT /semgastanktracking/groupdata::15::2015::03::11?rev= (ADMIN)
09:12:51.244788 HTTP+: #894: --> 201 (23.1 ms)
09:12:51.264737 HTTP: #895: PUT /semgastanktracking/groupdata::16::2015::03::11?rev= (ADMIN)
09:12:51.271790 HTTP+: #895: --> 201 (7.1 ms)
09:12:51.299739 HTTP: #896: PUT /semgastanktracking/groupdata::17::2015::03::11?rev= (ADMIN)
09:12:51.306746 HTTP+: #896: --> 201 (7.0 ms)
09:13:10.036420 HTTP: #897: PUT /semgastanktracking/groupdata::10::2015::03::11?rev= (ADMIN)
09:13:10.047438 HTTP+: #897: --> 201 (11.0 ms)
09:13:10.192428 HTTP: #898: PUT /semgastanktracking/groupdata::08::2015::03::11?rev= (ADMIN)
09:13:10.198433 HTTP+: #898: --> 201 (7.0 ms)
09:13:10.235435 HTTP: #899: PUT /semgastanktracking/groupdata::09::2015::03::11?rev= (ADMIN)
09:13:10.254444 HTTP+: #899: --> 201 (20.0 ms)
09:13:10.280442 HTTP: #900: PUT /semgastanktracking/groupdata::13::2015::03::11?rev=1-e5a5fb4d6fcd213feae3e5969f9c4348 (ADMIN)
09:13:10.294439 HTTP+: #900: --> 201 (14.0 ms)
09:13:10.327445 HTTP: #901: PUT /semgastanktracking/groupdata::11::2015::03::11?rev=1-2048aa854d954c6381932ae7b1d91e68 (ADMIN)
09:13:10.336472 HTTP+: #901: --> 201 (9.0 ms)
09:13:10.351446 HTTP: #902: PUT /semgastanktracking/groupdata::05::2015::03::11?rev=1-730c7da3bb474e40f26cb5455614b352 (ADMIN)
09:13:10.364463 HTTP+: #902: --> 201 (13.0 ms)
09:13:10.381446 HTTP: #903: PUT /semgastanktracking/groupdata::04::2015::03::11?rev=1-f1ad67607b2b240e57c9bde53eee35e2 (ADMIN)
09:13:10.393481 HTTP+: #903: --> 201 (12.0 ms)
09:13:10.414451 HTTP: #904: PUT /semgastanktracking/groupdata::06::2015::03::11?rev=1-8af630dc408a8d170032c33194b73b83 (ADMIN)
09:13:10.425452 HTTP+: #904: --> 201 (11.0 ms)
09:13:10.440448 HTTP: #905: PUT /semgastanktracking/groupdata::07::2015::03::11?rev=1-9ed4d17405bba418f3c736a833cfd5e1 (ADMIN)
09:13:10.451459 HTTP+: #905: --> 201 (11.0 ms)
09:13:10.479455 HTTP: #906: PUT /semgastanktracking/groupdata::12::2015::03::11?rev=1-9a4dfd053125b7cce8b8b4d514b22eaa (ADMIN)
09:13:10.489514 HTTP+: #906: --> 201 (10.1 ms)
09:13:11.309531 HTTP: #907: PUT /semgastanktracking/groupdata::14::2015::03::11?rev=1-67f6d97bcb2305fe09fa6ead6d14aded (ADMIN)
09:13:11.324540 HTTP+: #907: --> 201 (15.0 ms)
09:13:11.354558 HTTP: #908: PUT /semgastanktracking/groupdata::15::2015::03::11?rev=1-04ef49ed0c3e0ca2e48b56026fe63c00 (ADMIN)
09:13:11.365538 HTTP+: #908: --> 201 (11.0 ms)
09:13:11.402536 HTTP: #909: PUT /semgastanktracking/groupdata::16::2015::03::11?rev=1-fc8df135c9214915710e57d44ef5b621 (ADMIN)
09:13:11.411565 HTTP+: #909: --> 201 (10.0 ms)
09:13:11.439538 HTTP: #910: PUT /semgastanktracking/groupdata::17::2015::03::11?rev=1-e51ca95d7788ac31641d600c23b5c3e0 (ADMIN)
09:13:11.450539 HTTP+: #910: --> 201 (11.0 ms)

I don’t think the server engineers watch the Mobile category. Try posting in Couchbase Server instead.

(I’d move the thread, but the admin options I have don’t seem to allow me to…)

We are also seeing this periodically when the user attempts to get a session for the sync gateway. Any suggestions would be greatly appreciated.

13:43:55.237968 HTTP: #1049: POST /semgastanktracking/_session (ADMIN)2015/03/12 13:44:14 go-couchbase: call to Do("_sync:user:") in github.com/couchbaselabs/go-couchbase.(*Bucket).casNext took 18.8977317s
13:44:14.141667 WARNING: Couldn’t interpret error type *net.OpError, value WSARecv tcp 10.10.3.39:59389: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. – base.ErrorAsHTTPStatus() aterror.go:63
13:44:14.145670 HTTP: #1049: --> 500 Internal error: WSARecv tcp 10.10.3.39:59389: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (18907.7 ms)

Same issue, just more severe: it’s a timeout talking to the database.

Does anyone have any suggestions?

I’ll ping the Sync Gateway team to see if anyone has a response.