هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.

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
On this page

Designing a Direction Acyclic Graph (DAG)

Updated on 2022-06-01 GMT+08:00

Scenario

Proper application design improves the execution efficiency. Reduce shuffle operations if possible during programming and combine narrow dependency operations.

Procedure

The following example describes how to determine whether two vehicles are peers to show the DAG design principles.

  • Data format: Time when a vehicle passes a toll station, license plate number, and toll station number...
  • Logic: Two vehicles are considered as peers if they meet the following conditions:
    • Both vehicles pass the same toll stations in the same sequence.
    • The difference between the time that the vehicles pass the same toll station is smaller than a specified value.

There are two implementation modes for this example. Figure 1 shows logic of implementation mode 1 and Figure 2 shows logic of implementation mode 2.

Figure 1 Logic of implementation mode 1

Logic description:

  1. Based on the license template number, aggregate and sequence all toll stations that a vehicle passes. The following data is obtained after processing:

    License plate No.1, [(pass time, toll station 3), (pass time, toll station 2), (pass time, toll station 4), (pass time, toll station 5)]

  2. Identify the sequence number of the toll stations passed by the vehicle.

    (Toll station 3, (License plate No.1, pass time, first toll station))

    (Toll station 2, (License plate No.1, pass time, second toll station))

    (Toll station 4, (License plate No.1, pass time, third toll station))

    (Toll station 5, (License plate No.1, pass time, fourth toll station))

  3. Aggregate data based on the toll stations.

    Toll station 1, [(License plate No.1, pass time, first toll station), (License plate No.2, pass time, fifth toll station), (License plate No.3, pass time, second toll station)]

  4. Checks whether the difference between the time that two vehicles pass a toll station is within the range specified for determining peers. If the time difference is smaller than the specified value, collect information about the two vehicles.

    (License plate No.1, License plate No.2), (first toll station, fifth toll station)

    (License plate No.1, License plate No.3), (first toll station, second toll station)

  5. Aggregate information data about two vehicles that pass the same toll stations based on their license template number.

    (License plate No.1, License plate No.2), [(first toll station, fifth toll station), (second toll station, sixth toll station), (first toll station, seventh toll station), (third toll station, eighth toll station)]

  6. If the vehicles with license plate No.1 and No.2 pass the same toll stations in sequence, (for example, toll stations 3, 4, and 5 are the first, second, and third ones passed by vehicle 1, and the sixth, seventh, and eighth ones passed by vehicle 2), and the number of passed toll stations reaches the specified value, the two vehicles are considered as peers.

Disadvantages of implementation mode 1:

  • The logic is complex.
  • A large number of shuffle operations are performed, deteriorating performance.
Figure 2 Logic of implementation mode 2

Logic description:

  1. Based on the license template number, aggregate and sequence all toll stations that a vehicle passes. The following data is obtained after processing:

    License plate No.1, [(pass time, toll station 3), (pass time, toll station 2), (pass time, toll station 4), (pass time, toll station 5)]

  2. Based on the number of toll stations required for determining peers (3 toll stations in this example), segment the sequence of toll stations passed by a vehicle. For example, the preceding information is segmented into the following:

    Toll station 3 > Toll station 2 > Toll station 4, (License plate No.1, [pass time at toll station 3, pass time at toll station 2, pass time at toll station 4])

    Toll station 2 > Toll station 4 > Toll station 5, (License plate No.1, [pass time at toll station 2, pass time at toll station 4, pass time at toll station 5])

  3. Aggregate information about vehicles that pass the same toll stations in the same sequence.

    Toll station 3 > Toll station 2 > Toll station 4, [(License plate No.1, [pass time at toll station 3, pass time at toll station 2, pass time at toll station 4]), (License plate No.2, [pass time at toll station 3, pass time at toll station 2, pass time at toll station 4]), (License plate No.3, [pass time at toll station 3, pass time at toll station 2, pass time at toll station 4])]

  4. Determine whether the time difference that these vehicles passed through the same toll station is smaller than the specified value. If yes, the vehicles are determined to be peers.

Advantages of implementation mode 2:

  • The logic is simplified.
  • A groupByKey is removed, that is, a shuffle operation is deducted. This improves performance.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback