หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Data Lake Insight/ FAQs/ SQL Jobs/ SQL Job Development/ How Do I Troubleshoot Slow SQL Jobs?

How Do I Troubleshoot Slow SQL Jobs?

Updated on 2024-11-15 GMT+08:00

If the job runs slowly, perform the following steps to find the causes and rectify the fault:

Possible Cause 1: Full GC

Check whether the problem is caused by FullGC.

  1. Log in to the DLI console. In the navigation pane, choose Job Management > SQL Jobs.
  2. On the SQL Jobs page, locate the row that contains the target job and click More > View Log in the Operation column.
    Figure 1 Viewing logs
  3. Obtain the folder of the archived logs in the OBS directory. The details are as follows:
    • Spark SQL jobs:
      Locate the log folder whose name contains driver or container_ xxx _000001.
      Figure 2 Example folder name
      Figure 3 Example folder name
    • Spark Jar jobs:
      The archive log folder of a Spark Jar job starts with batch.
      Figure 4 Example folder name
  4. Go to the archive log file directory and download the gc.log.* log file.
  5. Open the downloaded gc.log.* log file, search for keyword Full GC, and check whether time records in the file are continuous and Full GC information is recorded repeatedly.
    Figure 5 Full GC logs

Cause locating and solution

Cause 1: There are too many small files in a table.
  1. Log in to the DLI console and go to the SQL editor page. On the SQL Editor page, select the queue and database of the faulty job.
  2. Run the following statement to check the number of files in the table and specify the table name.
    select count(distinct fn)  FROM
    (select input_file_name() as fn from table name) a
  3. If there are too many small files, rectify the fault by referring to How Do I Merge Small Files?.

Cause 2: There is a broadcast table.

  1. Log in to the DLI console. In the navigation pane, choose Job Management > SQL Jobs.
  2. On the SQL Jobs page, locate the row that contains the target job and click to view the job details and obtain the job ID.
    Figure 6 Obtaining the job ID
  3. In the Operation column of the job, click Spark UI.
  4. On the displayed page, choose SQL from the menu bar. Click the hyperlink in the Description column of the row that contains the job ID.
    Figure 7 Clicking the job link
  5. View the DAG of the job to check whether the BroadcastNestedLoopJoin node exists.
    Figure 8 DAG
  6. If the BroadcastNestedLoopJoin node exists, refer to Why Does a SQL Job That Has Join Operations Stay in the Running State? to rectify the fault.

Possible Cause 2: Data Skew

Check whether the problem is caused by data skew.

  1. Log in to the DLI console. In the navigation pane, choose Job Management > SQL Jobs.
  2. On the SQL Jobs page, locate the row that contains the target job and click to view the job details and obtain the job ID.
    Figure 9 Obtaining the job ID
  3. In the Operation column of the job, click Spark UI.
  4. On the displayed page, choose SQL from the menu bar. Click the hyperlink in the Description column of the row that contains the job ID.

  5. View the running status of the current stage in the Active Stage table on the displayed page. Click the hyperlink in the Description column.

  6. View the Launch Time and Duration of each task.
  7. Click Duration to sort tasks. Check whether the overall job duration is prolonged because a task has taken a long time.
    According to Figure 10, when data skew occurs, the data volume of shuffle reads of a task is much greater than that of other tasks.
    Figure 10 Data skew

Cause locating and solution

Shuffle data skew is caused by unbalanced number of key values in join.
  1. Perform group by and count on a join to collect statistics on the number of key values of each join. The following is an example:

    Join table lefttbl and table righttbl. num in the lefttbl table is the key value of the join. You can perform group by and count on lefttbl.num.

    SELECT * FROM lefttbl a LEFT join righttbl b on a.num = b.int2;
    SELECT count(1) as count,num from lefttbl  group by lefttbl.num ORDER BY count desc;
    Figure 11 shows the result. There are much more num parameters whose value are 1 than other values.
    Figure 11 Statistics on num values
  2. Use concat(cast(round(rand() * 999999999) as string) to generate a random number for each key value.
  3. If the skew is serious and random numbers cannot be generated, see How Do I Do When Data Skew Occurs During the Execution of a SQL Job?

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback