Risolvere i problemi relativi ai job in ritardo nello streaming
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Per le pipeline di streaming, un ritardatario è definito come un elemento di lavoro con le seguenti caratteristiche:
Impedisce
alla filigrana
di avanzare per un periodo di tempo significativo (dell'ordine di minuti).
Viene elaborato a lungo rispetto ad altri elementi di lavoro nella stessa fase.
Gli elementi in ritardo bloccano il livello raggiunto e aggiungono latenza al job. Se il ritardo è
accettabile per il tuo caso d'uso, non devi intraprendere alcuna azione. Se vuoi ridurre la latenza di un job, inizia a risolvere i problemi relativi ai ritardatari.
Visualizzare i ritardatari dello streaming nella console Google Cloud
Dopo aver avviato un job Dataflow, puoi utilizzare la console Google Cloud
per visualizzare gli eventuali ritardatari rilevati.
Nella pagina Dettagli job, fai clic sulla scheda Dettagli esecuzione.
Nell'elenco Visualizzazione a grafico, seleziona Avanzamento fase. Il grafico di avanzamento
mostra i conteggi aggregati di tutti i ritardatari rilevati in ogni fase.
Per visualizzare i dettagli di una fase, tieni il puntatore sopra la barra della fase. Il
riquadro dei dettagli include un link ai log dei worker. Se fai clic su questo link, si apre
Cloud Logging con ambito limitato al worker e all'intervallo di tempo in cui è stato rilevato
il ritardatario.
Visualizzare gli elementi in ritardo per flusso di lavoro della fase
Per visualizzare i ritardatari in base al flusso di lavoro della fase:
Nella console Google Cloud , vai alla pagina Job di Dataflow.
Nella pagina dei dettagli del job, fai clic sulla scheda Dettagli esecuzione.
Nell'elenco Visualizzazione a grafico, seleziona Flusso di lavoro dello stato. Il flusso di lavoro della fase
mostra le fasi di esecuzione del job, rappresentate da un grafico del flusso di lavoro.
Risolvere i problemi di streaming in ritardo
Se viene rilevato un ritardatario, significa che un'operazione nella pipeline
è in esecuzione da un periodo di tempo insolitamente lungo.
Per risolvere il problema, verifica innanzitutto se
Dataflow Insights
individua eventuali problemi.
Se non riesci ancora a determinare la causa, controlla i log dei worker per la fase che
ha segnalato il problema. Per visualizzare i log del worker pertinenti, visualizza i
dettagli dei ritardatari nell'avanzamento della fase.
Poi fai clic sul link del lavoratore. Questo link apre Cloud Logging, con ambito
il worker e l'intervallo di tempo in cui è stato rilevato lo straggler. Cerca problemi
che potrebbero rallentare lo stage, ad esempio:
Bug nel codice DoFn o
blocco DoFns. Cerca
le analisi dello stack nei log, vicino al timestamp in cui è stato rilevato il ritardatario.
Limiti di quota nei sink. Se la tua pipeline genera output in un servizio Google Cloud, potresti essere in grado di aumentare la quota. Per saperne di più, consulta
la documentazione di Cloud Quotas. Consulta anche la documentazione del servizio specifico per le strategie di ottimizzazione, nonché la documentazione di I/O Connector.
DoFns che eseguono operazioni di lettura o scrittura di grandi dimensioni sullo stato permanente.
Valuta la possibilità di eseguire il refactoring del codice per eseguire letture o scritture più piccole sullo stato persistente.
Puoi anche utilizzare il
pannello
Informazioni laterali
per trovare i passaggi più lenti della fase. Uno di questi passaggi potrebbe
causare il problema. Fai clic sul nome del passaggio per visualizzare i log del worker per quel
passaggio.
Dopo aver determinato la causa,
aggiorna la pipeline con il nuovo
codice e monitora il risultato.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eStreaming pipeline stragglers are work items that significantly delay watermark advancement and process for a notably longer duration than other items in the same stage, leading to increased job latency.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Cloud console allows viewing of detected streaming stragglers through the stage progress view or the stage workflow view after a Dataflow job has started.\u003c/p\u003e\n"],["\u003cp\u003eTroubleshooting streaming stragglers involves checking for issues with Dataflow insights, reviewing worker logs for the relevant stage, and investigating potential causes like bugs in \u003ccode\u003eDoFn\u003c/code\u003e code, slow external service calls, quota limits, or large read/write operations on persistent state.\u003c/p\u003e\n"],["\u003cp\u003eThe Side info panel in the console can help identify the slowest steps in a stage, potentially revealing the cause of a straggler, and these steps can be used to find the relevant worker logs for the issue.\u003c/p\u003e\n"],["\u003cp\u003eAfter identifying the root cause of a straggler, you should update your pipeline code to resolve the issue, and then monitor the job's performance for improvement.\u003c/p\u003e\n"]]],[],null,["# Troubleshoot stragglers in streaming jobs\n\nFor streaming pipelines, a *straggler* is defined as a work item with the\nfollowing characteristics:\n\n- It prevents the [watermark](/dataflow/docs/concepts/beam-programming-model#advanced_concepts) from advancing for a significant length of time (on the order of minutes).\n- It processes for a long time relative to other work items in the same stage.\n\nStragglers hold back the watermark and add latency to the job. If the lag is\nacceptable for your use case, then you don't need to take any action. If you\nwant to reduce a job's latency, start by addressing any stragglers.\n| **Note:** For information about troubleshooting stragglers in batch jobs, see [Troubleshoot stragglers in batch\n| jobs](/dataflow/docs/guides/troubleshoot-batch-stragglers).\n\nView streaming stragglers in the Google Cloud console\n-----------------------------------------------------\n\nAfter you start a Dataflow job, you can use the Google Cloud console\nto view any detected stragglers.\n\nYou can view streaming stragglers in the [stage progress\nview](/dataflow/docs/concepts/execution-details#stage_progress_for_streaming_jobs)\nor the [stage workflow\nview](/dataflow/docs/concepts/execution-details#stage_workflow).\n\n### View stragglers by stage progress\n\nTo view stragglers by stage progress:\n\n1. In the Google Cloud console, go to the Dataflow **Jobs**\n page.\n\n [Go to Jobs](https://console.cloud.google.com/dataflow/jobs)\n2. Click the name of the job.\n\n3. In the **Job details** page, click the **Execution details** tab.\n\n4. In the **Graph view** list, select **Stage progress**. The progress graph\n shows aggregated counts of all stragglers detected within each stage.\n\n5. To see details for a stage, hold the pointer over the bar for the stage. The\n details pane includes a link to the worker logs. Clicking this link opens\n Cloud Logging scoped to the worker and the time range when the straggler\n was detected.\n\n### View stragglers by stage workflow\n\nTo view stragglers by stage workflow:\n\n1. In the Google Cloud console, go to the Dataflow **Jobs**\n page.\n\n Go to [Jobs](https://console.cloud.google.com/dataflow/jobs)\n2. Click the name of the job.\n\n3. In the job details page, click the **Execution details** tab.\n\n4. In the **Graph view** list, select **Stage workflow**. The stage workflow\n shows the execution stages of the job, represented as a workflow graph.\n\nTroubleshoot streaming stragglers\n---------------------------------\n\nIf a straggler is detected, it means that an operation in your pipeline has\nbeen running for an unusually long time.\n\nTo troubleshoot the issue, first check whether\n[Dataflow insights](/dataflow/docs/guides/using-dataflow-insights)\npinpoints any issues.\n\nIf you still can't determine the cause, check the worker logs for the stage that\nreported the straggler. To see the relevant worker logs, view the\n[straggler details](#view_stragglers_by_stage_progress) in the stage progress.\nThen click the link for the worker. This link opens Cloud Logging, scoped to\nthe worker and the time range when the straggler was detected. Look for problems\nthat might be slowing down the stage, such as:\n\n- Bugs in `DoFn` code or [stuck `DoFns`](/dataflow/docs/guides/common-errors#processing-stuck). Look for stack traces in the logs, near the timestamp when the straggler was detected.\n- Calls to external services that take a long time to complete. To mitigate this issue, [batch calls to external services](/dataflow/docs/tutorials/ecommerce-java#micro-batch-calls) and set timeouts on RPCs.\n- Quota limits in sinks. If your pipeline outputs to a Google Cloud service, you might be able to raise the quota. For more information, see the [Cloud Quotas documentation](/docs/quotas/overview). Also, consult the documentation for the particular service for optimization strategies, as well as the documentation for the [I/O Connector](https://beam.apache.org/documentation/io/connectors/).\n- `DoFns` that perform large read or write operations on persistent state. Consider refactoring your code to perform smaller reads or writes on persistent state.\n\nYou can also use the\n[**Side info**](/dataflow/docs/concepts/execution-details#stage-info)\npanel to find the slowest steps in the stage. One of these steps might be\ncausing the straggler. Click on the step name to view the worker logs for that\nstep.\n\nAfter you determine the cause,\n[update your pipeline](/dataflow/docs/guides/updating-a-pipeline) with new\ncode and monitor the result.\n\nWhat's next\n-----------\n\n- Learn to use the [Dataflow monitoring interface](/dataflow/docs/guides/using-monitoring-intf).\n- Understand the [**Execution details**](/dataflow/docs/concepts/execution-details) tab in the monitoring interface."]]