CN116700940B - Request handling method, system and device based on encapsulation class and medium - Google Patents

Request handling method, system and device based on encapsulation class and medium Download PDF

Info

Publication number
CN116700940B
CN116700940B CN202310989420.6A CN202310989420A CN116700940B CN 116700940 B CN116700940 B CN 116700940B CN 202310989420 A CN202310989420 A CN 202310989420A CN 116700940 B CN116700940 B CN 116700940B
Authority
CN
China
Prior art keywords
request
data
priority
time sequence
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310989420.6A
Other languages
Chinese (zh)
Other versions
CN116700940A (en
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Shuzhi Innovation Lean Technology Co ltd
Original Assignee
Chengdu Shuzhi Innovation Lean Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Shuzhi Innovation Lean Technology Co ltd filed Critical Chengdu Shuzhi Innovation Lean Technology Co ltd
Priority to CN202310989420.6A priority Critical patent/CN116700940B/en
Publication of CN116700940A publication Critical patent/CN116700940A/en
Application granted granted Critical
Publication of CN116700940B publication Critical patent/CN116700940B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a request handling method, a request handling system, a request handling device and a request handling medium based on encapsulation, which relate to the technical field of computers, and provide a priority configuration item for a front end by encapsulating an instantiation interface corresponding to a hypertext transfer protocol library, so that a client finishes priority setting on a request message according to an encapsulation result when generating the request message, and writes the request message into an asynchronous request queue; and then rearranging the request data in the asynchronous request queue according to the priority of the request message to obtain a time sequence queue, determining the handling time sequence of the request message, expanding the time sequence capability of handling the request message in the prior front-end and back-end interaction, leading the request message with high priority to be preferentially processed under the high concurrency condition, and improving the handling efficiency of the back-end server on the service request.

Description

Request handling method, system and device based on encapsulation class and medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, a system, a device, and a medium for handling a request based on encapsulation.
Background
In web pages or applications, the system architecture is generally divided into a front end and a back end, where the front end and the back end provide corresponding services to users through data interaction. In practical application, under the application scenarios that the page display content such as the visual large screen and the single-page application head screen is complex and the number of modules and interfaces is numerous, the front end may send a large amount of request messages to the back end server in a short time due to the operation of a user. And the back-end server is limited in processing operation capability, and cannot respond to all the request messages at the same time, so that the response time of part of the request messages is long, and the processing efficiency of the service request is affected. In the prior art, a transmission protocol library used for front-end and back-end data interaction does not provide a time sequence optimizing configuration item aiming at the request message, and when the front-end modules are combined and loaded, the time sequence processing of the request message sent by the front-end modules cannot be performed. Therefore, a problem to be solved is to increase the processing efficiency of the service request by performing time-sequential processing on the received request message when a large number of request messages are received by the backend server in a short time.
Disclosure of Invention
In order to perform sequential processing on a large number of request messages received by a back-end server in a short time according to service request requirements, so that the back-end server preferentially completes response of key services and improves service request disposal efficiency, the invention provides a request disposal method based on encapsulation class, wherein the request disposal method based on encapsulation class comprises the following steps:
obtaining an instantiation interface corresponding to the hypertext transfer protocol library and packaging to obtain a packaging result;
generating a first request according to the encapsulation result, and writing the first request into an asynchronous request queue;
judging whether the requests in the asynchronous request queue complete priority configuration, if yes, writing the corresponding requests into a time sequence queue; if not, configuring the corresponding request as a first preset priority, and writing the first preset priority into a time sequence queue, wherein the time sequence queue comprises a plurality of request data;
sequencing the request data in the time sequence queue according to the priority to obtain a sequencing result;
and asynchronously executing the request data in the time sequence queue according to the sequencing result to obtain an asynchronous execution result.
The traditional priority setting method can lead to synchronization of asynchronous request messages sent by the front end, and lead to congestion of the request messages when setting the priority; firstly, providing a priority configuration item for the front end by packaging an instantiation interface corresponding to a hypertext transfer protocol library, enabling the front end to finish priority setting on a request message according to a packaging result when the request message is generated, and writing the request message into an asynchronous request queue; and then rearranging the request data in the asynchronous request queue according to the priority of the request message to obtain a time sequence queue, determining the handling time sequence of the request message, expanding the time sequence capability of handling the request message in the prior front-end and back-end interaction, leading the request message with high priority to be preferentially processed under the high concurrency condition, and improving the handling efficiency of the back-end server on the service request.
Further, after determining the processing time sequence of the request message according to the priority, the back-end server needs to asynchronously and concurrently process a plurality of request data in the time sequence queue after being sequenced according to the priority due to the plurality of request messages, so that the response task to the request message is efficiently completed; therefore, the specific method for asynchronously executing the request data in the time sequence queue according to the sequencing result is as follows:
reading the data quantity in the asynchronous request queue to obtain first data;
reading the data amount in the time sequence queue to obtain second data;
in order to determine the concurrency of the request data in the time sequence queue for asynchronous execution, calculating the ratio of the first data to the second data, and determining third data according to the ratio, wherein the third data is used for describing the concurrency corresponding to the request data in the time sequence queue for asynchronous execution;
and reading the request data in the time sequence queue according to the third data and the sequencing result and asynchronously executing the request data to obtain an asynchronous execution result.
And determining asynchronous execution concurrency of the back-end server on the request data in the time sequence queue according to the size relation of the data volume in the asynchronous request queue and the time sequence queue, so that overload of the back-end server caused by overlarge concurrency is effectively avoided, and meanwhile, the situation that the request data stored in the time sequence queue cannot be treated in time due to overlarge concurrency is avoided, and the corresponding request data is lost due to overflow of the data in the time sequence queue.
Further, the specific method for obtaining and packaging the instantiation interface corresponding to the hypertext transfer protocol library comprises the following steps:
obtaining an instantiation interface corresponding to a hypertext transfer protocol library;
packaging a priority processing class, and enabling the priority processing class to provide a priority configuration item for the front end by calling the instantiation interface;
and generating a request instance according to the priority processing class to obtain a packaging result.
Further, in order to obtain an accurate basis for setting the priority of the request message, and complete the priority setting of the request message according to the priority configuration item provided by the encapsulation result, the specific method for generating the first request according to the encapsulation result is as follows:
performing pressure test on the instantiation interface corresponding to the hypertext transfer protocol library to obtain interface response time;
grading the interface response time to obtain fourth data;
and generating a first request according to the fourth data and the encapsulation result, configuring the request message with the longer interface response time as a lower priority, and configuring the request message with the shorter interface response time as a higher priority, thereby avoiding the long-time-consuming request message from blocking the response of the short-time-consuming request message and improving the treatment efficiency of the service request.
Further, since specific request contents included in the request message are different, after the corresponding processing of the request message is completed, the obtained returned result may be specific data, identification information for describing whether the request is successful or not, or further new request, and when the returned result is a new request, priority configuration needs to be completed for the new request, so that the following steps are further included after the asynchronous execution result is obtained:
judging whether the data type of the asynchronous execution result is an instance corresponding to the encapsulation class;
if yes, writing the asynchronous execution result into the asynchronous request queue as a second request, and executing the subsequent steps;
and if not, returning the asynchronous execution result to the front end.
Further, when the weight configuration is performed on the new request, since the new request is obtained on the basis of the original request message, the returned result corresponding to the new request is the final result of the original request message; thus, the new request should inherit the priority corresponding to the original request, and the priority corresponding to the second request is greater than or equal to the priority of the first request corresponding to the second request.
Further, the request message in the hypertext transfer protocol consists of a request address, a message header and a request text auxiliary, and the corresponding request types comprise GET request, POST request, PUT request, DELETE request and the like, wherein the GET request is used for requesting to acquire the resource and does not cause modification of the existing resource; the POST request is used for adding data in the resource, and the data is contained in the request text, so that new resource creation and/or modification of the existing resource can be caused; the PUT request is used to complete the data upload, which results in modification of the existing resources; the DELETE request is for requesting deletion of some or all of the data in the existing resource, resulting in modification of the existing resource.
When the front end sends a large amount of request messages in a short time, the request messages may have requests pointing to the same resource, and when the front end sequentially performs different types of requests on the same resource, the request sequence of the front end on the same resource is changed after the request data in the time sequence queue is sequenced according to the priority, so that returned data errors are caused, and in order to avoid the influence, the request data in the time sequence queue is sequenced according to the priority, and the specific method for obtaining the sequencing result is as follows:
traversing the request data, and judging whether repeated request objects exist or not;
if yes, extracting corresponding request data to obtain a third request; sequencing according to the request type of the third request to obtain a request group, and taking the highest priority of the third request as the priority of the request group; sorting the rest of the request data and the request group in the time sequence queue according to the priority, and obtaining a sorting result;
and if not, sequencing the request data in the time sequence queue according to the priority, and obtaining a sequencing result.
To achieve the above object, the present invention also provides a package-based request handling system, including:
the encapsulation processing module is used for obtaining an instantiation interface corresponding to the hypertext transfer protocol library and encapsulating the instantiation interface to obtain an encapsulation result;
the request generation module is used for generating a first request according to the encapsulation result and writing the first request into an asynchronous request queue;
the time sequence processing module is used for judging whether the requests in the asynchronous request queue complete priority configuration or not, if yes, writing the corresponding requests into the time sequence queue; if not, configuring the corresponding request as a first preset priority, and writing the first preset priority into a time sequence queue; sequencing the request data in the time sequence queue according to the priority to obtain a sequencing result;
and the request response module is used for asynchronously executing the request data in the time sequence queue according to the sequencing result to obtain an asynchronous execution result.
The system provides a priority configuration item for the front end by encapsulating the instantiation interface corresponding to the hypertext transfer protocol library through the encapsulation processing module, so that the request generation module finishes priority setting on the request message when generating the request message, and enters into the asynchronous request queue, the time sequence processing module rearranges the request data in the asynchronous request queue according to the priority of the request message to obtain a time sequence queue, the processing time sequence of the request message is determined, the time sequence capability of processing the request message in the existing front-end and back-end interaction is expanded, the request message with high priority is processed preferentially under the condition of high concurrency, and the processing efficiency of a back-end server on service requests is improved.
To achieve the above object, the present invention further provides a request handling device based on a package class, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of a request handling method based on a package class according to any one of the above when executing the computer program.
To achieve the above object, the present invention further provides a computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of a package-based request handling method according to any one of the above.
The one or more technical schemes provided by the invention provide the priority configuration item of the request message to the front end by packaging the instantiation interface corresponding to the hypertext transfer protocol library, so that the front end completes the priority setting of the request message under the condition of not blocking the generation of the request message, determines the handling time sequence of the request message, and expands the time sequence capability of handling the request message in the prior front-end and back-end interaction; the new request message generated by the request return value inherits the priority of the original request message, so that the processing efficiency of the original request message is ensured; meanwhile, the request messages are classified according to priority rearrangement, so that data anomalies returned by different types of request messages which point to the same resource data after rearrangement are avoided, and the processing rate and the effectiveness of the back-end server on service requests are improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention;
FIG. 1 is a flow chart of a method for handling requests based on encapsulation class according to the present invention;
FIG. 2 is a schematic diagram of a package-based request handling system architecture in accordance with the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description. In addition, the embodiments of the present invention and the features in the embodiments may be combined with each other without collision.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than within the scope of the description, and the scope of the invention is therefore not limited to the specific embodiments disclosed below.
Example 1
Referring to fig. 1, a first embodiment of the present invention provides a request handling method based on a package class, wherein the request handling method of the package class includes the following steps:
obtaining an instantiation interface corresponding to the hypertext transfer protocol library and packaging to obtain a packaging result;
generating a first request according to the encapsulation result, and writing the first request into an asynchronous request queue;
judging whether the requests in the asynchronous request queue complete priority configuration, if yes, writing the corresponding requests into a time sequence queue; if not, configuring the corresponding request as a first preset priority, and writing the first preset priority into a time sequence queue, wherein the time sequence queue comprises a plurality of request data;
sequencing the request data in the time sequence queue according to the priority to obtain a sequencing result;
and asynchronously executing the request data in the time sequence queue according to the sequencing result to obtain an asynchronous execution result.
Among them, the hypertext transfer protocol (Hypertext Transfer Protocol, HTTP) is a commonly used request-response protocol, typically running on top of TCP (Transmission Control Protocol ). HTTP specifies what request messages the front-end will send to the back-end server and what responses the back-end server will respond to the received request messages; the instantiation interface corresponding to the hypertext transfer protocol library may be a Fetch-based instantiation interface in the HTTP request, or may be an XHR-based instantiation interface in the HTTP, where a specific HTTP request method is determined according to actual needs, and this embodiment is not specifically limited herein.
The encapsulation result is used for providing the priority configuration item of the request message to the front end, the front end completes the specific configuration of the priority of the request message according to the needs, the specific size of the priority is determined according to the actual needs, and the embodiment is not limited specifically herein.
After determining whether the request in the asynchronous request queue completes the priority configuration, if the request in the asynchronous request queue does not complete the corresponding priority configuration, in order to facilitate subsequent rearrangement according to the priority size corresponding to the request message, the request is configured as a first preset priority, and the specific size of the first preset priority is determined according to actual needs, which is not limited in this embodiment.
Specifically, in the principle of computer programming, encapsulation refers to hiding the attribute and implementation details of an object, and externally exposing an interface for calling, so that the multiplexing rate of codes is improved; in this embodiment, the instantiation interface corresponding to the hypertext transfer protocol library is encapsulated, that is, for the request instance adopted by the current application, the priority configuration object is added and encapsulated, and the encapsulation method may be implemented by a function, a class or a filter.
Wherein promose is essentially a class that can produce corresponding promose instance objects; because the method of the then () in the promiscuous class returns a promiscuous object, the promiscuous class supports chain operation and is generally used for asynchronously solving the callback prison problem of the code, so that the readability of the code can be improved; the traditional priority setting method sequentially configures priorities of different request messages, which can lead to that the asynchronous request messages sent by the front end need to sequentially complete priority configuration and then carry out subsequent asynchronous execution operation, and when the priorities are set, the original asynchronous request messages are synchronized, so that the request messages are congested; and the promiscuous is used as an asynchronous programming method, and the promiscuous encapsulates the instantiation interface corresponding to the hypertext transfer protocol library, so that the congestion of the request message can be effectively avoided, and the back-end server has good treatment efficiency on the request message, therefore, the embodiment prefers the promiscuous to encapsulate the instantiation interface corresponding to the hypertext transfer protocol library.
In this embodiment, the specific method for asynchronously executing the request data in the time sequence queue according to the sorting result is as follows:
reading the data quantity in the asynchronous request queue to obtain first data;
reading the data amount in the time sequence queue to obtain second data;
calculating the ratio of the first data to the second data, and determining third data according to the ratio, wherein the third data is used for describing the concurrency corresponding to the request data in the asynchronous execution time sequence queue;
and reading the request data in the time sequence queue according to the third data and the sequencing result and asynchronously executing the request data to obtain an asynchronous execution result.
Specifically, the first data is used for representing the request data amount corresponding to the request message sent by the current front end, the second data is used for representing the request data amount corresponding to the request message after rearrangement is completed according to the priority, and the third data is used for describing the concurrency amount corresponding to the request data in the asynchronous execution time sequence queue; after calculating the ratio of the first data to the second data, if the ratio is greater than a threshold value, considering that the concurrency corresponding to the request data in the time sequence queue executed asynchronously at present is too small to timely handle the request data stored in the time sequence queue, wherein the time sequence queue has a data overflow risk and the third data needs to be increased; if the ratio is smaller than a threshold value, the concurrency corresponding to the request data in the time sequence queue is considered to be too large, the rear-end server has overload risk, and the third data needs to be reduced.
In this embodiment, the specific method for obtaining and packaging the instantiation interface corresponding to the hypertext transfer protocol library includes:
obtaining an instantiation interface corresponding to a hypertext transfer protocol library;
packaging a priority processing class, and enabling the priority processing class to provide a priority configuration item for the front end by calling the instantiation interface;
and generating a request instance according to the priority processing class to obtain a packaging result.
In this embodiment, the specific method for generating the first request according to the encapsulation result is:
performing pressure test on the instantiation interface corresponding to the hypertext transfer protocol library to obtain interface response time;
grading the interface response time to obtain fourth data;
and generating a first request according to the fourth data and the encapsulation result.
The pressure test may be completed based on Jmeter, load Runner or Performance Runner, and the interface response time of the instantiation interface corresponding to the hypertext transfer protocol library is obtained through the pressure test, where the specific implementation method of the pressure test is determined according to actual needs, and the embodiment is not limited specifically herein.
Specifically, after the interface response time is classified, a first request is generated according to the fourth data and the encapsulation result, the request message with the longer interface response time is configured to be of a lower priority, the request message with the shorter interface response time is configured to be of a higher priority, so that the response of the request message with the short time consumption is prevented from being blocked by the request message with the long time consumption, the processing efficiency of the service request is improved, and the specific classification threshold and the classification number are determined according to actual needs.
Example two
Referring to fig. 1, a second embodiment of the present invention provides a request handling method based on encapsulation, which further includes the following steps after obtaining an asynchronous execution result based on the first embodiment:
judging whether the data type of the asynchronous execution result is an instance corresponding to the encapsulation class;
if yes, writing the asynchronous execution result into the asynchronous request queue as a second request, and executing the subsequent steps;
and if not, returning the asynchronous execution result to the front end.
Wherein the priority corresponding to the second request is greater than or equal to the priority of the first request corresponding to the second request.
Specifically, the promise object returned in the process () method may contain a new request message after the instantiation interface corresponding to the hypertext transfer protocol library is encapsulated by the promise, and since the returned result corresponding to the new request is the final result of the original request message, the new request should inherit the priority corresponding to the original request; the priority corresponding to the second request is greater than or equal to the priority of the first request corresponding to the second request, and the specific size of the priority is determined according to actual needs, which is not specifically limited herein.
In this embodiment, the method for obtaining the ordering result includes the following steps:
traversing the request data, and judging whether repeated request objects exist or not;
if yes, extracting corresponding request data to obtain a third request; sequencing according to the request type of the third request to obtain a request group, and taking the highest priority of the third request as the priority of the request group; sorting the rest of the request data and the request group in the time sequence queue according to the priority, and obtaining a sorting result;
and if not, sequencing the request data in the time sequence queue according to the priority, and obtaining a sequencing result.
Specifically, the request types of the request data include GET request, POST request, PUT request, DELETE request, etc., taking GET request and DELETE request pointing to the same request object as examples, and the initial request sequence is to read the resource data first and then DELETE the resource data; if the priorities configured by the GET request and the DELETE request are different, the processing sequence of the request is changed after the GET request and the DELETE request are ordered in a time sequence queue, and then the resource data is deleted and read, which can cause the GET request to have an error, and the read data is null; therefore, in order to avoid data anomaly, if repeated request objects exist in the time sequence queue, after the rest request data and the request group are ordered in the time sequence queue according to the priority and the ordering result is obtained, the back-end server firstly executes the request data with the priority higher than the request group according to the ordering result, then sequentially executes a plurality of third requests in the request group according to the request time, and finally executes the request data with the priority lower than the request group.
Example III
Referring to fig. 2, a third embodiment of the present invention provides a request handling system based on a package class, where the request handling system based on the package class includes:
the encapsulation processing module is used for obtaining an instantiation interface corresponding to the hypertext transfer protocol library and encapsulating the instantiation interface to obtain an encapsulation result;
the request generation module is used for generating a first request according to the encapsulation result and writing the first request into an asynchronous request queue;
the time sequence processing module is used for judging whether the requests in the asynchronous request queue complete priority configuration or not, if yes, writing the corresponding requests into the time sequence queue; if not, configuring the corresponding request as a first preset priority, and writing the first preset priority into a time sequence queue; sequencing the request data in the time sequence queue according to the priority to obtain a sequencing result;
and the request response module is used for asynchronously executing the request data in the time sequence queue according to the sequencing result to obtain an asynchronous execution result.
Example IV
A fourth embodiment of the present invention provides a request processing device based on a package class, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements steps of a request method based on the package class when executing the computer program.
Example five
A fifth embodiment of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the package-class-based request handling method.
The processor may be a central processing unit (CPU, central Processing Unit), other general purpose processors, digital signal processors (digital signal processor), application specific integrated circuits (Application Specific Integrated Circuit), off-the-shelf programmable gate arrays (Field programmable gate array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. The general purpose processor may be a microprocessor or any conventional processor.
The memory may be used to store the computer program and/or the modules, and the processor may implement various functions of the package-based request handling device of the present invention by executing or executing data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs required for at least one function (such as a sound playing function, an image playing function, etc.), and the like. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart memory card, secure digital card, flash memory card, at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The package-based request handling means may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a stand alone product. Based on such understanding, the present invention may implement all or part of the flow of the method of the above-described embodiments, or may be stored in a computer readable storage medium by a computer program, which when executed by a processor, implements the steps of the method embodiments described above. Wherein the computer program comprises computer program code, object code forms, executable files, or some intermediate forms, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, a point carrier signal, a telecommunication signal, a software distribution medium, and the like. It should be noted that the content of the computer readable medium can be appropriately increased or decreased according to the requirements of the legislation and the patent practice in the jurisdiction.
Having described the basic concept of the invention, it will be apparent to those skilled in the art that the foregoing detailed disclosure is by way of example only and is not intended to be limiting. Although not explicitly described herein, various modifications, improvements, and adaptations to the present disclosure may occur to one skilled in the art. Such modifications, improvements, and modifications are intended to be suggested within this specification, and therefore, such modifications, improvements, and modifications are intended to be included within the spirit and scope of the exemplary embodiments of the present invention.
Meanwhile, the specification uses specific words to describe the embodiments of the specification. Reference to "one embodiment," "an embodiment," and/or "some embodiments" means that a particular feature, structure, or characteristic is associated with at least one embodiment of the present description. Thus, it should be emphasized and should be appreciated that two or more references to "an embodiment" or "one embodiment" or "an alternative embodiment" in various positions in this specification are not necessarily referring to the same embodiment. Furthermore, certain features, structures, or characteristics of one or more embodiments of the present description may be combined as suitable.
Furthermore, those skilled in the art will appreciate that the various aspects of the specification can be illustrated and described in terms of several patentable categories or circumstances, including any novel and useful procedures, machines, products, or materials, or any novel and useful modifications thereof. Accordingly, aspects of the present description may be performed entirely by hardware, entirely by software (including firmware, resident software, micro-code, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as a "data block," module, "" engine, "" unit, "" component, "or" system. Furthermore, aspects of the specification may take the form of a computer product, comprising computer-readable program code, embodied in one or more computer-readable media.
The computer storage medium may contain a propagated data signal with the computer program code embodied therein, for example, on a baseband or as part of a carrier wave. The propagated signal may take on a variety of forms, including electro-magnetic, optical, etc., or any suitable combination thereof. A computer storage medium may be any computer readable medium that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code located on a computer storage medium may be propagated through any suitable medium, including radio, cable, fiber optic cable, RF, or the like, or a combination of any of the foregoing.
The computer program code necessary for operation of portions of the present description may be written in any one or more programming languages, including an object oriented programming language such as Java, scala, smalltalk, eiffel, JADE, emerald, C ++, c#, vb net, python and the like, a conventional programming language such as C language, visual Basic, fortran 2003, perl, COBOL 2002, PHP, ABAP, a dynamic programming language such as Python, ruby and Groovy, or other programming languages and the like. The program code may execute entirely on the user's computer or as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any form of network, such as a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet), or the use of services such as software as a service (SaaS) in a cloud computing environment.
Furthermore, the order in which the elements and sequences are processed, the use of numerical letters, or other designations in the description are not intended to limit the order in which the processes and methods of the description are performed unless explicitly recited in the claims. While certain presently useful inventive embodiments have been discussed in the foregoing disclosure, by way of various examples, it is to be understood that such details are merely illustrative and that the appended claims are not limited to the disclosed embodiments, but, on the contrary, are intended to cover all modifications and equivalent arrangements included within the spirit and scope of the embodiments of the present disclosure. For example, while the system components described above may be implemented by hardware devices, they may also be implemented solely by software solutions, such as installing the described system on an existing server or mobile device.
Likewise, it should be noted that in order to simplify the presentation disclosed in this specification and thereby aid in understanding one or more inventive embodiments, various features are sometimes grouped together in a single embodiment, figure, or description thereof. This method of disclosure, however, is not intended to imply that more features than are presented in the claims are required for the present description. Indeed, less than all of the features of a single embodiment disclosed above.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (9)

1. A method of handling a request based on a package class, the method of handling a request based on a package class comprising the steps of:
obtaining an instantiation interface corresponding to the hypertext transfer protocol library and packaging to obtain a packaging result;
generating a first request according to the encapsulation result, and writing the first request into an asynchronous request queue;
judging whether the requests in the asynchronous request queue complete priority configuration, if yes, writing the corresponding requests into a time sequence queue; if not, configuring the corresponding request as a first preset priority, and writing the first preset priority into a time sequence queue, wherein the time sequence queue comprises a plurality of request data;
sequencing the request data in the time sequence queue according to the priority to obtain a sequencing result;
asynchronously executing the request data in the time sequence queue according to the sequencing result to obtain an asynchronous execution result;
the specific method for obtaining and packaging the instantiation interface corresponding to the hypertext transfer protocol library comprises the following steps:
obtaining an instantiation interface corresponding to a hypertext transfer protocol library;
packaging a priority processing class, and enabling the priority processing class to provide a priority configuration item for the front end by calling the instantiation interface;
and generating a request instance according to the priority processing class to obtain a packaging result.
2. The method for handling requests based on encapsulation according to claim 1, wherein the specific method for asynchronously executing the request data in the time sequence queue according to the ordering result is as follows:
reading the data quantity in the asynchronous request queue to obtain first data;
reading the data amount in the time sequence queue to obtain second data;
calculating the ratio of the first data to the second data, and determining third data according to the ratio, wherein the third data is used for describing the concurrency corresponding to the request data in the asynchronous execution time sequence queue;
and reading the request data in the time sequence queue according to the third data and the sequencing result and asynchronously executing the request data to obtain an asynchronous execution result.
3. The method for handling requests based on encapsulation according to claim 1, wherein the specific method for generating the first request according to the encapsulation result is as follows:
performing pressure test on the instantiation interface corresponding to the hypertext transfer protocol library to obtain interface response time;
grading the interface response time to obtain fourth data;
and generating a first request according to the fourth data and the encapsulation result.
4. The method for handling requests based on encapsulation class according to claim 1, further comprising the steps of, after obtaining the asynchronous execution result:
judging whether the data type of the asynchronous execution result is an instance corresponding to the encapsulation class;
if yes, writing the asynchronous execution result into the asynchronous request queue as a second request, and executing the subsequent steps;
and if not, returning the asynchronous execution result to the front end.
5. The method of claim 4, wherein the priority of the second request is greater than or equal to the priority of the first request corresponding to the second request.
6. The method for handling requests based on encapsulation according to claim 1, wherein the specific method for ordering the request data in the time sequence queue according to priority, and obtaining the ordering result is as follows:
traversing the request data, and judging whether repeated request objects exist or not;
if yes, extracting corresponding request data to obtain a third request; sequencing according to the request type of the third request to obtain a request group, and taking the highest priority of the third request as the priority of the request group; sorting the rest of the request data and the request group in the time sequence queue according to the priority, and obtaining a sorting result;
and if not, sequencing the request data in the time sequence queue according to the priority, and obtaining a sequencing result.
7. A package-class-based request handling system, the package-class-based request handling system comprising:
the encapsulation processing module is used for obtaining an instantiation interface corresponding to the hypertext transfer protocol library and encapsulating the instantiation interface to obtain an encapsulation result;
the request generation module is used for generating a first request according to the encapsulation result and writing the first request into an asynchronous request queue;
the time sequence processing module is used for judging whether the requests in the asynchronous request queue complete priority configuration or not, if yes, writing the corresponding requests into the time sequence queue; if not, configuring the corresponding request as a first preset priority, and writing the first preset priority into a time sequence queue; sequencing the request data in the time sequence queue according to the priority to obtain a sequencing result;
the request response module is used for asynchronously executing the request data in the time sequence queue according to the sequencing result to obtain an asynchronous execution result;
the specific way of obtaining and packaging the instantiation interface corresponding to the hypertext transfer protocol library is as follows:
obtaining an instantiation interface corresponding to a hypertext transfer protocol library;
packaging a priority processing class, and enabling the priority processing class to provide a priority configuration item for the front end by calling the instantiation interface;
and generating a request instance according to the priority processing class to obtain a packaging result.
8. A package-based request handling device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements a package-based request handling method according to any of claims 1-6 when executing the computer program.
9. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements a package-based request handling method according to any of claims 1-6.
CN202310989420.6A 2023-08-08 2023-08-08 Request handling method, system and device based on encapsulation class and medium Active CN116700940B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310989420.6A CN116700940B (en) 2023-08-08 2023-08-08 Request handling method, system and device based on encapsulation class and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310989420.6A CN116700940B (en) 2023-08-08 2023-08-08 Request handling method, system and device based on encapsulation class and medium

Publications (2)

Publication Number Publication Date
CN116700940A CN116700940A (en) 2023-09-05
CN116700940B true CN116700940B (en) 2023-10-03

Family

ID=87834301

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310989420.6A Active CN116700940B (en) 2023-08-08 2023-08-08 Request handling method, system and device based on encapsulation class and medium

Country Status (1)

Country Link
CN (1) CN116700940B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107918562A (en) * 2016-10-11 2018-04-17 北京京东尚科信息技术有限公司 A kind of unified interface management method and system
CN108124003A (en) * 2017-12-11 2018-06-05 中盈优创资讯科技有限公司 Network management device connection processing method, apparatus and system
CN109862076A (en) * 2018-12-30 2019-06-07 贝壳技术有限公司 A kind of service data interaction methods, devices and systems
CN112988428A (en) * 2021-04-26 2021-06-18 南京蜂泰互联网科技有限公司 Distributed message asynchronous notification middleware implementation method and system
CN113742109A (en) * 2021-09-09 2021-12-03 平安科技(深圳)有限公司 Third-party service docking method, device, equipment and storage medium
CN114035987A (en) * 2021-11-15 2022-02-11 平安普惠企业管理有限公司 Data transmission method and device based on message queue, electronic equipment and medium
CN114385888A (en) * 2021-12-17 2022-04-22 联通智网科技股份有限公司 Client request processing method and related equipment
CN115562894A (en) * 2022-12-07 2023-01-03 云账户技术(天津)有限公司 Message processing method and device, electronic equipment and readable storage medium
CN115767188A (en) * 2022-10-18 2023-03-07 优地网络有限公司 Message request processing method, system, device and readable storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5617709B2 (en) * 2011-03-16 2014-11-05 富士通株式会社 Program, control device and method
US9225660B2 (en) * 2011-12-21 2015-12-29 Arm Finland Oy Method, apparatus and system for addressing resources
WO2015040280A1 (en) * 2013-09-20 2015-03-26 Notava Oy Access control to wireless networks involving a policy proxy server
US9785361B1 (en) * 2015-03-24 2017-10-10 Western Digital Technologies, Inc. Processing data access requests from multiple interfaces for data storage devices

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107918562A (en) * 2016-10-11 2018-04-17 北京京东尚科信息技术有限公司 A kind of unified interface management method and system
CN108124003A (en) * 2017-12-11 2018-06-05 中盈优创资讯科技有限公司 Network management device connection processing method, apparatus and system
CN109862076A (en) * 2018-12-30 2019-06-07 贝壳技术有限公司 A kind of service data interaction methods, devices and systems
CN112988428A (en) * 2021-04-26 2021-06-18 南京蜂泰互联网科技有限公司 Distributed message asynchronous notification middleware implementation method and system
CN113742109A (en) * 2021-09-09 2021-12-03 平安科技(深圳)有限公司 Third-party service docking method, device, equipment and storage medium
CN114035987A (en) * 2021-11-15 2022-02-11 平安普惠企业管理有限公司 Data transmission method and device based on message queue, electronic equipment and medium
CN114385888A (en) * 2021-12-17 2022-04-22 联通智网科技股份有限公司 Client request processing method and related equipment
CN115767188A (en) * 2022-10-18 2023-03-07 优地网络有限公司 Message request processing method, system, device and readable storage medium
CN115562894A (en) * 2022-12-07 2023-01-03 云账户技术(天津)有限公司 Message processing method and device, electronic equipment and readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Kernel Mechanisms for Supporting Differentiated Services and Content-Aware Request Distribution in Web Clusters Providing Multiple Services;Chun-Hung Wu 等;《2010 IEEE 24th International Conference on Advanced Information Networking and Applications Workshops》;473-478 *
Scheduling strategy to improve response time for web applications;Ludmila Cherkasova;《International Conference on High-Performance Computing and Networking HPCN-Europe 1998: High-Performance Computing and Networking》;第1401卷;305-314 *
云计算环境下Web服务性能保障技术研究;龙腾;《中国优秀硕士学位论文全文数据库 信息科技辑》(第3期);I139-413 *

Also Published As

Publication number Publication date
CN116700940A (en) 2023-09-05

Similar Documents

Publication Publication Date Title
US11210109B2 (en) Method and system for loading resources
US20220004423A1 (en) Virtualization-based transaction handling in an on-demand network code execution system
US20180150326A1 (en) Method and apparatus for executing task in cluster
US20150379425A1 (en) Consistent filtering of machine learning data
US20080168472A1 (en) Recording execution information
CN106656920B (en) Processing method, device, storage medium and the processor of HTTP service
CN109885624A (en) Data processing method, device, computer equipment and storage medium
US11321090B2 (en) Serializing and/or deserializing programs with serializable state
CN113765818A (en) Distributed current limiting method, device, equipment, storage medium and system
CN111914007A (en) Method and device for Hadoop cluster to run ETL process
CN117011397A (en) Data processing method, apparatus, device, readable storage medium, and program product
CN111897828A (en) Data batch processing implementation method, device, equipment and storage medium
CN113722114A (en) Data service processing method and device, computing equipment and storage medium
CN116700940B (en) Request handling method, system and device based on encapsulation class and medium
CN111338775B (en) Method and equipment for executing timing task
CN110245027B (en) Inter-process communication method and device
US9659041B2 (en) Model for capturing audit trail data with reduced probability of loss of critical data
CN108062224B (en) Data reading and writing method and device based on file handle and computing equipment
CN116009985A (en) Interface calling method, device, computer equipment and storage medium
CN114327404A (en) File processing method and device, electronic equipment and computer readable medium
CN111367889B (en) Cross-cluster data migration method and device based on webpage interface
CN113760524A (en) Task execution method and device
CN111722981B (en) Real-time monitoring method and device for ETL (extract transform load) process of hadoop cluster operation
CN111045787A (en) Rapid continuous experiment method and system
CN116126546B (en) Performance optimization method and device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant