rmetzger commented on issue #6594: [FLINK-9311] [pubsub] Added PubSub source 
connector with support for checkpointing (ATLEAST_ONCE)
URL: https://github.com/apache/flink/pull/6594#issuecomment-464740372
 
 
   **Regarding the message pulling model:**
   The current approach is the following:
   
   1. We set Flow control parameters, so that the API server knows how many 
messages we want to receive.
   2. We launch a async listener, which gets messages pushed from the API 
server (according to our flow control)
   3. The async listener forwards messages to a queue
   4. The Source is removing messages from the queue in its while() loop
   
   I propose to change the implementation to the following:
   1. We use the Synchronous Pull API: 
https://cloud.google.com/pubsub/docs/pull#synchronous-pull 
   2. The Source while() loop is pull-ing data from the API server
   
   Backpressure will be treated very naturally. 
   Flink's `sourceContext.collect()` will not return if there's backpressure, 
thus we won't pull any new data from the API server (other parallel sources can 
pick up the data).
   Users don't need to manually configure a good set of checkpointing / flow 
control config parameters.
   The memory footprint is lower, as we don't have data in a in-memory queue. 
Similarly, this queue is adding latency, as records are waiting there.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to