CN116643849A - Service logic processing method, device, computer equipment and storage medium - Google Patents

Service logic processing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116643849A
CN116643849A CN202210143424.8A CN202210143424A CN116643849A CN 116643849 A CN116643849 A CN 116643849A CN 202210143424 A CN202210143424 A CN 202210143424A CN 116643849 A CN116643849 A CN 116643849A
Authority
CN
China
Prior art keywords
event
service process
attribute
processing
management thread
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.)
Pending
Application number
CN202210143424.8A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210143424.8A priority Critical patent/CN116643849A/en
Publication of CN116643849A publication Critical patent/CN116643849A/en
Pending legal-status Critical Current

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/465Distributed object oriented systems
    • 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/466Transaction processing
    • 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

Abstract

The application relates to a business logic processing method, a business logic processing device, computer equipment, a storage medium and a computer program product. According to the method, the attention event is set, then the service logic is driven through the event based on the event management thread, meanwhile, the object attribute requirement on which the service logic depends is extracted, and the object attribute requirement is written into the attribute requirement thread, so that the synchronous processing of the attribute information is realized.

Description

Service logic processing method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a service logic processing method, apparatus, computer device, storage medium, and computer program product.
Background
With the development of computer technology, computer-based business processing is also becoming more and more important. In the logic processing based on computer services, coupling phenomenon is common. Coupling means the degree of association between two subsystems (or classes), and when one subsystem (or class) changes with little impact on the other subsystem (or class), they are said to be loosely coupled; conversely, if the effects of the changes are large, they are said to be tightly coupled. The coupling strength depends on the complexity between the modules, the location of the referenced modules, the manner of data transfer, etc. The coupling degree between the modules should be as small as possible during design, and the coupling degree between the modules directly affects the understandability, testability, reliability and maintainability of the system.
In some technical scenes, such as game service logic in the traditional technology, the coupling phenomenon is very serious, and the game contains a large amount of logic coupling and context information coupling, so that service splitting cannot be realized.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a service logic processing method, apparatus, computer device, computer readable storage medium, and computer program product that can effectively implement service logic decoupling and implement service splitting.
In a first aspect, the present application provides a service logic processing method. The method comprises the following steps:
responding to a target object login event, and determining a master business service process and a slave business service process;
acquiring a concerned event and object attribute requirement corresponding to the target object through the subordinate business service process, and respectively constructing a concerned event processing set and an attribute requirement set;
writing the concerned event processing set into an event management thread in the main service process, and writing the attribute demand set into an attribute management thread in the main service process;
when the event management thread recognizes that the attention event is triggered, executing predefined processing logic corresponding to the attention time in the subordinate business service process based on the triggered attention event;
When the attribute information change is identified through the attribute management thread, based on the changed attribute subset information, executing the attribute information synchronization processing corresponding to the attribute subset information in the subordinate business service process.
In a second aspect, the application further provides a service logic processing device. The device comprises:
the login response module is used for responding to a target object login event and determining a main business service process and a subordinate business service process;
the collection construction module is used for acquiring the attention event and the object attribute requirement corresponding to the target object through the subordinate business service process and respectively constructing an attention event processing collection and an attribute requirement collection;
the event writing module is used for writing the concerned event processing set into an event management thread in the main service process and writing the attribute demand set into an attribute management thread in the main service process;
an event driven module, configured to execute, in the slave business service process, predefined processing logic corresponding to the attention time based on the triggered attention event when the attention event is identified to be triggered by the event management thread;
And the attribute synchronization module is used for executing the attribute information synchronization processing corresponding to the attribute subset information in the subordinate business service process based on the changed attribute subset information when the attribute information change is identified through the attribute management thread.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
responding to a target object login event, and determining a master business service process and a slave business service process;
acquiring a concerned event and object attribute requirement corresponding to the target object through the subordinate business service process, and respectively constructing a concerned event processing set and an attribute requirement set;
writing the concerned event processing set into an event management thread in the main service process, and writing the attribute demand set into an attribute management thread in the main service process;
when the event management thread recognizes that the attention event is triggered, executing predefined processing logic corresponding to the attention time in the subordinate business service process based on the triggered attention event;
When the attribute information change is identified through the attribute management thread, based on the changed attribute subset information, executing the attribute information synchronization processing corresponding to the attribute subset information in the subordinate business service process.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
responding to a target object login event, and determining a master business service process and a slave business service process;
acquiring a concerned event and object attribute requirement corresponding to the target object through the subordinate business service process, and respectively constructing a concerned event processing set and an attribute requirement set;
writing the concerned event processing set into an event management thread in the main service process, and writing the attribute demand set into an attribute management thread in the main service process;
when the event management thread recognizes that the attention event is triggered, executing predefined processing logic corresponding to the attention time in the subordinate business service process based on the triggered attention event;
When the attribute information change is identified through the attribute management thread, based on the changed attribute subset information, executing the attribute information synchronization processing corresponding to the attribute subset information in the subordinate business service process.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
responding to a target object login event, and determining a master business service process and a slave business service process;
acquiring a concerned event and object attribute requirement corresponding to the target object through the subordinate business service process, and respectively constructing a concerned event processing set and an attribute requirement set;
writing the concerned event processing set into an event management thread in the main service process, and writing the attribute demand set into an attribute management thread in the main service process;
when the event management thread recognizes that the attention event is triggered, executing predefined processing logic corresponding to the attention time in the subordinate business service process based on the triggered attention event;
When the attribute information change is identified through the attribute management thread, based on the changed attribute subset information, executing the attribute information synchronization processing corresponding to the attribute subset information in the subordinate business service process.
The business logic processing method, the business logic processing device, the computer equipment, the storage medium and the computer program product determine a master business service process and a slave business service process by responding to a target object login event; acquiring an attention event and object attribute requirements corresponding to a target object through a subordinate business service process, and respectively constructing an attention event processing set and an attribute requirement set; writing the concerned event processing set into an event management thread in the main service process, and writing the attribute demand set into an attribute management thread in the main service process; when the event management thread recognizes that the attention event is triggered, based on the triggered attention event, executing predefined processing logic corresponding to the attention time in the subordinate business service process; when the attribute information change is identified through the attribute management thread, executing the attribute information synchronization corresponding to the attribute subset information in the subordinate business service process based on the changed attribute subset information. According to the method, the system and the device, the attention event is set, then the service logic is driven through the event based on the event management thread, meanwhile, the object attribute requirement on which the service logic depends is extracted and written into the attribute requirement thread, so that the synchronous processing of the attribute information is realized.
Drawings
FIG. 1 is an application environment diagram of a business logic processing method in one embodiment;
FIG. 2 is a flow diagram of a business logic processing method in one embodiment;
FIG. 3 is a flow diagram of steps for identifying a decision event of interest based on event decision attribute information in one embodiment;
FIG. 4 is a flowchart illustrating a step of writing event resource update data into a preset service resource database according to an embodiment;
FIG. 5 is a flow diagram of cross-process event processing steps in one embodiment;
FIG. 6 is a flow chart illustrating the steps of event reissuing processing in one embodiment;
FIG. 7 is a flow chart illustrating a prior art event reissuing process without performing the steps in accordance with one embodiment;
FIG. 8 is a flow chart illustrating steps performed in an event reissuing process in one embodiment;
FIG. 9 is a schematic diagram of a game service logic coupling scenario in one embodiment;
FIG. 10 is a schematic diagram of the decoupling concept of business logic processing in one embodiment;
FIG. 11 is a schematic diagram of event driven & & attribute synchronization in one embodiment;
FIG. 12 is a schematic diagram of a token bucket throttling algorithm in one embodiment;
FIG. 13 is a block diagram of an architecture of a business logic processing device in one embodiment;
Fig. 14 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The business logic processing method provided by the embodiment of the application can be applied to the application environment shown in the figure 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The target object may process a service on the terminal 102, and the server 104 is configured to provide a service processing environment for the target object, and when the server 104 recognizes that the service provided for the target object enters a login state, the master service process and the slave service process may be determined by responding to the target object login event; acquiring an attention event and object attribute requirements corresponding to a target object through a subordinate business service process, and respectively constructing an attention event processing set and an attribute requirement set; writing the concerned event processing set into an event management thread in the main service process, and writing the attribute demand set into an attribute management thread in the main service process; when the event management thread recognizes that the attention event is triggered, based on the triggered attention event, executing predefined processing logic corresponding to the attention time in the subordinate business service process; when the attribute information change is identified by the attribute management thread, based on the changed attribute subset information, executing the attribute information synchronization processing corresponding to the attribute subset information in the subordinate business service process. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In this context, it is to be understood that the terms involved:
GameSvr: and realizing the service process of the core game logic.
Pvpsvr: and realizing the service process of the specific scene playing method.
TaskSvr: and realizing the service process of the game task system.
DB: a database service storing game data.
In one embodiment, as shown in fig. 2, a service logic processing method is provided, and the method is applied to the server 104 in fig. 1 for illustration, and includes the following steps:
in step 201, a master business service process and a slave business service process are determined in response to a target object login event.
Step 203, obtaining the attention event and the object attribute requirement corresponding to the target object through the subordinate business service process, and respectively constructing an attention event processing set and an attribute requirement set.
The target object specifically refers to a user who performs service processing through a service system provided by the server 104, the server 104 may remotely provide service system services for the target object through the terminal 102 of the target object party, and when the target object logs in the service system through the terminal to perform service processing, the server may identify that the service provided for the target object enters a login state. The main service process refers to a process for implementing service core logic. The subordinate business service process specifically refers to a process for realizing various subordinate businesses in a server. In one embodiment, the main service process specifically refers to a service process GameSvr that implements core game logic. The subordinate business service processes specifically comprise a service process Pvpsvr for realizing a specific scene playing method, a service process TaskSvr for realizing a game task system and the like, and the subordinate business service processes can interact with the main business service process. In the existing business logic processing, functions realized by the slave business service process may be highly coupled with the master business logic, and at the moment, the functions realized by the slave business service process are difficult to be independent in a module form. In this embodiment, the process of implementing the service logic by the slave service process is only illustrated by one service process, and in practical application, a plurality of different slave service processes can be started simultaneously in the server 104 according to the service requirement to interact with the implementing master service process, so as to implement the service logic process of the present application. The attention event corresponding to the target object specifically corresponds closely to the subordinate business service process, and the server 104 can trigger the business logic through the change of the attention event. The attention event processing set is a set constructed based on attention events, and event management for a target object can be realized through the set. In one embodiment, the subordinate business service process is used for realizing task playing in the game, and the attention event corresponding to the target object is an event bound to the task being executed by the target object, and the attention event processing set is an event condition bound to the task being executed by the target object. Similarly, when the object attribute requirement is the attribute of the target object required for realizing the business logic, all the attribute requirements are integrated, and then the attribute requirement set can be constructed. When the subordinate business service process is used for realizing the task playing method in the game, the attribute requirement set is the attribute requirement set which is needed to be used by the player in the task system.
The application is particularly used for decoupling the master business service process and the slave business service process in business logic. Therefore, when the business service provided for the target object is identified to enter the login state, the business service corresponding to the target object can be determined, and the business logic is processed, and at the moment, each service process can be driven by an event. Taking the determined subordinate business service process as an example, firstly, collecting events which need to be focused by a target object and corresponding attribute requirements in the process of providing business service for the target object through the subordinate business service process, so as to construct and obtain a focused event processing set and an attribute requirement set. In one embodiment, the slave service process is specifically a service process TaskSvr for implementing a game task system, and at this time, after a target object logs in a game, the TaskSvr collects an event processing set (i.e. an event condition bound by a task being executed) that a player needs to pay attention to in the task system, and sends the collected event processing set to the service process GameSvr for implementing core game logic, so as to start processing of the game service logic.
Step 205, the concerned event processing set is written into an event management thread in the main service process, and the attribute requirement set is written into an attribute management thread in the main service process.
The event management thread is used for carrying out event management in the main service process and realizing event driving. And the attribute management thread is used for carrying out attribute management in the main service process and realizing attribute synchronization.
Specifically, the slave business service process may send the data to the master business service process after constructing the attention event processing set and the attribute requirement set, and the master business service process registers the attention event processing set to the event management thread of the target object, so as to implement event-driven management based on the event management thread in the master business service process. Meanwhile, the main service process registers the attribute requirement set to the attribute management thread of the target object, so that the attribute synchronization management is realized based on the attribute management thread in the main service process.
Step 207, when the event management thread identifies that the attention event is triggered, based on the triggered attention event, executing the predefined processing logic corresponding to the attention time in the subordinate business service process.
Step 209, when the attribute information change is identified by the attribute management thread, based on the changed attribute subset information, executing the attribute information synchronization process corresponding to the attribute subset information in the subordinate business service process.
Wherein the predefined processing logic specifically refers to a preset operation according to a subordinate business service process, and if in one embodiment, the subordinate business service process is a service process for implementing the game task system, the predefined processing logic at this time may include changing a task state.
Specifically, when the target object performs service processing on the terminal 102, the attention event can be triggered in the processing process, and the main service process can identify the operation of triggering the attention event by the target object through the event management thread. For example, when the target object plays the in-game task play method and reaches the task completion condition, the target object can trigger the task submitting operation on the game interface by clicking, then the master business service process can identify the task submitting operation of the target object and then forward the event to the slave business service process, so that the business logic processing operation after the task triggering is completed by the slave business service process. In one embodiment, before forwarding the event to the slave service process, the master service process may further execute an event processing logic to perform event filtering, and only the filtered useful event may be forwarded to the slave service process, for example, whether the user achieves the task condition may be determined by the attribute management thread, and only after achieving the task condition, the master service process may forward the event to the slave service process. Meanwhile, the server 104 can also realize attribute information synchronization processing, when the target object plays a game, the attribute in the attribute management thread can be changed according to the play progress of the player, and when part of the attribute in the attribute management thread is changed, the main business service process can synchronize the changed part of information to the subordinate business service process. So that the slave business service process will have a portion of the attribute set in the master business service process attribute set. The information of the attribute corpus is much, while the information of the attribute subset needed by the subordinate business service processes is less, thereby reducing unnecessary network consumption.
According to the business logic processing method, the main business service process and the subordinate business service process are determined by responding to the target object login event; acquiring an attention event and object attribute requirements corresponding to a target object through a subordinate business service process, and respectively constructing an attention event processing set and an attribute requirement set; writing the concerned event processing set into an event management thread in the main service process, and writing the attribute demand set into an attribute management thread in the main service process; when the event management thread recognizes that the attention event is triggered, based on the triggered attention event, executing predefined processing logic corresponding to the attention time in the subordinate business service process; when the attribute information change is identified through the attribute management thread, executing the attribute information synchronization corresponding to the attribute subset information in the subordinate business service process based on the changed attribute subset information. . According to the method, the system and the device, the attention event is set, then the service logic is driven through the event based on the event management thread, meanwhile, the object attribute requirement on which the service logic depends is extracted and written into the attribute requirement thread, so that the synchronous processing of the attribute information is realized.
In one embodiment, as shown in FIG. 3, step 205 includes:
step 302, when the event management thread recognizes that the attention event is triggered, the event judgment attribute information corresponding to the target object is read from the event management thread.
Step 304, when the event concerned is judged to be a useful event based on the event judgment attribute information and the preset event triggering processing logic, based on the triggered concerned event, executing the predefined processing logic corresponding to the concerned event in the subordinate business service process.
The event determination attribute information is used to determine an event, and the main service process in the server 104 may determine, through the event determination attribute information, whether the current triggered attention event needs to be processed, by performing a determination of the event processing logic, so as to filter out useless events that do not need to be processed. Useful events refer to events that are useful for executing predefined processing logic in a dependent business service process as opposed to non-useful events, which refer to events that are not useful for executing predefined processing logic in a dependent business service process. If the target object has reached the task completion condition, the user-triggered task completion operation is a useful event, and if the target object has not reached the task completion condition, the user-triggered task completion operation is a useless event.
Specifically, in order to ensure that only useful events are pushed to the subordinate business service processes, the accuracy and timeliness of business logic processing are ensured. The server 104 may add corresponding event determination processing logic before the event forwarding, and when the event management thread recognizes that the concerned event is triggered, the event is not directly sent to the slave service process, but it is determined whether the triggered event belongs to a useful event, and only the useful event is forwarded to the slave service process to drive the corresponding game service process and the slave service process. In the determining, the determining may be specifically implemented by the attribute information corresponding to the target object, so that after the target object triggers the attention event, the main service process may read the event determination attribute information corresponding to the target object from the attribute management thread. The type of the triggered concerned event is judged based on the event judgment attribute information, the main business service process forwards the concerned event to the subordinate business service process only when the concerned event is judged to be a useful event, and the concerned event is directly abandoned when the judgment is not passed. In this embodiment, the triggered attention event is determined by reading the event determination attribute information, so that whether the event triggered by the user is useful or not can be identified before the event-driven forwarding, thereby avoiding forwarding the useless event to the subordinate service process and ensuring the processing efficiency of the game service logic.
In one embodiment, step 302 includes: when the event management thread recognizes that the concerned event is triggered, the event judgment attribute information corresponding to the target object is read from the attribute management thread based on the token bucket current limiting algorithm.
The token bucket algorithm is one of more common current limiting algorithms, and approximately comprises the following flow: 1) All requests need to take an available token before being processed; 2) Adding tokens into the barrel according to a certain rate according to the size of the current limit; 3) The bucket sets the maximum placed token limit, and when the bucket is full, the newly added token is discarded or rejected; 4) After the request is reached, firstly, obtaining the tokens in the token bucket, carrying the tokens, then, carrying out other service logic, and directly deleting the tokens after the service logic is processed; 5) The token bucket has a minimum limit, and when tokens in the bucket reach the minimum limit, the tokens are not deleted after the request is processed, so that enough current limit is ensured. For example, in a game scene, since a game scene can instantaneously generate a large number of events, as long as the events are not continuously generated, the total event amount in a certain period may not be large, and it is not necessary to start filtering. However, other current limiting algorithms (counter, leaky bucket algorithm) do not meet this characteristic, so the application uses token bucket current limiting to optimize the event filtering opening opportunity.
Specifically, the application adopts an event-driven mode to carry out service logic processing, and the largest difference between the event and the message is the publishing and subscribing capability of the event, besides decoupling through event driving, useless events can be effectively filtered, and the asynchronous overhead of the network is reduced. Because the events concerned in different stages of the task are different, and the conditional judgment logic can start the conditional pre-filtering logic with finer granularity when the event quantity (instantaneous) is larger, the events which do not meet the conditions do not need to be sent to the subordinate business service process, the event filtering start time optimization can be realized by limiting the flow of a token bucket, and the flow limitation can be started only when the token in the token bucket is used up and useless events are filtered by reading the event judgment attribute information corresponding to the target object from the attribute management thread. In this embodiment, the token bucket current limiting is used to implement optimization of the event filtering opening time, so that the event processing efficiency when the event flow is large can be effectively ensured.
In one embodiment, step 205 comprises: when the event of interest is identified to be triggered through the event management thread, based on the triggered event of interest, predefined processing logic corresponding to the event of interest is executed through cross-process event processing in the subordinate business service process.
The cross-process event processing refers to special event processing logic, which allows the main service process to complete the event processing logic at the moment of receiving the event, and immediately process the subsequent event without waiting for the event.
In particular, in current business logic processing, a main business service process generally implements event interaction processing with a plurality of different service processes by blocking an asynchronous model. If the game comprises three different processes Client, DS and Pvpsvr, when the processes are all activated, when each process generates an event at the same time and sends the event to the main business service process for event processing, the main business service process generates an event to be processed, the event 1 of the Client arrives first, if the asynchronous model is blocked, the main business service process needs a certain time to process the event 1, so the event 2 of the DS can only be queued in the event queue first after arriving, the event 2 can be processed after the event 1 is processed, a plurality of events can be cached in the event queue along with the continuous increase of unprocessed events, and once the main business service process is abnormal, the events in the event queue can be lost completely. If the cross-process event processing model without blocking immediate processing is adopted, the main service process can directly complete the event processing logic at the moment of receiving the event 1, and then the event can be immediately processed when receiving the event 2 without waiting or having an event queue. In this embodiment, event processing of different service processes is performed by a cross-process event processing manner, so that event blocking caused by abnormal service processes of the core logic can be effectively avoided, and the processing efficiency of the service logic is improved.
In one embodiment, as shown in FIG. 4, step 205 includes:
step 401, acquiring event resource update data by executing predefined processing logic corresponding to the concerned event through cross-process event processing in the subordinate business service process.
And step 403, writing the event resource update data into a preset service resource database, and executing the next attention event corresponding to the current triggered attention event.
Step 405, obtaining a data writing result message fed back by a preset service resource database.
Step 407, when the data writing result message is a data writing failure message, re-writing the event resource update data into the preset service resource database.
In particular, if cross-process event processing is employed in the service process, event blocking may be caused by read-write operations of the service resource database. In order to avoid such blocking, during the process of executing the predefined processing logic, the server 104 first executes the predefined processing logic corresponding to the attention event, after obtaining the event resource update data, if the data needs to be saved in the service resource database DB, the part of event resource update data may be directly written into the service resource database, while the reply of the game resource data is not waited, it is directly determined that the event resource update data has been written successfully, and the next attention event corresponding to the current triggered attention event is directly executed, so as to avoid blocking. When receiving the data writing failure message fed back by the preset service resource database, the writing needs to be retried. At this time, the event resource update data needs to be written into the preset service resource database again. In one embodiment, the cross-process event processing according to the present application may be shown in fig. 5, and as shown in the upper left diagram in fig. 5, in the existing event queue processing manner, if an abnormality occurs in the main service process GameSvr, it is possible to cause all events in the event queue to be lost. When the cross-process event processing is carried out, the GameSvr can directly process the event when receiving the event, waiting is not needed, and the event can be effectively prevented from being lost. When the event processing is performed in the slave service process, as shown in fig. 5 and the lower left diagram, the processing mode of concurrent processing may be disordered, as shown in the lower middle diagram in fig. 5, the processing efficiency is lower in the mode of serial processing, and as shown in the lower right diagram in fig. 5, the processing mode in the embodiment is high in unblocking efficiency. Event queues are not needed, and reliability is high. In this embodiment, by directly writing the event resource update data into the preset service resource database, and not waiting for the feedback result of the preset service resource database, asynchronous blocking caused by the response of the preset service resource database can be effectively avoided, and the event processing efficiency is improved.
In one embodiment, as shown in fig. 6, after executing the predefined processing logic corresponding to the attention event in the slave business service process, the method further includes:
and step 601, reading an event processing result message fed back by the subordinate business service process.
Step 603, extracting the update data of the concerned event processing set in the event processing result.
Step 605, updating the event management thread of the target object based on the attention event processing set update data.
In step 607, event reissuing processing is performed according to the updated event management thread of the target object.
After executing the predefined processing logic, the slave business service process can generate a corresponding event processing result, and the event processing result is fed back to the master business service process, wherein the event processing result message comprises the processing result of the predefined processing logic on the concerned event. In addition, the event processing result message also contains update data of the concerned event, which is used for updating the concerned event in the event management thread in the main service process.
Specifically, the application also comprises event reissue processing procedures between event processing. The event reissue is mainly used for timely reissuing the event after the concerned event changes, so that event loss is avoided. In one specific embodiment, as shown in fig. 7, the master service process is a GameSvr, the slave service process is specifically a TaskSvr, in the initial game service processing process, the attention event corresponding to the target object only includes event 1 and event 5, if a new attention event No. 3 event is generated, but before the new attention event is not transferred to the GameSvr, the GameSvr generates No. 3 event, and since the GameSvr does not know that the attention event No. 3 is required at the time, the event No. 3 is filtered, which will result in the loss of the event No. 3 triggered by the slave service process TaskSvr. At this time, the event number 3 may be prevented from being lost by an event reissuing operation, as shown in fig. 8, a sequence number is added to the event, and both Gemsvr and TaskSvr maintain the sequence number of the current process. When the GameSvr generates the event 1, the sequence number seq of the event 1 is set to be 1, and the sequence number curseq=0 of the event currently processed by the GameSvr is completed. The TaskSvr, upon receipt of event 1, finds that the filter set is empty, so event 1 is immediately processed while setting its own processed sequence number m_curseq to the value 1 of event 1 seq. At the same time, the replied message is notified that the GameSvr has processed the event of seq=1, i.e., ackseq=1. The GameSvr has generated event 3 of seq=101 before receiving this reply, which is buffered in the queue. And then generating event number 5 with seq=201, taking the event set in the buffer queue as a filtering set when the event number 5 is sent to the TaskSvr, and when the TaskSvr receives event number 5 with seq 201, suspending processing logic of the event number 5 and waiting for the event number 3 to be reissued by the GameSvr so as to prevent the event from being lost when the event number 3 is found to be contained in the filtering set. In the embodiment, by adding the event reissue mechanism, the event loss in the event processing process can be effectively prevented, and the accuracy of service logic processing is ensured.
The application also provides an application scene, which applies the service logic processing method.
Specifically, the application of the service logic processing method in the application scene is as follows:
when a user plays a mobile game through a mobile phone terminal, the business logic processing of the mobile game can be realized through the business logic processing method. As for the task play in the mobile game, as shown in the left diagram in fig. 9, in the scheme without enabling the technology, the task is highly coupled with the context information, so that the task play is difficult to be independent from the core game business logic. The middle diagram in fig. 9 is a scheme of using event and attribute system splitting logic in the present application, and the right diagram in fig. 9 is a scheme of further splitting into micro services based on event and attribute system splitting logic, wherein the task system is split into independent TaskSvr, taskSvr data to be stored in a DB (database), so as to realize stateless clustering of the task svr service. The decoupling concept of the service logic process in the present application may refer to fig. 10, and the principle of event-driven & & attribute synchronization in service logic process may refer to fig. 11 specifically, after a player logs in a game, the TaskSvr may collect an event processing set that the player needs to pay attention to in the task system (i.e. an event condition bound by a task being executed), send the collected event processing set to GameSvr, gameSvr to register it to a player event management thread, when the event of the player on the GameSvr triggers, execute the event processing set to a corresponding event processing logic 1 (the logic may or may not perform filtering), directly forward the event to the TaskSvr for processing, where the event processing logic may determine using attribute information of the player, and if it does, the event processing logic determines that the event is not to be discarded directly (i.e. a useless event is filtered), and if it does, then the event processing logic 2 continues to send the event to TaskSvr, taskSvr, and if the event management thread of the player also registers the event, the event processing logic 2 may perform some self-defined operations, including changing the task state, or may also use the attribute information of the part of the synchronization from the GameSvr. After a player logs in a game, the TaskSvr collects attribute sets needed by the player in the task system in addition to event processing logic, the needed attribute sets are sent to GameSvr, gameSvr and registered in the attribute system, the registered attribute is sent to the TaskSvr at one time initially, and then each time the attribute is changed, the GameSvr can speak the changed information to the TaskSvr synchronously. So that the TaskSvr will have a part of the property set of the GameSvr property set. The information of the attribute corpus is much, while the information of the attribute subset needed by the TaskSvr is less, thereby reducing unnecessary network consumption. Meanwhile, in the scheme of the application, a processing mode of cross-process event processing can be adopted to prevent event loss caused by event queue blocking, and data is stored in a Database (DB), so that in order to avoid blocking, replies of the database DB when the data is stored are unequal, the data writing is directly considered to be successful, and if the data writing fails, the subsequent re-writing attempt is carried out. In addition, the application can effectively filter unnecessary events, thereby reducing network asynchronous overhead. When filtering is performed, conditional decision logic can be performed, and when the event quantity (instantaneous) is relatively large, the conditional pre-filtering logic with finer granularity can be started, and the event which does not meet the condition is not sent to the TaskSvr. In the application, event filtering and starting time optimization is performed based on a token bucket current limiting algorithm, and specifically, as shown in fig. 12, taskSvr is a service process for realizing a game task system, and GameSvr is a service process for realizing core game logic. First, the TaskSvr configures out all event sets {1,3,5} of interest according to the configuration. When the filtering mechanism is not started, all events are not stored in the cache queue and are only sent immediately or discarded directly, and invalid events in the event set are not discarded. And switch to finer temporal condition filtering when a large number of invalidating events drain the token bucket. In this process, most of the condition sets of event number 5 do not satisfy the condition, are filtered to be dropped to the cache queue, while the condition sets of event number 3 do not satisfy the condition, are filtered to be dropped to the cache queue. And after the TaskSvr finishes processing the event No. 1, an event condition ackseq=1 can be added to realize the reissue operation of the event No. 1 in the GameSvr. And when the token bucket capacity is restored to be full and the ackseq of the last time is received, the queue of the discard time buffer is empty, and the condition filtering confirmation mechanism is closed.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a service logic processing device for realizing the service logic processing method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of one or more service logic processing devices provided below may refer to the limitation of the service logic processing method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 13, there is provided a service logic processing apparatus, including: the system comprises a set construction module, an event registration module and a logic processing module, wherein:
the login response module 1302 is configured to determine a master business service process and a slave business service process in response to the target object login event.
The set construction module 1304 is configured to acquire, through the subordinate business service process, a focused event and an object attribute requirement corresponding to the target object, and respectively construct a focused event processing set and an attribute requirement set.
The event writing module 1306 is configured to write the attention event processing set to an event management thread in the main service process, and write the attribute requirement set to an attribute management thread in the main service process.
An event driven module 1308 for executing the predefined processing logic corresponding to the time of interest in the dependent business service process based on the triggered event of interest when the event of interest is identified to be triggered by the event management thread.
And an attribute synchronization module 1310, configured to, when the attribute information change is identified by the attribute management thread, perform, based on the changed attribute subset information, an attribute information synchronization process corresponding to the attribute subset information in the subordinate business service process.
In one embodiment, the logic processing module 1306 is specifically configured to: when the event management thread recognizes that the concerned event is triggered, the event judgment attribute information corresponding to the target object is read from the event management thread; when the event concerned is judged to be a useful event based on the event judgment attribute information and the preset event triggering processing logic, the predefined processing logic corresponding to the event concerned is executed in the subordinate business service process based on the triggered event concerned.
In one embodiment, the logic processing module 1306 is further configured to: when the event management thread recognizes that the concerned event is triggered, the event judgment attribute information corresponding to the target object is read from the attribute management thread based on the token bucket current limiting algorithm.
In one embodiment, the logic processing module 1306 is further configured to: when the event of interest is identified to be triggered through the event management thread, based on the triggered event of interest, predefined processing logic corresponding to the event of interest is executed through cross-process event processing in the subordinate business service process.
In one embodiment, the logic processing module 1306 is further configured to: acquiring event resource update data by executing predefined processing logic corresponding to an attention event through cross-process event processing in a subordinate business service process; writing the event resource update data into a preset service resource database, and executing the next concerned event corresponding to the current triggered concerned event; acquiring a data writing result message fed back by a preset service resource database; and when the data writing result message is a data writing failure message, re-writing the event resource updating data into a preset service resource database.
In one embodiment, the system further comprises an event reissuing module for: reading an event processing result message fed back by the subordinate business service process; extracting the update data of the concerned event processing set in the event processing result; updating the event management thread based on the event processing set update data of interest; and executing event reissue processing according to the updated event management thread.
The various modules in the service logic processing device described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 14. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used to store data generated during the business logic process. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a business logic processing method.
It will be appreciated by those skilled in the art that the structure shown in fig. 14 is merely a block diagram of a portion of the structure associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements are applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, storing a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-described method embodiments.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. A business logic processing method, the method comprising:
responding to a target object login event, and determining a master business service process and a slave business service process;
acquiring a concerned event and object attribute requirement corresponding to the target object through the subordinate business service process, and respectively constructing a concerned event processing set and an attribute requirement set;
Writing the concerned event processing set into an event management thread in the main service process, and writing the attribute demand set into an attribute management thread in the main service process;
when the event management thread recognizes that the attention event is triggered, executing predefined processing logic corresponding to the attention time in the subordinate business service process based on the triggered attention event;
when the attribute information change is identified through the attribute management thread, based on the changed attribute subset information, executing the attribute information synchronization processing corresponding to the attribute subset information in the subordinate business service process.
2. The method of claim 1, wherein the executing the predefined processing logic corresponding to the time of interest in the slave business service process based on the triggered event of interest when the event of interest is identified to be triggered by the event management thread comprises:
when the event management thread recognizes that the concerned event is triggered, event judgment attribute information corresponding to a target object is read from the event management thread;
And when the event-triggering processing logic judges that the concerned event is a useful event based on the event judging attribute information and the preset event, executing the predefined processing logic corresponding to the concerned event in the subordinate business service process based on the triggered concerned event.
3. The method according to claim 2, wherein the reading, from the event management thread, event determination attribute information corresponding to a target object when the event of interest is identified to be triggered by the event management thread, includes:
when the event management thread recognizes that the concerned event is triggered, the event judgment attribute information corresponding to the target object is read from the attribute management thread based on a token bucket flow limiting algorithm.
4. The method of claim 1, wherein the executing the predefined processing logic corresponding to the time of interest in the slave business service process based on the triggered event of interest when the event of interest is identified to be triggered by the event management thread comprises:
when the event management thread identifies that the attention event is triggered, based on the triggered attention event, executing predefined processing logic corresponding to the attention event through cross-process event processing in the subordinate business service process.
5. The method of claim 4, wherein executing the predefined processing logic corresponding to the event of interest in the slave business service process by cross-process event processing comprises:
acquiring event resource update data by executing predefined processing logic corresponding to the concerned event through cross-process event processing in the subordinate business service process;
writing the event resource updating data into a preset service resource database, and executing the next concerned event corresponding to the current triggered concerned event;
acquiring a data writing result message fed back by a preset service resource database;
and when the data writing result message is a data writing failure message, re-writing the event resource updating data into a preset service resource database.
6. The method according to any one of claims 1 to 5, wherein after executing the predefined processing logic corresponding to the event of interest in the slave business service process, further comprises:
reading an event processing result message fed back by the subordinate business service process;
extracting the update data of the concerned event processing set in the event processing result;
Updating the event management thread based on the event processing set update data of interest;
and executing event reissue processing according to the updated event management thread.
7. A business logic processing device, the device comprising:
the login response module is used for responding to a target object login event and determining a main business service process and a subordinate business service process;
the collection construction module is used for acquiring the attention event and the object attribute requirement corresponding to the target object through the subordinate business service process and respectively constructing an attention event processing collection and an attribute requirement collection;
the event writing module is used for writing the concerned event processing set into an event management thread in the main service process and writing the attribute demand set into an attribute management thread in the main service process;
an event driven module, configured to execute, in the slave business service process, predefined processing logic corresponding to the attention time based on the triggered attention event when the attention event is identified to be triggered by the event management thread;
and the attribute synchronization module is used for executing the attribute information synchronization processing corresponding to the attribute subset information in the subordinate business service process based on the changed attribute subset information when the attribute information change is identified through the attribute management thread.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202210143424.8A 2022-02-16 2022-02-16 Service logic processing method, device, computer equipment and storage medium Pending CN116643849A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210143424.8A CN116643849A (en) 2022-02-16 2022-02-16 Service logic processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210143424.8A CN116643849A (en) 2022-02-16 2022-02-16 Service logic processing method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116643849A true CN116643849A (en) 2023-08-25

Family

ID=87621724

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210143424.8A Pending CN116643849A (en) 2022-02-16 2022-02-16 Service logic processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116643849A (en)

Similar Documents

Publication Publication Date Title
KR102392944B1 (en) Data backup methods, storage media and computing devices
US9917913B2 (en) Large message support for a publish-subscribe messaging system
CN108319654B (en) Computing system, cold and hot data separation method and device, and computer readable storage medium
CN101208671B (en) Managing message queues
US8903925B2 (en) Scheduled messages in a scalable messaging system
CN103854214B (en) Method and system for processing auction data
CN106325758B (en) A kind of queue storage space management method and device
US10331499B2 (en) Method, apparatus, and chip for implementing mutually-exclusive operation of multiple threads
CN108572970A (en) A kind of processing method and distributed processing system(DPS) of structural data
CN107153643B (en) Data table connection method and device
WO2023165188A1 (en) Sequential read prefetching method and apparatus, device, and medium
WO2023207492A1 (en) Data processing method and apparatus, device, and readable storage medium
CN113094434A (en) Database synchronization method, system, device, electronic equipment and medium
CN112465046A (en) Method, system, equipment and medium for artificial intelligence training of mass small files
CN107943846B (en) Data processing method and device and electronic equipment
CN113596010B (en) Data processing method, device, node equipment and computer storage medium
CN110445826B (en) Session information acquisition method, device and server
CN114020529A (en) Backup method and device of flow table data, network equipment and storage medium
US9405786B2 (en) System and method for database flow management
CN110413689B (en) Multi-node data synchronization method and device for memory database
CN116643849A (en) Service logic processing method, device, computer equipment and storage medium
WO2021036909A1 (en) Picture write-in method and apparatus
CN115563160A (en) Data processing method, data processing device, computer equipment and computer readable storage medium
CN114820218A (en) Content operation method, device, server and storage medium
CN114116908A (en) Data management method and device and electronic equipment

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