GCP / BigQuery failed inserts - Does Dataflow region have to be the same as BigQuery's region?

I managed to get a real-time / Google Cloud Platform pipeline setup with the collector and enrich working. Events are enriched pretty quickly and get picked up by the BigQuery Loader, but they end up at the “failedInsertsSink” step:

Can’t see any logs or details on the Dataflow. And when inspecting messages in the failed inserts queue, the rows look valid:

│    MESSAGE_ID   │ ATTRIBUTES │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────┼────────────┤
│ {"app_id":"testing","platform":"web","etl_tstamp":"2019-07-26T03:28:57.567Z","collector_tstamp":"2019-07-26T03:28:56.490Z","dvce_created_tstamp":"2019-07-26T03:28:56.475Z","event":"page_view","event_id":"941b86c3-9276-46d8-a8da-9366aeed1711","name_tracker":"test","v_tracker":"js-2.9.0","v_collector":"ssc-0.15.0-googlepubsub","v_etl":"beam-enrich-0.3.0-common-0.37.0","user_ipaddress":"127.0.0.1","user_fingerprint":"1529022064","domain_userid":"3d15ef9b-6895-4caa-9819-699385c5afd1","domain_sessionidx":2,"network_userid":"428e8d1e-39fb-4ddc-b9b6-a94cf13d5597","page_url":"http://mentalfloss.com/article/53792/17-ancient-abandoned-websites-still-work","page_title":"17 Ancient Abandoned Websites That Still Work | Mental Floss","page_referrer":"https://www.google.com/","page_urlscheme":"http","page_urlhost":"mentalfloss.com","page_urlport":80,"page_urlpath":"/article/53792/17-ancient-abandoned-websites-still-work","refr_urlscheme":"https","refr_urlhost":"www.google.com","refr_urlport":443,"refr_urlpath":"/","contexts_com_snowplowanalytics_snowplow_web_page_1_0_0":[{"id":"dbb136ff-a43d-4bf6-a5b3-3f287384aff5"}],"contexts_org_w3_performance_timing_1_0_0":[{"chrome_first_paint":1564111714839,"connect_end":1564111713563,"connect_start":1564111713337,"dom_complete":1564111721737,"dom_content_loaded_event_end":1564111714975,"dom_content_loaded_event_start":1564111714882,"dom_interactive":1564111714882,"dom_loading":1564111713899,"domain_lookup_end":1564111713337,"domain_lookup_start":1564111713337,"fetch_start":1564111713333,"load_event_end":1564111721753,"load_event_start":1564111721737,"ms_first_paint":null,"navigation_start":1564111713329,"proxy_end":null,"proxy_start":null,"redirect_end":0,"redirect_start":0,"request_end":null,"request_start":1564111713563,"response_end":1564111713810,"response_start":1564111713808,"secure_connection_start":0,"unload_event_end":1564111713857,"unload_event_start":1564111713815}],"contexts_com_google_analytics_cookies_1_0_0":[{"__utma":null,"__utmb":null,"__utmc":null,"__utmv":null,"__utmz":null,"_ga":"GA1.2.1320550972.1564101570"}],"useragent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36","br_lang":"en-US","br_features_pdf":true,"br_features_flash":false,"br_features_java":false,"br_features_director":false,"br_features_quicktime":false,"br_features_realplayer":false,"br_features_windowsmedia":false,"br_features_gears":false,"br_features_silverlight":false,"br_cookies":true,"br_colordepth":"24","br_viewwidth":1680,"br_viewheight":498,"os_timezone":"Australia/Sydney","dvce_screenwidth":1680,"dvce_screenheight":1050,"doc_charset":"UTF-8","doc_width":1665,"doc_height":16152,"dvce_sent_tstamp":"2019-07-26T03:28:56.478Z","domain_sessionid":"851f39c4-0549-48f4-9c33-6ed497006475","derived_tstamp":"2019-07-26T03:28:56.487Z","event_vendor":"com.snowplowanalytics.snowplow","event_name":"page_view","event_format":"jsonschema","event_version":"1-0-0"} │ 629819702783529 │            │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────┴────────────┘

I fixed it when I changed the BigQuery data location from australia-southeast1 to the default US location - and now it’s working for my dataflow instance in us-west1.

Couple of questions:

  1. Do we need Dataflow to run in the same region as BigQuery? Or are there options we can pass to the BQ loader to send data to the right region?
  2. What’s the best region for DF/BQ? Are there differences?

Hi @robkingston,

I don’t think we ever tried out these components in different regions. Overall, it should work, but I would need a concrete reason to launch components in different regions. Why would one introduce an artificial delay for passing data between components in different regions. I believe what always works out best is same regions as collector and collector is in the region of your userbase (unless you have a strong reason to use another region, e.g. costs or instance type availability). Here’s a nice summary: https://cloud.google.com/solutions/best-practices-compute-engine-region-selection

However, I don’t think your data ended up in failedInserts due invalid region. Did you have a mutator microservice running? Usually data ends up in failedInserts due a mutator lag (time between you first send new self-describing entity and time mutator altered the table). Data itself is entirely valid (its different from “bad rows”). In order to get data from this topic you can use either Forwarder Dataflow job (quite expensive and should be launched/killed manually) or Repeater microservice (its RC in 0.2.0 branch, but very stable - you can run it on a small node/container permanently).

Thanks @anton - yes, you may be right. I’d been firing up and killing processes left and right today while setting up the pipeline. Will have to give it a test when I fire it all up again.

As for running BigQuery & Dataflow in different regions, our use case is:

  1. We want to minimise analyst-to-BigQuery latency got reports usability. As I was testing the setup, I selected australia-southeast1 for the BigQuery dataset
  2. Google Dataflow doesn’t provide services in australia-southeast1 (the closest region with Dataflow is Taiwan or US West)
  3. Collector-to-BigQuery latency is just a nice to have for us - we’re coming from daily batches.