Long Poll warnings

79 views
Skip to first unread message

Todd Freese

unread,
Jan 29, 2015, 1:41:13 PM1/29/15
to mobile-c...@googlegroups.com
Since moving my couchbase & SG to EC2 servers using ELB I started getting these warnings:

12:35:38.206 WARNING: Truncated changes feed

12:35:38.206 WARNING: CBLSocketChangeTracker[0x79ece620 shotbotdb]: Longpoll connection closed (by proxy?) after 59.3 sec


I have web sockets turned off for ELB. Do I need to change the long poll interval or something? If so how?


Todd

Traun Leyden

unread,
Jan 29, 2015, 1:48:15 PM1/29/15
to mobile-c...@googlegroups.com
Yeah there are known issues with ios + ELB, see this google group thread.

Either you have to disable websockets on ios, or switch to nginx.

On our demo cluster we're successfully using ios websockets + nginx.



--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/05506a39-330c-472e-9f6b-4bd9cdc7ff65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Todd Freese

unread,
Jan 29, 2015, 3:27:48 PM1/29/15
to mobile-c...@googlegroups.com
That's what's weird. I have web sockets turned off via:

_pull.customProperties = @{@"websocket": @NO};

_push.customProperties = @{@"websocket": @NO};


and I am still seeing the problem.


Is this the correct way to turn off web sockets?


T

Jens Alfke

unread,
Jan 29, 2015, 3:42:33 PM1/29/15
to mobile-c...@googlegroups.com

On Jan 29, 2015, at 12:27 PM, Todd Freese <to...@filmworkers.com> wrote:

Is this the correct way to turn off web sockets?

Yes, you've got WebSockets turned off; you can tell because the warning comes from CBLSocketChangeTracker not CBLWebSocketChangeTracker :)

The issue is independent of using WebSockets. The regular change tracker uses long-poll which also tries to keep a socket to the server open. There's been previous discussion of this; you might be able to shorten the 'heartbeat' time of the connection so the load balancer won't think the socket is idle.

—Jens

Todd Freese

unread,
Jan 29, 2015, 4:47:46 PM1/29/15
to mobile-c...@googlegroups.com
Is shorting the heartbeat time done in CBL or you mean in ELB?

Todd

Jens Alfke

unread,
Jan 29, 2015, 8:35:29 PM1/29/15
to mobile-c...@googlegroups.com

> On Jan 29, 2015, at 1:47 PM, Todd Freese <to...@filmworkers.com> wrote:
>
> Is shorting the heartbeat time done in CBL or you mean in ELB?

In CBL. In the CBLReplication's customProperties dictionary, set the key @"heartbeat" to an NSNumber containing the time interval in milliseconds [not seconds!]. Set this to comfortably shorter than the time at which you get disconnected; maybe 45000 in your case.

—Jens

Todd Freese

unread,
Jan 30, 2015, 12:11:38 AM1/30/15
to mobile-c...@googlegroups.com
Hmmm. Even after setting the heartbeat value I still have the issue with ELB closing the connection. It got a lot better but it still happens.

Here is how I set the heartbeat:

_pull.customProperties = @{@"websocket": @NO, @"heartbeat": @10000};

_push.customProperties = @{@"websocket": @NO, @"heartbeat": @10000};


In ELB, I have the Idle Timeout set to 60 seconds.


I'm wondering if the issue is the ELB stickiness setting. Since ELB is load balancing between 2 EC2 nodes, the heart beat may not be going to the same node each time and bouncing between the nodes. Based on how it bounces around, it may or may not get closed.


Anyone else see this?


I've considered going with Nginx, but it seems that I would really need 2 Nginx nodes, each one in a different availability zone. Any thoughts on this issue?


T

Todd Freese

unread,
Jan 30, 2015, 12:27:46 AM1/30/15
to mobile-c...@googlegroups.com
Looks like ELB stickiness want a cookie in the requests to bind requests to a session.

Is there a way to add a cookie in the CBL requests?

T

Jens Alfke

unread,
Jan 30, 2015, 12:36:02 AM1/30/15
to mobile-c...@googlegroups.com

On Jan 29, 2015, at 9:27 PM, Todd Freese <to...@filmworkers.com> wrote:

Is there a way to add a cookie in the CBL requests?

You can use the NSHTTPCookieStorage API to register a cookie that will be sent to a given hostname.

—Jens

Todd Freese

unread,
Jan 30, 2015, 11:51:19 PM1/30/15
to mobile-c...@googlegroups.com
I found a solution that seems to work in preventing ELB from dropping connections.

I set the following on the CBLReplicator:

_pull.customProperties = @{@"websocket": @NO, @"heartbeat": @30000};


For ELB I set the Connection settings: Idle timeout to 600.


I also turn on ELB Stickiness with Enable Load Balancer Generated Cookie Stickiness turned ON with a value of 300.


These values are a little on the high side, but it seems to work well.


Todd

Reply all
Reply to author
Forward
0 new messages