Page MenuHomePhabricator

Create Airflow pipeline to produce wmf_content.mediawiki_content_current_v1
Closed, ResolvedPublic

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
hotfix: add mediawiki-content-dump-0.4.0-v0.4.0.conda.tgz artifact to analytics.repos/data-engineering/airflow-dags!1254xcollazohotfix-declare-mw-content-4-on-analyticsmain
Add DAG and table maintenance for wmf_content.mediawiki_content_current_v1repos/data-engineering/airflow-dags!1249xcollazomw-content-currentmain
Implement pipeline for `mediawiki_content_current_v1`repos/data-engineering/mediawiki-content-pipelines!62xcollazoadd-mw-content-currentmain
Customize query in GitLab

Event Timeline

xcollazo updated https://gitlab.wikimedia.org/repos/data-engineering/airflow-dags/-/merge_requests/1249

Add DAG and table maintenance for wmf_content.mediawiki_content_current_v1

From MR 1249:

(Depends on https://gitlab.wikimedia.org/repos/data-engineering/dumps/mediawiki-content-dump/-/merge_requests/62).

In this MR we:

  • Implement a daily DAG to calculage and merge changes from wmf_content.mediawiki_content_history_v1 into wmf_content.mediawiki_content_current_v1. This is done via a MERGE INTO, which is under review separately.
  • Implement Iceberg table maintenance for wmf_content.mediawiki_content_current_v1, including a call to rewrite_position_delete_files() which allows us to run the MERGE INTO pipeline with merge-on-read (faster, and more stable!).
  • Modified folder hierarchy a bit to accomodate the set of history content jobs vs the current jobs.

xcollazo merged https://gitlab.wikimedia.org/repos/data-engineering/airflow-dags/-/merge_requests/1249

Add DAG and table maintenance for wmf_content.mediawiki_content_current_v1

Mentioned in SAL (#wikimedia-operations) [2025-04-23T19:30:20Z] <xcollazo@deploy1003> Started deploy [airflow-dags/analytics@7312379]: Release DAGs for T391283.

Mentioned in SAL (#wikimedia-operations) [2025-04-23T19:31:14Z] <xcollazo@deploy1003> Finished deploy [airflow-dags/analytics@7312379]: Release DAGs for T391283. (duration: 00m 54s)

xcollazo updated https://gitlab.wikimedia.org/repos/data-engineering/airflow-dags/-/merge_requests/1254

hotfix: add mediawiki-content-dump-0.4.0-v0.4.0.conda.tgz artifact to analytics.

xcollazo merged https://gitlab.wikimedia.org/repos/data-engineering/airflow-dags/-/merge_requests/1254

hotfix: add mediawiki-content-dump-0.4.0-v0.4.0.conda.tgz artifact to analytics.

Mentioned in SAL (#wikimedia-operations) [2025-04-23T20:21:10Z] <xcollazo@deploy1003> Started deploy [airflow-dags/analytics@4a7644d]: Deploy hotfix for T391283.

Mentioned in SAL (#wikimedia-operations) [2025-04-23T20:22:15Z] <xcollazo@deploy1003> Finished deploy [airflow-dags/analytics@4a7644d]: Deploy hotfix for T391283. (duration: 01m 04s)

Two successful runs of the Airflow job so far. ๐ŸŽ‰ ๐ŸŽ‰ ๐ŸŽ‰

I do want to test out running it with less memory, as it is currently running with 64 32G executors, and it would be great if instead we could do 128 16GB executors.

Two successful runs of the Airflow job so far. ๐ŸŽ‰ ๐ŸŽ‰ ๐ŸŽ‰

I do want to test out running it with less memory, as it is currently running with 64 32G executors, and it would be great if instead we could do 128 16GB executors.

The 128 16GB executors run actually took longer. This is because many of the early jobs took significantly more time due to spilling.

I will now try with 96 24GB executors:

{
  "start_date": "2025-04-16T00:00:00",
  "sla": "PT12H",
  "conda_env": "hdfs:///wmf/cache/artifacts/airflow/analytics/mediawiki-content-dump-0.4.0-v0.4.0.conda.tgz",
  "hive_mediawiki_content_history_v1_table": "wmf_content.mediawiki_content_history_v1",
  "hive_mediawiki_content_current_v1_table": "wmf_content.mediawiki_content_current_v1",
  "driver_memory": "16G",
  "driver_cores": "4",
  "executor_memory": "24G",
  "executor_cores": "2",
  "max_executors": "96",
  "spark_driver_maxResultSize": "8G",
  "spark_sql_shuffle_partitions": "1024",
  "spark_sql_iceberg_locality_enabled": "true",
  "source_table_full_table_scan_join_strategy": "BROADCAST"
}

96 24GB executors works best indeed, with runtimes under 2 hours.

One more thing I want to test is spark.sql.iceberg.locality.enabled = false, as this locality calculation is easily taking ~25 mins.

I will now test this in prod, and monitor the job to make sure it doesn't create a Hadoop storm.

New settings:

{
  "start_date": "2025-04-16T00:00:00",
  "sla": "PT12H",
  "conda_env": "hdfs:///wmf/cache/artifacts/airflow/analytics/mediawiki-content-dump-0.4.0-v0.4.0.conda.tgz",
  "hive_mediawiki_content_history_v1_table": "wmf_content.mediawiki_content_history_v1",
  "hive_mediawiki_content_current_v1_table": "wmf_content.mediawiki_content_current_v1",
  "driver_memory": "16G",
  "driver_cores": "4",
  "executor_memory": "24G",
  "executor_cores": "2",
  "max_executors": "96",
  "spark_driver_maxResultSize": "8G",
  "spark_sql_shuffle_partitions": "1024",
  "spark_sql_iceberg_locality_enabled": "false",                    <<<<<<<<<<<
  "source_table_full_table_scan_join_strategy": "BROADCAST"
}

Grafana shows no significant HDFS stress created on the timeframe from last daily run, while we did win a 30 mins runtime difference (115 mins vs 85 mins).

Comparing an older Spark history (link) with the latest run (link), quite paradoxically, the job with no locality enabled actually had better locality, with most all tasks assigned as PROCESS_LOCAL, while the job with locality enabled had a mix of ANY, NODE_LOCAL and RACK_LOCAL.

My speculation here is as follows: since each job did take a bit more (the big win was on not waiting on calling HDFS for locality info), I suspect we were fully exercising the default of spark.locality.wait = 3s and thus hitting PROCESS_LOCAL at runtime, while on the run with locality enabled we were relying completely on Iceberg query planning pre-planned locality? Just a speculation, but I will take it!

CC @JAllemandou as this may be interesting for future Iceberg tuning.

For some reason the MR did not link, but we made the changes from T391283#10773426 permanent via MR 1275.