Design method of asynchronous edge scheduling simulator
By designing an asynchronous edge scheduling simulation simulator, the problem of existing simulators ignoring asynchronous scheduling details is solved, and more realistic and general edge computing simulation is realized, supporting asynchronous scheduling processes is enhanced, and the transmission and processing authenticity of tasks and resources is enhanced. Simplifies data transmission and reception concurrency of user equipment.
Patent Information
- Application Number
- CN202411161020.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-11-29
AI Technical Summary
The existing edge computing simulator mainly supports synchronous scheduling, ignoring the details of network latency, resource synchronization, task delivery and device interaction in the asynchronous scheduling process, resulting in the lack of authenticity of the simulation and the inability to effectively evaluate the performance of the task offload strategy.
A asynchronous edge scheduling simulation simulator was designed. Through the C++23 programming language, heterogeneous equipment and network modeling, device mobile model, task and resource packet unpacking, and asynchronous concurrent are designed in steps to realize asynchronous network communication. Interact with resources, the simulation is more in line with the real scenario.
It improves the authenticity and universality of the simulation, supports asynchronous scheduling processes, enhances the authenticity of transmission and processing of tasks and resources, simplifies the concurrency method of data transmission and reception of user equipment, and reduces the difficulty of use.
Smart Images

Figure CN119052243A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of edge computing, and in particular to a simulation technology of asynchronous edge scheduling in this field. Background Art
[0002] The Internet of Things is developing rapidly, and the number of devices is increasing day by day. The data is as numerous as the stars in the sky, and it is difficult to count. Traditional cloud computing has limited bandwidth and performance concerns. It is no longer able to efficiently process the massive amount of data, so edge computing came into being. By transferring data processing from cloud servers to edge devices closer to the data source, edge computing can achieve the design goals of low latency and high performance. Task offloading is the core technology in edge computing. The quality of the offloading algorithm directly determines the time it takes to process data. A good offloading strategy can reasonably allocate edge server resources, maximize resource utilization, and improve system performance. However, when designing a task offloading strategy, many different types of edge devices are often required. Edge devices are expensive, and ordinary researchers cannot afford such a huge cost, so there is a demand for edge computing simulators. By simulating heterogeneous devices, network communications, mobility, dynamic tasks, and offloading processes, the simulation simulator solves the difficult problems of edge research environments at a low cost and efficiently, allowing researchers to quickly establish various edge scenarios, accurately control experimental parameters, quickly iterate experimental ideas, and simply reproduce experimental scenarios, so that the performance of task offloading strategies can be comprehensively evaluated.
[0003] In the past decade, a number of edge computing simulators have been born, such as EdgeCloudSim, iFogSim, iFogSim2, PureEdgeSim, MobFogSim, IOTSim-Edge, YAFS, EdgeSimPy, EdgeAISim, etc. They can meet common simulation requirements such as network modeling, mobility modeling, scenario construction, task generation, resource monitoring, etc., enabling researchers to quickly build edge computing scenarios and write task offloading algorithms. However, almost all existing edge computing simulators only support synchronous scheduling of edge offloading processes, which is inconsistent with the asynchronous scheduling process in reality, and ignore many detailed factors in edge simulation, such as network delay, resource synchronization, task delivery, device interaction, etc. These factors will affect the total delay of task distribution execution. If ignored, not only will the authenticity of edge scheduling be lost, but also many problems that will arise in real situations will be hidden. For example, EdgeAISim is one of the latest edge computing simulators. It further expands the support for reinforcement learning offloading algorithms based on EdgeSimPy. However, it only uses a simple callback function to control the synchronization scheduling process. Devices do not really use socket network communication to interact, which means that tasks are not really transmitted through the network. In reality, edge devices are placed in different locations and must establish communication connections through the network to transmit tasks and process results. Therefore, it avoids network packet loss, data synchronization, data packaging, data analysis and other problems, and the simulation lacks a certain degree of authenticity.
[0004] Compared with synchronous edge scheduling, asynchronous edge scheduling does not directly transfer data objects, but actually establishes network communication with sockets, transmits serialized data through the network, and then performs deserialization and parsing operations after receiving it. In this scenario, each edge device will be assigned a unique IP address, which may be in different network segments. Network communication itself is asynchronous, and the scheduling mechanism allows control of asynchronous communication processes to achieve real-time interaction between different types of devices. Device resources will also be consumed and released in the asynchronous scheduling scenario, that is, when they are consumed and when they are released will be unpredictable, and only the device itself can be truly determined when it releases resources. At the same time, the scheduler will also face the problem of resource synchronization, and resource conflicts may increase the waiting time for task processing. All of these are more in line with edge computing behaviors in real scenarios, and are also functions that an edge computing simulator should have. Summary of the invention
[0005] This paper mainly aims at the needs of asynchronous edge scheduling simulation and proposes a design method for an asynchronous edge scheduling simulation simulator. We use C++23 as the programming language and divide the core functions of the asynchronous edge scheduling simulation simulator into the following steps for design:
[0006] Step 1: Design and implement heterogeneous device and network modeling, and build a network scheduler;
[0007] Step 2: After the heterogeneous devices in step 1 are built and have network communication and network scheduling capabilities, design and implement the device mobility model;
[0008] Step 3: After the heterogeneous devices in step 2 are built and have network communication and mobility capabilities, design and implement tasks and device resources, and then build a data packet unpacker;
[0009] Step 4: Based on step 3, design and implement an asynchronous concurrent device using coroutines to enable the user device to have asynchronous sending and receiving capabilities;
[0010] This design method models heterogeneous devices and networks in edge computing scenarios, and establishes a scheduler for network communication to allow device interaction. It then models tasks and resources, encapsulates network data with a data packetizer, parses and regenerates the received data objects with a data unpacker, and defines the sending and receiving behaviors of user devices with an asynchronous concurrent device. Finally, basic interaction instructions are defined to meet common device interaction behaviors.
[0011] Specifically, the above steps include the following subdivisions.
[0012] Step 1 specifically includes the following:
[0013] First, the asynchronous devices in the edge environment are divided into user devices, base stations, edge servers, and cloud servers. The ClientDevice class represents the user device, the BaseStation class represents the base station, the EdgeServer class represents the edge server, and the CloudServer class represents the cloud server. Secondly, the network model is represented by the NetworkModel concept. All network model customization classes must implement the NetworkInitializer interface and enable the network model customization class by specializing the EnableNetworkModel variable template. The network model can build different edge scenarios, and all heterogeneous devices will be used as its parameters. After the network is initialized, each device will be assigned a unique IP address. Finally, the Deletegate class represents delegate distribution, and the NetworkHandler class represents the network scheduler. Delegate distribution is used to dispatch different types of data requests to the corresponding logical units. The network scheduler uses it to distribute the received network requests. Each network data carries a data type flag. The network scheduler implements logical dispatch by obtaining this flag. The specific data type and logical unit mapping relationship is specified by the SetHandler interface of the network scheduler. The interface accepts two parameters. The first parameter is the data type, and the second parameter is the callable body (representing the logical unit). The network scheduler parses the type of the received data through the GetDataType built-in function.
[0014] Step 2 specifically includes the following:
[0015] The Mobility class represents the mobility of the device and provides two interfaces: Install and SetPosition. The former is used to install the mobility model for the device, and the latter is used to change the current position of the device. The mobility model is provided by the NS-3 discrete network model library and is divided into two types: one is the built-in mobility model, and the other is the mobility trajectory information imported from the SUMO traffic simulator. Heterogeneous devices can use the mobility model device position only after they have network communication capabilities. Changes in the device position will affect the propagation time of heterogeneous tasks.
[0016] Step 3 specifically includes the following:
[0017] In the first part, the Task class is used to represent tasks, and the Resource class is used to represent device resources. In an asynchronous edge scheduling environment, tasks and resources need to be transmitted through the network, and the network can only transmit byte data. Therefore, tasks and resources must be able to be converted into byte data and restored from byte data. Tasks and resources often contain many different attributes. The number and name of these attributes are uncertain and dynamic. The attributes must be set dynamically. JSON structured data is used to represent these attributes during design. The advantage is that the attributes of the class are no longer fixed, can be dynamically added and updated, and are easy to serialize and deserialize, which is convenient for network transmission and parsing. In the second part, DataStream is used to represent the data stream transmitted via the network. The tasks and resources in step 4 are adapted so that they can be constructed into data streams to be transmitted in the network and successfully parsed and distributed by the network scheduler. DataStream can be constructed directly from strings, or from tasks, resources and other specialized types. The data type is specified and obtained through the SetType and GetType member functions. The task and resource objects can be retrieved through the GetTask and GetResource member functions. Thus, data can be packaged and parsed, and all devices have the ability to communicate and interact.
[0018] Step 4 specifically includes the following:
[0019] Provide Awaitable and ResponseAwaiter classes to implement asynchronous concurrency, and provide a coroutine concurrency mode for user devices to send and receive data. When user devices send and receive data, especially when receiving data, they need to process the processing results. If traditional callback functions are used, many necessary external parameters may need to be captured, but coroutines can avoid this problem, and the logic of the asynchronous process is clearer.
[0020] The advantages of the present invention are:
[0021] (1) The present invention proposes and constructs an asynchronous edge scheduling mechanism, which avoids the problem that existing edge computing simulators only support synchronous simulation, making the simulation more in line with reality, more realistic and universal;
[0022] (2) The present invention designs and implements dynamic task resource attributes and constructs a data packet unpacker, so that tasks and resources can be transmitted and reconstructed through the network, making data more customizable and the transmission process more realistic;
[0023] (3) The present invention designs and constructs a network scheduler and an asynchronous concurrent device. The former enables heterogeneous devices to interact with each other, and the latter simplifies the concurrent mode of sending and receiving data by user devices. The asynchronous simulation process is more controllable and reduces the difficulty of use. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a heterogeneous device and network model.
[0025] Figure 2 It is a mobile model.
[0026] Figure 3 It is a network modeler and network scheduler.
[0027] Figure 4 Are dynamic tasks and resources.
[0028] Figure 5 It is an asynchronous concurrent processor.
[0029] Figure 6 It is an asynchronous transmission process. DETAILED DESCRIPTION
[0030] The following is combined with Figure 1-6 Specific embodiments of the present invention are described in detail.
[0031] The present invention is a design method for an asynchronous edge scheduling simulation simulator. The specific implementation steps are as follows:
[0032] S1: Design and implement heterogeneous devices and network models. After the devices have communication capabilities, build a network scheduler to enable the devices to interact.
[0033] S2: After the strategy in step S1 is proposed, a device mobility model is designed and implemented to give the device location and mobility capabilities;
[0034] S3: After the strategy in step S2 is proposed, the tasks and device resources are designed and implemented, and then a data packet unpacker is constructed to enable the task and resource information to be asynchronously transmitted and restored over the network;
[0035] S4: After the strategy in step S3 is proposed, an asynchronous concurrent controller is designed and implemented using coroutines to enable user devices to send and receive data asynchronously;
[0036] In order to further optimize the implementation effect of the present invention, in step S1, a heterogeneous device and network model is designed and implemented, and a network scheduler is constructed. S1 specifically includes the following steps:
[0037] S1.1: Divide the heterogeneous devices in the edge environment into four basic types: user devices, base stations, edge servers, and cloud servers. The ClientDevice class represents user devices, the BaseStation class represents base stations, the EdgeServer class represents edge servers, and the CloudServer class represents cloud servers.
[0038] S1.2: connecting the base station and the edge server, that is, each base station includes a group of edge servers, so that the base station acts as a gateway to connect the user equipment and the edge server;
[0039] S1.3: The network model is represented by the NetworkModel concept. The network model is used to constrain the network model custom class so that it must implement the NetworkInitializer interface and specialize the EnableNetworkModel variable template;
[0040] S1.4: Construct the default network model CloudEdgeEndNetworkModel class, implement the NetworkInitializer interface, accept the three object parameters of user equipment, base station and cloud server, assign IP addresses to various devices, user equipment is in a network segment, edge server is in a network segment, base station and cloud server also belong to a network segment respectively, user equipment and base station form a WLAN, edge server form a LAN, base station and edge server use P2P communication, base station and cloud server use optical fiber communication;
[0041] like Figure 1 As shown in the figure, heterogeneous devices are divided into user layer, edge layer and cloud layer. The user layer includes user devices, the edge layer includes base stations and edge servers, and the cloud layer includes cloud servers. At the same time, when there are multiple devices, each device type has a corresponding container version. A large number of devices can be directly built, and the CloudEdgeEndNetworkModel can be used to install networks and assign IP addresses to all devices.
[0042] S1.5: Construct a Delegate class, using strings as identifiers and callback functions as logical units, with one-to-one mapping. The delegate class provides Insert, Remove, and Find interfaces for adding, deleting, and finding the mapping between identifiers and logical units.
[0043] S1.6: Build the NetworkHandler class, based on the Delegate class, and implement the AddHandler and Dispatch interfaces. The former is used to add mappings between data types and processors, and the latter is used for identifier distribution.
[0044] S1.7: Whenever the network receives a data request, it retrieves the identifier information through the data parser provided in step S3.5 and distributes the logic through the Dispatch interface of NetworkHandler;
[0045] S1.8: Provides commonly used identifier types such as ResourceChanged, Response, Handling, Dispatching, GetResourceInformation, and Decision to avoid errors caused by repeated manual input by users, and automatically updates the resource information cached in the ResourceCache resource table when device resources change;
[0046] like Figure 2 As shown, the network processor is implemented through the Delegate class, which can add a mapping between the identifier and the processing unit, and then distribute the logic through the Dispatch function. When the network application class NetworkApplication receives data, it uses NetworkHandler internally to distribute and process the logic, and uses DataStream to parse and identify the data.
[0047] Based on the further design of the heterogeneous devices, network model and network scheduler in step S1, S2 specifically includes the following steps:
[0048] S2.1: Build the Mobility base class to represent the mobile model, use CRTP technology to implement static polymorphism, and include two interfaces: Install and SetPosition. The Install interface is divided into two overload forms, one of which is customized by the user, and the other is imported from the SUMO library to import the mobile trajectory of the Internet of Vehicles. The SetPosition interface has three overload forms, which are used to set the position of the user device, base station, and cloud server respectively.
[0049] S2.2: Build the ApStaMobility custom class to set the mobility for the devices in the WLAN scenario. The base station is used as the AP node and adopts a static position (i.e., fixed position). The user equipment is used as the STA node and is 10 to 30 meters away from the base station and moves 1 to 2 meters per second.
[0050] S2.3: Install ApStaMobility to enable user devices, base stations, and cloud servers to have three-dimensional location coordinates and mobility attributes.
[0051] like Figure 3 As shown, the device is installed and the mobility function is set through the mobility model. The mobility model can be imported from the SUMO vehicle movement trajectory file, or other mobility modes can be customized through the static polymorphic specialized mobility model. For example, ApStaMobility is a random mobility model in the WLAN scenario.
[0052] After the device mobility modeling is completed, the resource data is further constructed. S3 specifically includes the following steps:
[0053] S3.1: Build the task class Task, which is divided into two parts: Header and Body. The former contains the attribute header of the task, such as size, tolerance delay, required resources and other information, and the latter contains the actual instructions of the task. Then add GetHeader and GetBody member functions to the Task class to obtain header information and execute instructions. Then add Load and Save member functions to load tasks from files or save tasks to files.
[0054] S3.3: Construct a resource class Resource, which only needs to include information representing resource attributes, such as CPU capability, memory size, etc., and then add a GetValue member function to the Resource class to obtain resource information, and then add an Install member function to install resources on the device. Finally, add a monitor to record resource changes at any time;
[0055] like Figure 4 As shown in the figure, the task is divided into two parts: the task header and the task body. The task header can contain many customized attributes, such as unique identifier, task size, CPU requirement, memory requirement, tolerance delay, creation time, completion time, source IP address, etc. These attributes have no quantity and name restrictions and can be freely expanded. The task body contains the instruction set, which can be empty during simulation. Similarly, resources are also dynamically customizable and can contain various attributes, such as CPU instruction cycles, memory size, resource price, etc.
[0056] S3.4: Build the DataStream data stream class and provide conversion interfaces for Task and Resource to enable flexible conversion between the two.
[0057] S3.5: Provide Type member functions for DataStream to set and get data identifiers for use by the NetworkHandler in step S1.7;
[0058] After all core modules are built, the asynchronous concurrent device is built. S4 specifically includes the following steps:
[0059] S4.1: Construct an Awaitable class, which never suspends the coroutine at the beginning and always suspends at the end, so that users can create coroutine functions;
[0060] S4.2: Construct the ResponseAwaiter class, which will save the IP address of each user device and notify the user device when it receives the response result. When the coroutine is resumed, it will return the processing result.
[0061] S4.3: Use ResponseAwaiter to implement the AsyncRead asynchronous reading interface of ClientDevice. When the processing result is received, the corresponding coroutine is restored according to the source IP address in the response result.
[0062] like Figure 5 As shown in the figure, the user device can send and receive data asynchronously. ResponseAwaiter is used to implement asynchronous concurrency. When the task processing is completed, the user can be automatically notified to avoid thread blocking. The user implements the coroutine function through Awaitable. As long as it is used as the return value of the function, the coroutine management asynchronous process can take effect, which is very convenient.
[0063] like Figure 6 As shown, the user device generates a task and decides whether to offload the task to a remote end for execution based on its own resources. When resources are insufficient, the task is passed to the base station through the decision data identifier (Decision). The base station saves the task to the task list, then retrieves the task from the task list, and uses the information in the task header to obtain the offloading target using the decision engine. If the target address is an edge server, the task body is passed over for processing through the processing data identifier (Handling). When the edge server processes the task, the resources change, and the decision engine is notified to update the resources. When the processing is completed, the processing result is returned to the base station through the response data identifier (Response), and the decision engine is notified to update the resources. If the target address is a cloud server, it indicates that no edge server can process the task, so the task body is passed to the cloud server for execution through the processing data identifier (Handling). After the processing is completed, the result is returned with the response data identifier (Response).
[0064] In summary, the present invention proposes a design method for an asynchronous edge scheduling simulation simulator. By constructing heterogeneous devices, modeling the device network, assigning IP addresses, and then modeling mobility, the devices are given mobility, and a network scheduler is designed and implemented to enable asynchronous interaction between devices. Dynamic tasks and resources are then constructed, and data packet unpackers are designed to enable tasks and resources to be transmitted and reconstructed in the network. Finally, an asynchronous concurrent device is constructed to enable user devices to control the sending and receiving of data with coroutines, plus some built-in identifiers and processing logic, which improves the security and reusability of the code. The edge computing simulator designed using this method can realize asynchronous scheduling processes, the simulation is more realistic, and the results are more in line with reality.
[0065] Regarding the specific implementation of the present invention, it should be pointed out that for ordinary technicians in this field, several variations and improvements can be made without departing from the creative concept of the present invention, which all belong to the protection scope of the present invention.
Claims
1. A design method based on an asynchronous edge scheduling simulation simulator, characterized in that: The specific steps include: S1: Design and implement heterogeneous devices and network models. After the devices have communication capabilities, build a network scheduler to enable the devices to interact. S2: After the strategy in step S1 is proposed, design and implement the device mobility model to give the device location and mobility capabilities; S3: After the strategy in step S2 is proposed, the tasks and device resources are designed and implemented, and then a data packet unpacker is constructed to enable the task and resource information to be asynchronously transmitted and restored over the network; S4: After the strategy in step S3 is proposed, an asynchronous concurrent device is designed and implemented using coroutines to enable user devices to send and receive data asynchronously.
2. The method according to claim 1, characterized in that The step S1 specifically includes the following steps: S1.1: Divide the heterogeneous devices in the edge environment into four basic types: user devices, base stations, edge servers, and cloud servers. The ClientDevice class represents user devices, the BaseStation class represents base stations, the EdgeServer class represents edge servers, and the CloudServer class represents cloud servers. S1.2: connecting the base station and the edge server, that is, each base station includes a group of edge servers, so that the base station acts as a gateway to connect the user equipment and the edge server; S1.3: The network model is represented by the NetworkModel concept. The network model is used to constrain the network model custom class so that it must implement the NetworkInitializer interface and specialize the EnableNetworkModel variable template; S1.4: Construct the default network model CloudEdgeEndNetworkModel class, implement the NetworkInitializer interface, accept the three object parameters of user equipment, base station and cloud server, assign IP addresses to various devices, user equipment is in a network segment, edge server is in a network segment, base station and cloud server also belong to a network segment respectively, user equipment and base station form a WLAN, edge server form a LAN, base station and edge server use P2P communication, base station and cloud server use optical fiber communication; S1.5: Construct a Delegate class, using strings as identifiers and callback functions as logical units, with one-to-one mapping. The delegate class provides Insert, Remove, and Find interfaces for adding, deleting, and finding the mapping between identifiers and logical units. S1.6: Build the NetworkHandler class, based on the Delegate class, and implement the AddHandler and Dispatch interfaces. The former is used to add mappings between data types and processors, and the latter is used for identifier distribution. S1.7: Whenever the network receives a data request, it retrieves the identifier information through the data parser provided in step S3.5 and distributes the logic through the Dispatch interface of NetworkHandler; S1.8: Provides commonly used identifier types such as ResourceChanged, Response, Handling, Dispatching, GetResourceInformation, and Decision to avoid errors caused by repeated manual input by users, and automatically updates the resource information cached in the ResourceCache resource table when device resources change.
3. The method according to claim 1, characterized in that The step S2 specifically includes the following steps: S2.1: Build the Mobility base class to represent the mobile model, use CRTP technology to implement static polymorphism, and include two interfaces: Install and SetPosition. The Install interface is divided into two overload forms, one of which is customized by the user, and the other is imported from the SUMO library to import the mobile trajectory of the Internet of Vehicles. The SetPosition interface has three overload forms, which are used to set the position of the user device, base station, and cloud server respectively. S2.2: Build the ApStaMobility custom class to set the mobility for the devices in the WLAN scenario. The base station is used as the AP node and adopts a static position (i.e., fixed position). The user equipment is used as the STA node and is 10 to 30 meters away from the base station and moves 1 to 2 meters per second. S2.3: Install ApStaMobility to enable user devices, base stations, and cloud servers to have three-dimensional location coordinates and mobility attributes.
4. The method according to claim 1, characterized in that: The step S3 specifically comprises the following steps: S3.1: Build the task class Task, which is divided into two parts: Header and Body. The former contains the attribute header of the task, such as size, tolerance delay, required resources and other information, and the latter contains the actual instructions of the task. Then add GetHeader and GetBody member functions to the Task class to obtain header information and execute instructions. Then add Load and Save member functions to load tasks from files or save tasks to files. S3.2: Construct a resource class Resource, which only needs to contain information representing resource attributes, such as CPU capability, memory size, etc., and then add a GetValue member function to the Resource class to obtain resource information, and then add an Install member function to install resources on the device. Finally, add a monitor to record resource changes at any time; S3.3: Build the DataStream data stream class and provide conversion interfaces for Task and Resource to enable flexible conversion between the two. S3.4: Provide Type member functions for DataStream to set and get data identifiers for use by the NetworkHandler in step S1.
7.
5. The method according to claim 1, characterized in that The step S4 specifically comprises the following steps: S4.1: Build the Awaitable class, which never suspends the coroutine at the beginning and always suspends at the end, so that users can create coroutine functions; S4.2: Construct the ResponseAwaiter class, which will save the IP address of each user device and notify the user device when it receives the response result. When the coroutine is resumed, it will return the processing result. S4.3: Use ResponseAwaiter to implement the AsyncRead asynchronous reading interface of ClientDevice. When the processing result is received, the corresponding coroutine is restored according to the source IP address in the response result.
