Search

CN-122001889-A - Service request processing method, device, equipment and medium

CN122001889ACN 122001889 ACN122001889 ACN 122001889ACN-122001889-A

Abstract

The present application relates to the field of service processing, and in particular, to a method, an apparatus, a device, and a medium for processing a service request. The method distributes the service requests to the corresponding target servers according to the types, realizes splitting treatment of the service, ensures that the servers with different types of requests can independently perform resource expansion, solves the problem that a single architecture cannot independently expand resources, secondly, ensures that the different types of requests correspond to the independent servers and the resources, decouples codes among modules, ensures that a single module is modified without integral compiling and deploying, reduces the fault influence range, improves the iteration efficiency, and then, an event bus is used as an asynchronous communication line, can flexibly adapt to the technical stacks of the different servers, does not need binding and fixing technology to realize, improves the flexibility of a platform, and finally, ensures that the event bus of asynchronous communication can realize efficient transmission of treatment results, avoids request blocking, improves the operation performance of the platform and meets the service growth requirement of a SaaS platform.

Inventors

  • REN JIANAN

Assignees

  • 北京白驹易行科技有限公司

Dates

Publication Date
20260508
Application Date
20251223

Claims (10)

  1. 1. A method for processing a service request, the method comprising: acquiring a service request triggered by a user client; analyzing the service request to obtain a request type of the service request; Sending the service request to a target server corresponding to the request type, and calling corresponding resources through the target server to process the service request to obtain a processing result; And receiving a processing result sent by the target server based on an event bus, and sending the processing result corresponding to the service request to the user client to respond to the service request, wherein the event bus is an asynchronous message communication line arranged between the target server for processing the service request and the user client.
  2. 2. The method of claim 1, wherein the sending the service request to the target server corresponding to the request type, and invoking the corresponding resource through the target server to process the service request, and obtaining the processing result, includes: if the request type is a read type, using a query server corresponding to the read type as the target server, and sending the service request to the query server; And reading corresponding target data from a reading database through the query server, and taking the target data as the processing result.
  3. 3. The method of claim 1, wherein the sending the service request to the target server corresponding to the request type, and invoking the corresponding resource through the target server to process the service request, and obtaining the processing result, includes: If the request type is a write type, taking a write server corresponding to the write type as the target server, and sending the service request to the write server; And writing the target data carried in the request type into a write database by the write server according to a transaction management mechanism, and detecting whether the target data is successfully written or not to obtain the processing result.
  4. 4. The method of claim 1, wherein the sending the processing result corresponding to the service request to the user client includes: acquiring the context information associated with the service request; Dynamic routing is carried out based on the context information, and the network state and the behavior characteristics of the user client are determined; and sending the processing result to the user client according to the network state or the sending strategy corresponding to the behavior characteristic.
  5. 5. The method according to claim 4, wherein the sending the processing result to the user client according to the sending policy corresponding to the network state or the behavior feature includes: If the network state is a weak network state, the event bus calls a data compression component to compress the processing result and sends the compressed processing result to the user client; If the behavior characteristic is that the user client side has a plurality of continuous service requests in a preset time window, the event bus combines processing results in the preset time window to obtain combined processing results, and the combined processing results and the context information are sent to the user client side.
  6. 6. The method according to claim 1, wherein the method further comprises: If the request type is a write type, monitoring whether a write database generates a target event through the event bus, wherein the target event is generated after target data is written in by the write database; If a target event is generated, the target event is transmitted to a reading database, and data change information in the target event is analyzed through the reading database so as to complete updating operation of corresponding data.
  7. 7. The method of claim 6, wherein the method further comprises: if the target event is not generated, triggering a compensation mechanism; comparing and checking the target data of the service request with the data currently stored in the write database based on the compensation mechanism to obtain a processing state; and performing targeted processing according to the processing state to obtain a confirmation result of data writing.
  8. 8. A service request processing apparatus, the apparatus comprising: The acquisition module is used for acquiring a service request triggered by a user client; the analysis module is used for analyzing the service request to obtain the request type of the service request; The sending module is used for sending the service request to a target server corresponding to the request type, and calling corresponding resources through the target server to process the service request to obtain a processing result; And the processing module is used for receiving the processing result sent by the target server based on an event bus and sending the processing result corresponding to the service request to the user client so as to respond to the service request, wherein the event bus is an asynchronous message communication line arranged between the target server for processing the service request and the user client.
  9. 9. A computer device, comprising: A memory and a processor in communication with each other, the memory having stored therein computer instructions which, upon execution, cause the processor to perform the method of any of claims 1 to 7.
  10. 10. A computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of any one of claims 1 to 7.

Description

Service request processing method, device, equipment and medium Technical Field The present application relates to the field of service processing, and in particular, to a method, an apparatus, a device, and a medium for processing a service request. Background Under the promotion of the rapid popularization of cloud computing and big data technology, the SaaS platform becomes a core implementation mode of enterprise informatization construction by virtue of the characteristics of no need of local deployment, pay-per-view and rapid iteration, and is widely applied to various business scenes such as customer management, production scheduling, financial management and the like of enterprises. With the deep advancement of enterprise digital transformation, the service scale borne by the SaaS platform is continuously expanded, the total amount, dimension and growth speed of service data are continuously improved, and the complexity of service logic is also increased. The traditional single architecture concentrates all service modules, data processing and service interfaces of the SaaS platform in a single code library and an operation example, has the advantages of low development difficulty and simple deployment flow in the early stage of platform development, but gradually exposes obvious adaptation defects that all modules share computing and storage resources, independent resource expansion cannot be carried out on a single highly concurrent service module, the expandability is insufficient, the code coupling degree is high, the single module is modified to recompile and deploy the whole module, the service iteration period is prolonged, the fault influence range is also improved, the operation performance of the platform is difficult to ensure, meanwhile, the single architecture binds a fixed technical stack, an optimal technical scheme cannot be flexibly adapted according to the requirements of different service modules, the flexibility is lost, and the continuous development of the SaaS platform is difficult to support. Disclosure of Invention In view of the above, the embodiments of the present application provide a method, an apparatus, a device, and a medium for processing a service request, so as to solve the problems that an SaaS platform with a traditional single architecture cannot realize independent resource expansion for service growth, the iteration efficiency is low, the fault impact range is large due to high code coupling degree, and the technology stack binding lacks flexibility, so that the requirements of the SaaS platform on expandability, performance and flexibility are difficult to meet. In a first aspect, an embodiment of the present application provides a method for processing a service request, where the method includes: acquiring a service request triggered by a user client; analyzing the service request to obtain a request type of the service request; Sending the service request to a target server corresponding to the request type, and calling corresponding resources through the target server to process the service request to obtain the processing result; And receiving a processing result sent by the target server based on an event bus, and sending the processing result corresponding to the service request to the user client to respond to the service request, wherein the event bus is an asynchronous message communication line arranged between the target server for processing the service request and the user client. Further, the sending the service request to the target server corresponding to the request type, and calling corresponding resources through the target server to process the service request, so as to obtain the processing result, including: if the request type is a read type, using a query server corresponding to the read type as the target server, and sending the service request to the query server; And reading corresponding target data from a reading database through the query server, and taking the target data as the processing result. Further, the sending the service request to the target server corresponding to the request type, and calling corresponding resources through the target server to process the service request, so as to obtain the processing result, including: If the request type is a write type, taking a write server corresponding to the write type as the target server, and sending the service request to the write server; and writing target data carried in the request type into the writing database by the writing server according to a transaction management mechanism, and detecting whether the target data is successfully written or not to obtain the processing result. Further, the sending the processing result corresponding to the service request to the user client includes: acquiring the context information associated with the service request; Dynamic routing is carried out based on the context information, and the network state and the behavior chara