Version management method and device, equipment and storage medium
By receiving client requests and determining the API version according to the policy, the problem of incompatibility between API versions is solved, achieving smooth transition and stability, and improving user experience and system maintainability.
Patent Information
- Application Number
- CN202410742615.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-13
AI Technical Summary
There are incompatibilities between different API versions. Especially when introducing new functions or modifying existing functions, it is difficult to ensure a smooth transition between the old and new versions, which can easily affect existing clients.
By receiving the client's access request, the target version is determined based on the preset request-oriented strategy, the API server is called and the number of services is recorded. If the service traffic of the new version is greater than the preset threshold, the old version and its service data are eliminated, and a smooth upgrade strategy is introduced. , so that client access requests are slowly directed to the new version, supporting the coexistence of old and new versions.
It realizes intelligent and progressive management of API versions, reduces the impact of version switching on the client or system, ensures system stability, and improves user experience and maintainability of the version iteration process.
Smart Images

Figure CN118642773A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a version management method, apparatus, device and storage medium. Background Art
[0002] At present, with the continuous development of science and technology and user needs, systems or servers and other equipment need to continuously adjust and upgrade API versions to adapt to changes in market demand. However, there may be incompatibilities between different API versions. Especially when introducing new functions or modifying existing functions, it is difficult to ensure a smooth transition between the old and new versions, which can easily affect existing clients. Summary of the invention
[0003] In view of this, in order to address the deficiencies in the prior art, the present application provides a version management method, apparatus, device and storage medium.
[0004] In a first aspect, the present application provides a version management method, comprising:
[0005] receiving a first access request from a client;
[0006] Based on a preset request steering strategy, determine a target version for serving the first access request, the target version being a new version or an old version of the API version;
[0007] Calling the API server and using the target version to execute the first access request, and recording the service times of the target version, and using the service times as the service traffic of the target version;
[0008] The service traffic of the new version is counted periodically, and if the service traffic is greater than a preset traffic threshold, the old version and its service data are removed.
[0009] In an optional implementation manner, determining a target version for serving the first access request based on a preset request steering strategy includes:
[0010] Obtaining request parameter information carried by the first access request and basic information data of the client; wherein the request parameter information includes a request header and request parameters; and the basic information data includes device attributes, network speed, and operating system;
[0011] In combination with the request parameter information and the basic information data, a target version for serving the first access request is comprehensively determined.
[0012] In an optional implementation manner, the step of combining the request parameter information and the basic information data to comprehensively determine a target version for serving the first access request includes:
[0013] Based on a preset request-oriented strategy, API version matching is performed on each element included in the request parameter information and the basic information data;
[0014] Counting the number of elements in the request parameter information and the basic information data that match the same API version respectively;
[0015] If the number of elements is greater than a preset number threshold, the corresponding API version is determined to be the target version.
[0016] In an optional implementation manner, determining a target version for serving the first access request based on a preset request steering strategy includes:
[0017] Obtaining request parameter information carried in the first access request and basic information data of the client;
[0018] Based on a preset version-oriented ratio, the request parameter information, and the basic information data, a target version for serving the first access request is comprehensively determined.
[0019] In an optional implementation manner, the comprehensively determining a target version for serving the first access request based on a preset version-oriented ratio, the request parameter information, and the basic information data includes:
[0020] Get the service count of a single API version and the total service count of all API versions;
[0021] Based on a preset request-oriented strategy, API version matching is performed on each element included in the request parameter information and the basic information data;
[0022] Counting the number of elements in the request parameter information and the basic information data that match the same API version respectively;
[0023] If the number of elements is greater than a preset number threshold, then the ratio of the service times of the corresponding API version to the total service times is calculated;
[0024] If the ratio value is less than the version-oriented ratio, the corresponding API version is used as the target version.
[0025] In an optional implementation manner, before receiving the first access request from the client, the method further includes:
[0026] Intercept API requests from clients to obtain basic information data of the clients;
[0027] Analyzing the version adaptability of the client according to the basic information data;
[0028] Record and store the basic information data and version adaptability of the client; the basic information data and the version adaptability are used to match the target version serving the first access request initiated by the client.
[0029] In an optional implementation manner, after determining the target version for serving the first access request based on the preset request steering strategy, the method further includes:
[0030] Feedback version matching information to the client; the version matching information is used to instruct the client to initiate a second access request using the target version corresponding to the version matching information, and the second access request is used to indicate that the API version serving the second access request is the target version.
[0031] In a second aspect, the present application provides a version management device, including:
[0032] A receiving module, configured to receive a first access request from a client;
[0033] A determination module, configured to determine a target version for servicing the first access request based on a preset request steering strategy, wherein the target version is a new version or an old version of the API version;
[0034] an execution module, configured to call the API server and use the target version to execute the first access request, and record the service times of the target version, and use the service times as the service traffic of the target version;
[0035] The statistics module is used to periodically count the service traffic of the new version. If the service traffic is greater than a preset traffic threshold, the old version and its service data are removed.
[0036] In a third aspect, the present application provides a computer device, comprising a memory and at least one processor, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the aforementioned version management method.
[0037] In a fourth aspect, the present application provides a computer storage medium storing a computer program, which, when executed, implements the version management method described above.
[0038] The embodiments of the present application have the following beneficial effects:
[0039] The embodiment of the present application provides a version management method, which includes: receiving a first access request from a client; determining a target version for serving the first access request based on a preset request-directing strategy, the target version being a new version or an old version in the API version; calling an API server and using the target version to execute the first access request, and recording the service times of the target version, using the service times as the service traffic of the target version; periodically counting the service traffic of the new version, and if the service traffic is greater than a preset traffic threshold, removing the old version and its service data. This embodiment can intelligently select a suitable API version for executing the access request initiated by the client according to the characteristics and capabilities of the client; in addition, when the version is upgraded, a smooth upgrade strategy is introduced, which can match the corresponding new and old versions for the client's access request, and then during the coexistence of the new and old versions, the client's access request is slowly directed to the new version for execution, allowing the new and old versions to be supported simultaneously for a period of time, making the version switching process smoother, reducing the impact on the client or system operation, ensuring the stability of the system, and avoiding the one-time rapid switching of the new version resulting in version incompatibility, thereby causing problems such as client or system operation failure. This embodiment manages API versions and performs version evolution in an intelligent and progressive manner, thereby improving system stability, improving user experience, and improving maintainability during system version iteration. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.
[0041] Figure 1 A first flow chart of the version management method in an embodiment of the present application is shown;
[0042] Figure 2 A second flow chart of the version management method in the embodiment of the present application is shown;
[0043] Figure 3 A third flow chart of the version management method in the embodiment of the present application is shown;
[0044] Figure 4 The fourth flow chart of the version management method in the embodiment of the present application is shown;
[0045] Figure 5 A structural diagram of a version management device in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0046] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0047] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0048] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.
[0049] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0050] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0051] The present application provides a version management method. This embodiment can intelligently select the appropriate API version for executing the access request initiated by the client according to the characteristics and capabilities of the client. In addition, when upgrading the version, a smooth upgrade strategy is introduced, so that during the coexistence of the old and new versions, the client's access request is slowly directed to the new version for execution, ensuring the stability of the system operation and avoiding the rapid switching of the new version to cause version incompatibility, thereby causing problems such as client or system operation failure. This embodiment manages API versions and performs version evolution in an intelligent and progressive manner, thereby improving system stability, user experience, and maintainability during system version iteration.
[0052] The following embodiment uses the selection and management of new and old versions in the version iteration process as an example to illustrate; wherein the new version refers to a version generated by iteration based on the old version. For example, if the current version is version V1 and the latest version is version V2, then version V1 is an old version relative to version V2.
[0053] The method can be applied to devices or apparatuses such as servers or electronic devices, and its application devices and application scenarios are not specifically limited here. Figure 1 As shown, this embodiment is described by taking a server as an example.
[0054] S10, receiving a first access request from a client.
[0055] Receive various requests from the client in real time and determine whether each request is a first access request. If a first access request from the client is received, determine the target version for serving the first access request based on the basic information data of the client and the preset request guidance strategy. The first access request is a target API request, and the type and request content of the target API request can be set according to actual needs and are not limited here.
[0056] In one embodiment, if Figure 2 As shown, before S10, this embodiment further includes the following steps:
[0057] S51, intercepting the API request from the client to obtain basic information data of the client.
[0058] S52: Analyze the version adaptability of the client according to the basic information data.
[0059] S53, recording and storing the basic information data and version adaptability of the client.
[0060] Intercept the API request from the client, and then obtain the basic information data of the client that initiated the API request based on the API request, where the basic information data includes data such as device attributes, network speed and operating system type. The specific data type and data content included in the basic information data can be set according to actual needs and are not limited here.
[0061] Furthermore, the version adaptability of the client is analyzed based on the basic information data, and then a matching API version (hereinafter referred to as version) is selected based on the version adaptability to initiate subsequent API requests through the API version. The version adaptability is specifically analyzed based on information such as the operating system type, device type, and network speed. Furthermore, the basic information data and the version adaptability are used to match the target version that serves the first access request initiated by the client.
[0062] S20: Determine a target version for serving the first access request based on a preset request steering strategy.
[0063] In this embodiment, the target version is a new version or an old version in the API version, that is, a new version and an old version generated during the version iteration process of the API server.
[0064] During the coexistence of the old and new versions, that is, during the version iteration process, the corresponding version can be matched for the client's access request, thereby improving the stability of the transition between the old and new versions and avoiding version incompatibility and other problems that are prone to occur when the old version is replaced by the new version at one time.
[0065] Among them, this embodiment adopts dynamic feature matching to match the corresponding version for the client's access request, and specifically intelligently matches the appropriate API version according to the client's basic information data and request guidance strategy.
[0066] In one embodiment, if Figure 3 As shown, S20 specifically includes the following steps:
[0067] S21, obtaining request parameter information carried in the first access request and basic information data of the client.
[0068] The request parameter information carried is obtained through the first access request, and the basic information data of the client that initiated the first access request is simultaneously obtained. The basic information data obtained in this step is the basic information data stored locally or the basic information data obtained again from the client, and the specific acquisition method is not limited here.
[0069] Among them, the request parameter information includes data such as the request header and request parameters; the basic information data includes data such as device attributes, network speed and operating system type; the specific data contained in the request parameter information and basic information data can be set according to actual needs and is not limited here.
[0070] S22, combining the request parameter information and the basic information data, comprehensively determining a target version for serving the first access request.
[0071] A target version for serving the first access request is comprehensively matched according to a preset request steering strategy and in combination with request parameter information, basic information data, and the version adaptation capability of the client.
[0072] Exemplarily, the operating system type is determined based on the User-Agent information of the client in the basic information data; the device type is determined based on the User-Agent or other device information (the device types include mobile phones, tablets, and PCs, etc.); the network speed is determined based on the loading time of the request or the network request delay. For example, if the request response time is long, it means that the network speed is slow, and the client is marked as a low-speed network environment.
[0073] That is, the version adaptability is analyzed according to the request parameter information and the basic information data, and then the corresponding version is matched for the version adaptability of the client. Furthermore, in this embodiment, this step preferentially matches the version for each client based on the version adaptability of the client.
[0074] For example, if the client has strong version adaptability and is compatible with the upgraded version, the new version generated during the API version iteration process will be matched to the client; if the client has weak version adaptability, a compatible old version will be assigned.
[0075] It is worth noting that in this embodiment, when matching the corresponding version for the client, at least one of the three matching methods can be adopted; wherein, the three matching methods include: 1. Analyzing the version adaptability according to the request parameter information and the basic information data, and assigning a version adapted to the version adaptability to the client; 2. Matching the version according to the version adaptation of each element in the request parameter information and the basic information data, wherein the API version corresponding to the number of elements matched to the same API version is greater than the preset number threshold and is used as the target version; 3. Matching the corresponding version according to the version adaptation of each element in the request parameter information and the basic information data and the version-oriented ratio of each version, wherein, if the number of elements matched to a certain API version is greater than the preset number threshold and the ratio of the number of services to the total number of services is less than the version-oriented ratio, then the API version is used as the target version.
[0076] Specifically, the second and third matching methods mentioned above are illustrated below.
[0077] In one embodiment, if Figure 4 As shown, S22 specifically includes the following steps:
[0078] S221, based on the preset request-oriented strategy, API version matching is performed on each element included in the request parameter information and the basic information data.
[0079] S222, respectively counting the number of elements in the request parameter information and the basic information data that match the same API version.
[0080] S223: If the number of elements is greater than a preset number threshold, the corresponding API version is determined to be the target version.
[0081] To further ensure the reliability of version adaptation, when determining the target version for serving the first access request, the corresponding target version is matched specifically according to the preset request steering strategy, wherein the preset request steering strategy is to determine the target version by matching the API versions of the elements contained in the request parameter information and the basic information data. That is, in this embodiment, this step preferentially matches the version for each client based on the version matching of each element in the request parameter information and the basic information data. Among them, the preset quantity threshold can be set according to actual needs and is not limited here.
[0082] It can be understood that the corresponding API version is matched according to the request parameter information and each element of the basic information data. For example, the three elements of the device attributes, network speed and operating system type in the basic information data correspond to the appropriate API versions respectively; for example, if the User-Agent information in the client basic information data contains the "Windows" field, the API version suitable for the Windows operating system is selected, and if the client's network speed is slow, the simplified or low-bandwidth API version is selected; then, after finding the corresponding matching version for each element, the number of elements matching the same API version is counted. If the number of elements is large, the corresponding API version is used as the target version; or, if the request parameter information contains a specific version parameter "version=V2", the corresponding V2 version is used as the target version.
[0083] In one implementation, the appropriate version may be matched for the client further according to the version matching of each element in the request parameter information and the basic information data and the version orientation ratio of each version.
[0084] Specifically, the request parameter information carried by the first access request and the basic information data of the client are obtained; based on the preset version-oriented ratio, the request parameter information and the basic information data, the target version for serving the first access request is comprehensively determined.
[0085] Exemplarily, obtain the service times of a single API version and the total service times of all API versions; based on the preset request-oriented strategy, perform API version matching on each element contained in the request parameter information and the basic information data; count the number of elements in the request parameter information and the basic information data that match the same API version; if the number of elements is greater than the preset number threshold, calculate the ratio of the service times of the corresponding API version to the total service times; if the ratio is less than the version-oriented ratio, use the corresponding API version as the target version. The specific value range of the preset number threshold can be set according to actual needs and is not limited here.
[0086] It can be understood that after the corresponding API version is initially matched based on the version matching of each element in the request parameter information and the basic information data, it is determined whether to use the matched API version as the target version based on the version orientation ratio preset for each API version. Among them, the version orientation ratio of each API version can be set according to actual needs, and this embodiment does not limit this.
[0087] For example, if the version orientation ratio of the new version is set to 20%, 20% of the first access requests are selected from all the first access requests and directed to the new version, that is, the target version corresponding to 20% of the first access requests is the new version. Furthermore, if the corresponding API version is preliminarily matched to the new version based on the version matching of each element in the request parameter information and the basic information data, and the proportion of the service times of the new version to the total service times is less than 20%, the new version is used to execute the first access request.
[0088] As an optional implementation, after S20, the embodiment of the present application also includes: feeding back version matching information to the client; wherein the version matching information is used to instruct the client to initiate a second access request using the target version corresponding to the version matching information, and the second access request is used to indicate that the API version serving the second access request is the target version.
[0089] It can be understood that after the target version is determined, information is fed back to the client to instruct the client to subsequently use the target version to initiate an API request. That is, after determining that the client is compatible with the target version, a new access request (i.e., a second access request) is subsequently initiated by running the target version.
[0090] S30, calling the API server and using the target version to execute the first access request, and recording the service times of the target version, and using the service times as the service traffic of the target version.
[0091] After determining the corresponding target version, the API server is called to run the target version to execute the first access request, and the service times of the target version are recorded, wherein the service times of the target version are the times of running the target version, and the service times of the target version are used as the service flow corresponding to the target version.
[0092] Furthermore, in the process of determining the target version, the service times of each API version may be recorded, and the service times may be used as the service traffic corresponding to each API version.
[0093] S40, periodically counting the service traffic of the new version, if the service traffic is greater than a preset traffic threshold, then discarding the old version and its service data.
[0094] In this embodiment, the service flow of the new version is periodically counted according to a preset period, wherein the service flow refers to the frequency of version use (i.e., the number of service times). Further, it is determined whether the service flow of the new version is greater than a preset flow threshold. If the service flow is greater than the preset flow threshold, the old version and its service data are removed. It can be understood that when the service flow of the new version reaches the preset flow threshold, that is, most of the clients have migrated to use the new version, then the support for the old version can be terminated and the new version can enter the independent operation stage.
[0095] Furthermore, to ensure the reliability of the replacement of the old version with the new version, the migration status of the client can be monitored in real time during the coexistence of the old and new versions. The migration status includes data such as the request ratio of the new version and the old version, the migration success rate, etc. In other words, the service traffic ratio of the new version and the old version and their respective service success rates are monitored in real time, and based on the migration status, it is determined whether to end the operational support of the old version and enter the independent operation of the new version, so that the new version can be provided to each client in the future, and the transition between the old and new versions can be achieved, thereby flexibly responding to changes in the market and user needs to improve the experience effect and continuously adapt to the changing business environment.
[0096] This embodiment can intelligently select the appropriate API version for executing the access request initiated by the client according to the characteristics and capabilities of the client; in addition, when upgrading the version, a smooth upgrade strategy is introduced to match the corresponding new and old versions for the client's access request, and then during the coexistence of the new and old versions, the client's access request is slowly directed to the new version for execution, allowing the new and old versions to be supported simultaneously for a period of time, making the version switching process smoother, reducing the impact on the client or system operation, ensuring the stability of the system, and avoiding version incompatibility caused by a one-time rapid switching of the new version, thereby causing problems such as client or system operation failures. This embodiment manages API versions and performs version evolution in an intelligent and progressive manner, thereby improving system stability while improving user experience and maintainability during system version iteration.
[0097] Please refer to Figure 5 , an embodiment of the present application provides a version management device, the device comprising:
[0098] The receiving module 110 is configured to receive a first access request from a client;
[0099] A determination module 120, configured to determine a target version for servicing the first access request based on a preset request steering strategy, wherein the target version is a new version or an old version of the API version;
[0100] An execution module 130 is used to call the API server and use the target version to execute the first access request, and record the service times of the target version, and use the service times as the service traffic of the target version;
[0101] The statistics module 140 is used to periodically count the service traffic of the new version. If the service traffic is greater than a preset traffic threshold, the old version and its service data are removed.
[0102] It can be understood that the version management device of this embodiment corresponds to the version management method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.
[0103] The embodiment of the present application also provides a computer device, which can be, but is not limited to, a desktop computer, a notebook, a smart phone, a tablet, etc. Its existence form is not limited, and mainly depends on whether it needs to support the interface display function of the browser web page, etc. Exemplarily, the computer device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the computer device to execute the version management method of the present application, wherein the method includes: receiving a first access request from a client; based on a preset request steering strategy, determining a target version for serving the first access request, the target version being a new version or an old version in the API version; calling the API server and using the target version to execute the first access request, and recording the service times of the target version, and using the service times as the service traffic of the target version; periodically counting the service traffic of the new version, and if the service traffic is greater than a preset traffic threshold, then Eliminate the old version and its service data; further, this embodiment can intelligently select the appropriate API version for executing the access request initiated by the client according to the characteristics and capabilities of the client; in addition, when upgrading the version, a smooth upgrade strategy is introduced to match the corresponding old and new versions for the client's access request, and then during the coexistence of the old and new versions, the client's access request is slowly directed to the new version for execution, allowing the old and new versions to be supported simultaneously for a period of time, making the version switching process smoother, reducing the impact on the client or system operation, ensuring the stability of the system, and avoiding one-time rapid switching of the new version that causes version incompatibility, thereby causing problems such as client or system operation failures. This embodiment manages API versions and performs version evolution in an intelligent and progressive manner, thereby improving system stability while improving user experience and maintainability during system version iteration.
[0104] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. At least one of the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.
[0105] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.
[0106] In addition, the present application also provides a computer storage medium for storing the computer program used in the above-mentioned computer device, wherein, when the computer program is executed on the processor, the version management method of the above-mentioned embodiment is implemented, and the method includes: receiving a first access request from a client; based on a preset request-directed strategy, determining a target version for serving the first access request, the target version being a new version or an old version in the API version; calling the API server and using the target version to execute the first access request, and recording the service times of the target version, and using the service times as the service traffic of the target version; periodically counting the service traffic of the new version, and if the service traffic is greater than a preset traffic threshold, removing the old version and its service data.
[0107] It can be understood that the options in the version management method of the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.
[0108] The computer storage medium may be a non-volatile storage medium or a volatile storage medium. For example, the computer storage medium may include, but is not limited to, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0109] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0110] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0111] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
[0112] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A version management method, characterized in that: include: receiving a first access request from a client; Based on a preset request steering strategy, determine a target version for serving the first access request, the target version being a new version or an old version of the API version; Calling the API server and using the target version to execute the first access request, and recording the service times of the target version, and using the service times as the service traffic of the target version; The service traffic of the new version is counted periodically, and if the service traffic is greater than a preset traffic threshold, the old version and its service data are removed.
2. The version management method according to claim 1, characterized in that: The determining, based on a preset request steering strategy, a target version for serving the first access request includes: Obtaining request parameter information carried by the first access request and basic information data of the client; wherein the request parameter information includes a request header and request parameters; and the basic information data includes device attributes, network speed, and operating system; In combination with the request parameter information and the basic information data, a target version for serving the first access request is comprehensively determined.
3. The version management method according to claim 2, characterized in that: The step of combining the request parameter information and the basic information data to comprehensively determine a target version for serving the first access request includes: Based on a preset request-oriented strategy, API version matching is performed on each element included in the request parameter information and the basic information data; Counting the number of elements in the request parameter information and the basic information data that match the same API version respectively; If the number of elements is greater than a preset number threshold, the corresponding API version is determined to be the target version.
4. The version management method according to claim 1, characterized in that: The determining, based on a preset request steering strategy, a target version for serving the first access request includes: Obtaining request parameter information carried in the first access request and basic information data of the client; Based on a preset version-oriented ratio, the request parameter information, and the basic information data, a target version for serving the first access request is comprehensively determined.
5. The version management method according to claim 4, characterized in that: The step of comprehensively determining a target version for serving the first access request based on a preset version orientation ratio, the request parameter information, and the basic information data includes: Get the service count of a single API version and the total service count of all API versions; Based on a preset request-oriented strategy, API version matching is performed on each element included in the request parameter information and the basic information data; Counting the number of elements in the request parameter information and the basic information data that match the same API version respectively; If the number of elements is greater than a preset number threshold, then the ratio of the service times of the corresponding API version to the total service times is calculated; If the ratio value is less than the version-oriented ratio, the corresponding API version is used as the target version.
6. The version management method according to any one of claims 1 to 5, characterized in that: Before receiving the first access request from the client, the method further includes: Intercept API requests from clients to obtain basic information data of the clients; Analyzing the version adaptability of the client according to the basic information data; Record and store the basic information data and version adaptability of the client; the basic information data and the version adaptability are used to match the target version serving the first access request initiated by the client.
7. The version management method according to any one of claims 1 to 5, characterized in that: After determining the target version for serving the first access request based on the preset request steering strategy, the method further includes: Feedback version matching information to the client; the version matching information is used to instruct the client to initiate a second access request using the target version corresponding to the version matching information, and the second access request is used to indicate that the API version serving the second access request is the target version.
8. A version management device, characterized in that: include: A receiving module, configured to receive a first access request from a client; A determination module, configured to determine a target version for servicing the first access request based on a preset request steering strategy, wherein the target version is a new version or an old version of the API version; An execution module, configured to call the API server and use the target version to execute the first access request, and record the service times of the target version, and use the service times as the service traffic of the target version; The statistics module is used to periodically count the service traffic of the new version. If the service traffic is greater than a preset traffic threshold, the old version and its service data are removed.
9. A computer device, characterized in that: The computer device comprises a memory and at least one processor, the memory stores a computer program, and the processor is used to execute the computer program to implement the version management method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer program is stored therein, and when the computer program is executed, the version management method according to any one of claims 1 to 7 is implemented.
