2

What mechanism does Couchbase Sync Gateway use for getting the database changes in the couchbase server.

  1. Does it do a long Poll or create a websocket connection ?
  2. Or does is frequently invokes Couchbase server REST API ? If so then which REST API and what are the queries that it sends in the HTTP request for that REST API?
DaveR
  • 9,540
  • 3
  • 39
  • 58
ajaygopal07
  • 150
  • 8

2 Answers2

2

Neither - it uses DCP (the same underlying protocol used by replication and XDCR) to subscribe to updates from Couchbase Server.

DaveR
  • 9,540
  • 3
  • 39
  • 58
1

After some Research I found out the following points.

1) sync_gateway first establishes a tcp connection with the couchbase server to port 8091 and over that tcp connection it sends http GET request to invoke the REST API /pools ad /pools/default.

2) After that whenever there is a document change initiated by user , sync_gateway send tcp packet with data field asking for the user information and the document information that is being changed .

3) Now sync_gateway sends another TCP packet with revised revision of the packet and gets a response from couchbase server that document has been revised.

4) All these conversation happens using TCP PSH ACK packets. So there are no HTTP packets flowing . Only TCP servers communicating both sides.

ajaygopal07
  • 150
  • 8