Port generation method, apparatus, device, and storage medium

CN116962352BActive Publication Date: 2026-08-28CHINA MOBILE FINANCIAL TECHNOLOGY CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210406138.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-18
Publication Date
2026-08-28
Estimated Expiration
2042-04-18

AI Technical Summary

Technical Problem

[0003]本申请实施例提供一种端口生成方法、装置、设备及存储介质,用以解决现有的人工管理端口的方式,端口的生成没有规律,容易造成端口冲突且生成效率低的技术问题

Benefits of technology

[0040]本申请实施例提供的端口生成方法、装置、设备及存储介质,通过场景识别确定目标应用场景对应的端口生成规则,并通过预设的端口规则库获取已有的服务端口,根据已有的服务端口和目标应用场景下的端口生成规则生成目标端口,使得端口的生成具有统一的规范和一定规律,从而确保生成的端口不会与已有端口产生冲突,并且目标端口基于端口规则库中已有的服务端口生成,无需手工进行冲突排查,提高了端口的生成效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116962352B_ABST
    Figure CN116962352B_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field and provides a port generation method, a device, equipment and a storage medium. The method comprises the following steps: obtaining a port generation instruction, and identifying a target application scenario corresponding to the port generation instruction; obtaining an existing service port based on a preset port rule library, and obtaining a corresponding port generation rule according to the target application scenario; and generating a target port according to the existing service port and the port generation rule. The port generation method provided in the application can generate a target port according to an existing service port and a port generation rule under a target application scenario, so that the generation of the port has unified specifications and certain rules, thereby ensuring that the generated port does not conflict with an existing port, and the target port is generated based on the existing service port in the port rule library, manual conflict checking is not needed, and the port generation efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Claims

1. A port generation method, characterized in that, Includes the following steps: Obtain the port generation instruction and identify the target application scenario corresponding to the port generation instruction; The existing service ports are obtained based on a preset port rule base, and the corresponding port generation rules are obtained according to the target application scenario. Generate the target port based on the existing service port and the port generation rules; When the target application scenario includes an application cluster deployment scenario, the step of generating the target port based on the existing service port and the port generation rules includes: Determine the maximum port from the existing service ports; Obtain the list of service ports of each server in the application cluster to be deployed, and add one to the maximum port to generate the first port; The first port is recursively compared with each service port in the service port list to determine whether the first port is occupied. If the first port is occupied, then increment the first port by one to generate a new first port, and return to the step of recursively comparing the first port with each service port in the service port list to determine whether the first port is occupied, until the generated first port is not occupied. If the first port is not occupied, then the first port is set as the target port for deploying the application services in the application cluster to be deployed; When the target application scenario includes an automatic scaling scenario, the step of generating the target port based on the existing service port and the port generation rules includes: The data traffic of the existing service ports is detected, and the optimal threshold corresponding to each existing service port is obtained, wherein the data traffic includes business traffic and user concurrency. If the data traffic of the existing service port exceeds the optimal threshold, a target port for expansion is generated. The step of obtaining the optimal threshold includes: Obtain historical detection data of the data traffic; Based on the data traffic and service performance in the historical detection data, a service inflection point is determined, wherein the service inflection point includes a first inflection point between the business traffic in the data traffic and the service performance, and a second inflection point between the user concurrency in the data traffic and the service performance. By combining the positions of the first inflection point and the second inflection point, the target range points are determined; The distribution of inflection point locations is determined based on the target range points, and the optimal threshold is determined based on the distribution of inflection point locations.

2. The port generation method according to claim 1, characterized in that, When the target application scenario includes a new service scenario, the step of generating the target port based on the existing service port and the port generation rules includes: Determine the maximum service port from the existing service ports; Add one to the maximum service port to generate the target port for deploying the application service to be deployed.

3. The port generation method according to claim 1, characterized in that, When the target application scenario includes a managed scenario, the step of generating the target port based on the existing service port and the port generation rules includes: Determine the maximum port from the existing service ports; Obtain the list of service ports corresponding to the servers of each application cluster, and add one to the maximum port to generate the first port; The first port is recursively compared with each service port in the service port list to determine whether the first port is occupied. If the first port is not occupied, obtain the port configuration file and check whether the first port exists in the port configuration file; If it exists, add one to the first port, regenerate the first port, return and execute the step of detecting whether the first port exists in the port configuration file, until the first port does not exist in the port configuration file; If the first port does not exist in the port configuration file, then the first port is set as the target port for deploying the application service to be deployed.

4. The port generation method according to any one of claims 1 to 3, characterized in that, After the step of generating the target port based on the existing service port and the port generation rule, the method further includes: Save the target port to the port rule base.

5. A port generation device, characterized in that, include: The scene recognition module is used to acquire port generation instructions and identify the target application scene corresponding to the port generation instructions; The rule determination module is used to obtain existing service ports based on a preset port rule base, and to obtain corresponding port generation rules according to the target application scenario; The port generation module is used to generate a target port based on the existing service port and the port generation rules; When the target application scenario includes an application cluster deployment scenario, the port generation module is further configured to: determine the maximum port from the existing service ports; obtain a list of service ports of each server in the application cluster to be deployed, and generate a first port by adding one to the maximum port; The first port is recursively compared with each service port in the service port list to determine whether the first port is occupied. If the first port is occupied, the first port is incremented by one to generate a new first port, and the process of recursively comparing the first port with each service port in the service port list to determine whether the first port is occupied is repeated until the generated first port is not occupied. If the first port is not occupied, then the first port is set as the target port for deploying the application services in the application cluster to be deployed; When the target application scenario includes an automatic scaling scenario, the port generation module is further configured to: detect the data traffic of the existing service ports and obtain the optimal threshold corresponding to each existing service port, wherein the data traffic includes business traffic and user concurrency; if the data traffic of the existing service ports exceeds the optimal threshold, generate a target port for scaling up; When the target application scenario includes an automatic scaling scenario, the port generation module is further configured to: acquire historical detection data of the data traffic; determine service inflection points based on the data traffic and service performance in the historical detection data, wherein the service inflection points include a first inflection point between business traffic and service performance in the data traffic, and a second inflection point between user concurrency in the data traffic and service performance; aggregate the positions of the first inflection point and the second inflection point to determine a target range point; determine the scatter distribution of inflection point positions according to the target range point, and determine an optimal threshold based on the scatter distribution of inflection point positions.

6. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the port generation method according to any one of claims 1 to 4.

7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the port generation method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Jack Server port dynamic matching method and apparatus

    CN107315605A

  • Port distribution method and system based on container

    CN114138464A