Packet forwarding method, apparatus, and system, and computer-readable storage medium
A packet forwarding method, apparatus, and system, and a computer-readable storage medium are disclosed, and pertain to the field of communication technologies. After receiving a packet sent by a second device, a first device determines a target service node based on indication information and an application service identifier that are in the packet, where a service capability of the target service node matches the indication information, and a target application service corresponding to the application service identifier is deployed in the target service node. Then, the first device sends the packet to the target service node. The indication information is carried in the packet sent by the device, so that a forwarding device can send the packet to a service node whose service capability matches the indication information. In this way, differentiated application services are provided for devices of different levels, and flexibility of task scheduling is high.
1 . A packet forwarding method, wherein the method comprises:
receiving, by a first device, a packet sent by a second device, wherein the packet comprises indication information and an application service identifier;
determining, by the first device and based on the indication information and the application service identifier, a target service node, wherein a service capability of the target service node matches the indication information, and a target application service corresponding to the application service identifier is deployed in the target service node; and
responsive to the determining, sending, by the first device, the packet to the target service node,
wherein the method further comprises:
receiving, by the first device, first messages sent by the plurality of service nodes, wherein each of the first messages comprises a computing power resource level of an application service deployed in a corresponding service node of the plurality of service nodes.
2 . The method according to claim 1 , wherein the second device is user equipment, the indication information comprises a user service level corresponding to the second device, and the first device stores correspondences between computing power resource levels and user service levels of application services deployed in a plurality of service nodes; and
the determining, by the first device and based on the indication information and the application service identifier, a target service node comprises:
determining, by the first device as the target service node based on the correspondences, a service node, from the plurality of service nodes, in which the target application service whose computing power resource level matches the user service level corresponding to the second device is deployed.
3 . The method according to claim 1 , wherein the indication information comprises a computing power resource level corresponding to the second device, and the first device stores a computing power resource level of an application service deployed in a plurality of service nodes; and
the determining, by the first device and based on the indication information and the application service identifier, a target service node comprises:
determining, by the first device as the target service node, a service node, from the plurality of service nodes, in which the target application service whose computing power resource level is the same as the computing power resource level corresponding to the second device is deployed.
4 . The method according to claim 1 , wherein each of the first messages is a Border Gateway Protocol (BGP) update message, and the computing power resource level is carried in a path attributes field in the BGP update message.
5 . The method according to claim 1 , wherein
each of the first messages further comprises an application service identifier of the application service deployed in the corresponding service node and an Internet Protocol (IP) address of an instance of the application service deployed in the corresponding service node; or
each of the first messages further comprises an anycast IP address corresponding to the application service deployed in the corresponding service node.
6 . The method according to claim 1 , wherein the indication information comprises computing power resource requirement information of the second device, and the determining, by the first device and based on the indication information and the application service identifier, a target service node comprises:
determining, by the first device as the target service node, a service node in which the target application service whose computing power information meets a requirement indicated by the computing power resource requirement information of the second device is deployed.
7 . The method according to claim 6 , wherein the method further comprises:
receiving, by the first device, a second message sent by the service node, wherein the second message comprises computing power information of an application service deployed in the service node.
8 . The method according to claim 6 , wherein the computing power resource requirement information comprises one or more of a quantity of required computing power resources, maximum allowable computing power resource utilization, or a maximum allowable latency of requested processing; and
the computing power information of the application service comprises one or more of a quantity of computing power resources allocated to the application service, computing power resource utilization of the application service, a request processing latency of the application service, a quantity of device connections of the application service, or a heavy/light load status of the application service.
9 . The method according to claim 1 , wherein the packet further comprises content requested to be processed, and the method further comprises:
receiving, by the first device, a processing result sent by the target service node for the content; and
sending, by the first device, the processing result to the second device.
10 . The method according to claim 1 , wherein the packet is a computing request packet, a go-online request packet, or a storage request packet.
11 . The method according to claim 1 , wherein the packet is an IPv6 packet, and the indication information is carried in a hop by hop extension header or a segment routing header of the IPv6 packet.
12 . A packet forwarding method, wherein the method comprises:
generating, by a service node, a first message, wherein the first message comprises a computing power resource level of an application service deployed in the service node; and
sending, by the service node, the first message to a first device,
wherein
each of the first messages further comprises an application service identifier of the application service deployed in the corresponding service node and an Internet Protocol (IP) address of an instance of the application service deployed in the corresponding service node, or
each of the first messages further comprises an anycast IP address corresponding to the application service deployed in the corresponding service node.
13 . The method according to claim 12 , wherein the first message is a border gateway protocol (BGP) update message, and the computing power resource level is carried in a path attributes field in the BGP update message.
14 . A packet forwarding apparatus, applied to a first device, wherein the apparatus comprises:
at least one processor; and
one or more memories coupled to the at least one processor and configured to store instructions for execution by the at least one processor, the instructions, when executed by the at least one processor, cause the apparatus to:
receive a packet sent by a second device, wherein the packet comprises indication information and an application service identifier;
determine a target service node based on the indication information and the application service identifier, wherein a service capability of the target service node matches the indication information, and a target application service corresponding to the application service identifier is deployed in the target service node; and
send the packet to the target service node,
wherein the instructions, when executed by the at least one processor, further cause the apparatus to:
receive a first message sent by any service node in the plurality of service nodes, wherein the first message comprises a computing power resource level of an application service deployed in the any service node.
15 . The apparatus according to claim 14 , wherein the second device is user equipment, the indication information comprises a user service level corresponding to the second device, and the apparatus stores correspondences between computing power resource levels and user service levels of application services deployed in a plurality of service nodes; and
the at least one processor is configured to determine, as the target service node based on the correspondences, a service node in which the target application service whose computing power resource level matches the user service level corresponding to the second device is deployed.
16 . The apparatus according to claim 14 , wherein the indication information comprises a computing power resource level corresponding to the second device, and the apparatus stores a computing power resource level of an application service deployed in a plurality of service nodes; and wherein the instructions, when executed by the at least one processor, cause the apparatus to:
determine, as the target service node, a service node in which the target application service whose computing power resource level is the same as the computing power resource level corresponding to the second device is deployed.
17 . The apparatus according to claim 14 , wherein the first message is a Border Gateway Protocol (BGP) update message, and the computing power resource level is carried in a path attributes field in the BGP update message.
18 . The apparatus according to claim 14 , wherein
the first message further comprises an application service identifier of the application service deployed in the any service node and an Internet Protocol (IP) address of an instance of the application service deployed in the any service node; or
the first message further comprises an anycast IP address corresponding to the application service deployed in the any service node.