CN112433870A - Data calling method and device, computer readable storage medium and electronic equipment - Google Patents

Data calling method and device, computer readable storage medium and electronic equipment Download PDF

Info

Publication number
CN112433870A
CN112433870A CN202011399197.2A CN202011399197A CN112433870A CN 112433870 A CN112433870 A CN 112433870A CN 202011399197 A CN202011399197 A CN 202011399197A CN 112433870 A CN112433870 A CN 112433870A
Authority
CN
China
Prior art keywords
data
called
calling
message queue
call
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
CN202011399197.2A
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202011399197.2A priority Critical patent/CN112433870A/en
Publication of CN112433870A publication Critical patent/CN112433870A/en
Pending legal-status Critical Current

Links

Images

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/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/70Game security or game management aspects
    • A63F13/77Game security or game management aspects involving data related to game devices or game servers, e.g. configuration data, software version or amount of memory
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/547Messaging middleware
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Abstract

The disclosure relates to a data calling method, a data calling device, a computer readable storage medium and an electronic device, relating to the technical field of remote calling, wherein the method comprises the following steps: receiving a data calling request sent by a message queue, wherein the data calling request is sent to the message queue by a data calling party corresponding to the data storage party; analyzing the data calling request to obtain name information of the data to be called, and acquiring the data to be called according to the name information; and converting the data to be called, and sending the converted data to be called to the message queue, so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data calling party. The present disclosure improves the efficiency of data invocation.

Description

Data calling method and device, computer readable storage medium and electronic equipment
Technical Field
The embodiment of the invention relates to the technical field of remote calling, in particular to a data calling method, a data calling device, a computer readable storage medium and electronic equipment.
Background
The technical architecture of the modern game back end is mostly a multi-machine multi-process distributed architecture, and the most important thing in the architecture is to solve the problem of communication between processes, namely, remote Procedure call (rpc) remote call.
In order to solve the above technical problems, there are two technical solutions adopted in the prior art, which are respectively: HTTP protocol based remote procedure calls and long connection based remote procedure calls. The remote procedure call based on the HTTP can solve the problem of procedure call among different languages, but the call chain is long and the call protocol needs to be predefined, so that the implementation process is complex and the call efficiency is low; in addition, a calling protocol needs to be predefined before the process calling, and the data calling efficiency is influenced.
Therefore, it is desirable to provide a new data calling method.
It is to be noted that the information invented in the above background section is only for enhancing the understanding of the background of the present invention, and therefore, may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present invention is directed to a data calling method, a data calling apparatus, a computer-readable storage medium, and an electronic device, which overcome at least some of the problems of low remote procedure calling efficiency due to limitations and disadvantages of the related art.
According to one aspect of the present disclosure, there is provided a data call method, configured by a data sender in a data call, the data call method including:
receiving a data calling request sent by a message queue, wherein the data calling request is sent to the message queue by a data calling party corresponding to the data storage party;
analyzing the data calling request to obtain name information of the data to be called, and acquiring the data to be called according to the name information;
and converting the data to be called, and sending the converted data to be called to the message queue, so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data calling party.
In an exemplary embodiment of the disclosure, before receiving a data call request sent by a message queue, the data call method further includes:
establishing connection between the data sending party and the message queue;
and acquiring the remote calling channel which uniquely identifies the data sender.
In an exemplary embodiment of the present disclosure, converting the data to be called includes:
and converting the data to be called into binary streaming data according to a binary serialization format.
In an exemplary embodiment of the present disclosure, the data to be called and the data call request are both data of a script language type, and the data to be called and the data call request may be different types of script languages.
According to one aspect of the present disclosure, there is provided a data calling method, configured on a data caller in a data call, the data calling method including:
generating a data calling request according to the name information of the data to be called and a remote calling channel of a data sender corresponding to the data to be called;
sending the data calling request to a message queue so that the message queue sends the data calling request to a remote calling channel of the data sender according to the data calling request including the remote calling channel of the data sender;
and receiving the converted data to be called sent by the message queue, wherein the converted data to be called is binary streaming data obtained by converting the data to be called by the data sending party.
In an exemplary embodiment of the present disclosure, after receiving the converted data to be called sent by the message queue, the data calling method further includes:
unpacking the received data to be called to obtain unpacked data, and calling the unpacked data according to a callback function included in the data calling request to realize the calling of the data.
According to an aspect of the present disclosure, there is provided a data call apparatus, configured to a data sender in a data call, the data call apparatus including:
the receiving module is used for receiving a data calling request sent by a message queue, wherein the data calling request is sent to the message queue by a data calling party corresponding to the data storage party;
the analysis module is used for analyzing the data calling request to obtain name information of the data to be called and acquiring the data to be called according to the name information;
and the conversion module is used for converting the data to be called and sending the converted data to be called to the message queue so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data calling party.
According to an aspect of the present disclosure, there is provided a data call apparatus configured to a data caller in a data call, the data call apparatus including:
the request generation module is used for generating a data calling request according to the name information of the data to be called and a remote calling channel of a data sender corresponding to the data to be called;
the request sending module is used for sending the data calling request to a message queue so that the message queue sends the data calling request to a remote calling channel of the data sender according to the data calling request including the remote calling channel of the data sender;
and the data to be called receiving module is used for receiving the converted data to be called sent by the message queue, wherein the converted data to be called is binary streaming data obtained by converting the data to be called by the data sending party.
According to an aspect of the present disclosure, there is provided a computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the data call method of any one of the above.
According to an aspect of the present disclosure, there is provided an electronic apparatus, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform any of the data call methods described above via execution of the executable instructions.
In the data call method provided in the embodiment of the present invention, on one hand, a data call request sent by a message queue is received, where the data call request is sent to the message queue by a data caller corresponding to the data storage party; analyzing the data calling request to obtain name information of the data to be called, and acquiring the data to be called according to the name information; the data to be called is converted, and the converted data to be called is sent to the message queue, so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data calling party, and data communication between a data sending party and the data calling party is completed through the message queue without a communication protocol, so that the problem that the data calling can be realized only by defining the communication protocol in advance in the prior art is solved, and the redundancy of a data calling chain is reduced; on the other hand, the data call request and the data to be called are sent through the message queue, so that the problem that the process needs to be connected and the connection number is increased violently in the prior art is solved; on the other hand, the data included in the data calling request and the data to be called are binary lost data after conversion, so that the data can be called in the process between different script languages, and the problem that the data cannot be called due to the fact that the script languages adopted by the data are different in the prior art is solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 schematically shows a flow chart of a data call method according to an exemplary embodiment of the present invention.
Fig. 2 schematically shows a block diagram of a data call system according to an exemplary embodiment of the present invention.
FIG. 3 schematically illustrates a block diagram of data types to be called according to an example embodiment of the present invention.
Fig. 4 schematically shows a flowchart of a data calling method in which the data type to be called is a Python type according to an exemplary embodiment of the present invention.
Fig. 5 schematically shows a flowchart of a data calling method in which a data type to be called is an LPC type, according to an exemplary embodiment of the present invention.
Fig. 6 schematically shows a flowchart of a method for invoking a data call of a data type Golang according to an exemplary embodiment of the present invention.
Fig. 7 schematically shows a flow chart of another data call method according to an exemplary embodiment of the present invention.
Fig. 8 schematically shows a flow chart of a further data call method according to an exemplary embodiment of the present invention.
Fig. 9 schematically shows a block diagram of a data call apparatus according to an exemplary embodiment of the present invention.
Fig. 10 schematically shows a block diagram of another data call apparatus according to an exemplary embodiment of the present invention.
Fig. 11 schematically illustrates an electronic device for implementing the above-described data call method according to an exemplary embodiment of the present invention.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the invention.
Furthermore, the drawings are merely schematic illustrations of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The system architecture of the existing game is changed from the traditional single-machine single-process to the distributed architecture of multiple machines and multiple processes, and the distributed architecture means that more machines can run, so that the CPU, the memory and the storage resources are richer, more concurrent accesses and data volumes can be processed, and further more services can be provided for players. In order to solve the process communication problem under the distributed architecture, the current radix scheme has two types:
the remote procedure call based on the HTTP protocol can solve the call problem among different languages, but each call can be carried out to establish new connection, carry out routing selection, calculate load balance, obtain a calculation result, and needs to carry out disconnection and other steps after the call is finished, so that the call efficiency is low, the user quantity is further limited, and the machine cost is too high.
The remote procedure call based on the long connection needs to connect all processes, the number of the connections is the square of the number of the processes, when the number of the processes is increased, the number of the connections is increased, the call is only limited in the same computer language, the call cannot be initiated between different languages, and meanwhile, a call protocol needs to be predefined before the call, so that the development efficiency is influenced.
In order to improve the calling efficiency, the inventor tries to call data based on a message queue, solves the problem of excessive connection number caused by connection required by process communication, and converts data to be called to realize mixed calling among different languages; furthermore, the data calling request contains name information of the data to be called, so that the purpose of realizing data calling without pre-definition is achieved.
Based on one or more of the above problems, the present exemplary embodiment first provides a data calling method, which may be run on a server, and of course, a person skilled in the art may also run the method of the present invention on other platforms according to requirements, which is not specifically limited in this exemplary embodiment. Referring to fig. 1, the data call method may include the steps of:
step S110, receiving a data calling request sent by a message queue, wherein the data calling request is sent to the message queue by a data calling party corresponding to the data storage party;
s120, analyzing the data calling request to obtain name information of the data to be called, and acquiring the data to be called according to the name information;
step S130, converting the data to be called, and sending the converted data to be called to the message queue, so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data calling party.
In the above data call method, on one hand, a data call request sent by a message queue is received, where the data call request is sent to the message queue by a data call party corresponding to the data storage party; analyzing the data calling request to obtain name information of the data to be called, and acquiring the data to be called according to the name information; the data to be called is converted, and the converted data to be called is sent to the message queue, so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data calling party, data communication between the data sending party and the data calling party is completed through the message queue, a communication protocol is not needed, the problem that the data calling can be realized only by defining the calling protocol in advance in the prior art is solved, and the redundancy of a data calling chain is reduced; on the other hand, the data call request and the data to be called are sent through the message queue, so that the problem that the process needs to be connected and the connection number is increased violently in the prior art is solved; on the other hand, the data included in the data calling request and the data to be called are binary lost data after conversion, so that the data can be called in the process between different script languages, and the problem that the data cannot be called due to the fact that the script languages adopted by the data are different in the prior art is solved.
Hereinafter, each step in the data calling method according to the exemplary embodiment of the present invention will be explained and explained in detail with reference to the drawings.
First, the objects of the exemplary embodiments of the present invention are explained and explained. Specifically, in the present invention, how to implement data call between different languages, reduce the number of connections during data call, and implement data call without defining a call protocol in advance before call is mainly studied in the data call process. In the prior art of data calling, a calling protocol needs to be defined in advance before calling, the number of connections established during calling is suddenly increased along with the increase of the number of processes needing communication, and data among different computer languages cannot be communicated, so that the invention tries to provide a data calling method, on one hand, calling can be realized without defining the calling protocol in advance; on the other hand, the mixed calling among different computer languages is realized by converting the data to be called; in another aspect, data calling is performed through the message queue, connection between processes does not need to be established, and data calling efficiency is improved.
Next, the data call system involved in the exemplary embodiment of the present invention is explained and explained.
Referring to fig. 2, the data call system may include a data caller 210, a data sender 220, and a message queue 230. Wherein:
the data caller 210 is configured to generate a data call request, convert data included in the data call request into binary streaming data, and send the converted binary streaming data to a message queue; the data calling request comprises a remote calling channel of the data calling party;
the data sending party 220 is configured to generate data to be called according to the data calling request of the calling requesting party, and send the data to be called to the message queue; the data to be called comprises a remote calling channel of a target data calling party, and the transmitted data to be called is converted binary streaming data;
the message queue 230 is in network connection with the data caller 210 and the data sender 220, and is used for establishing connection between the call requester and the message queue and between the data sender and the message queue, and respectively generating a remote call channel of the call requester and a remote call channel of the data sender; and sending the data to be called to a remote calling channel of the calling requester according to the remote calling channel of the calling requester included in the data to be called.
Steps S110 to S130 will be explained and explained below in conjunction with the data call system described above.
In step S110, a data call request sent by a message queue is received, where the data call request is sent to the message queue by a data caller corresponding to the data storage.
In this example embodiment, the message queue may be a redis, or may also be another third party message queue, and is not specifically limited in this example embodiment. Before receiving a data call request sent by a message queue, the data call method further comprises the following steps:
establishing connection between the data sending party and the message queue;
and acquiring the remote calling channel which uniquely identifies the data sender.
Specifically, the data caller and the data sender are respectively connected with the message queue, and both the data caller and the data sender obtain a unique remote call identifier, which is a remote call channel. After the connection is successfully established, because the process communication can cause the increase of the system overhead, in order to reduce the system overhead, a thread or coroutine is established in both the process of the data caller and the process of the data sender, and the thread or coroutine corresponding to the process of the message caller monitors the data to be called of the remote calling channel containing the message caller by calling a brpop instruction (used for removing and acquiring the last element of the message queue) of the message queue.
In step S120, a data call request is generated according to the name information of the data to be called and the remote call channel of the data storage party corresponding to the data call party.
In this exemplary embodiment, the data structure of the data call request obtained by parsing is:
{
RPC _ MOD remote Call Module Path
RPC _ FUNC function of remote call
RPC _ ARGS-list of parameters required for remote invocation
RPC _ CB _ CHANNEL CHANNEL for remote call callback
RPC _ CB _ MOD module path of remote call callback
RPC _ CB _ FUNC function of remote call callback
RPC _ CB _ ARGS-list of parameters of the required band for remote Call callbacks
And the name information of the data to be called comprises: the method comprises the steps of remotely calling a function and a parameter list required by remote calling, wherein the parameter list comprises a remote calling channel of data to be called; after the name information of the data to be called in the data calling request is obtained, the message queue matches the data to be called for the data calling party according to the remote calling channel contained in the parameter list required by the remote calling.
In step S130, the data to be called is converted, and the converted data to be called is sent to the message queue, so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data caller.
In this embodiment, converting the data to be called includes: according to a binary serialization format, the data to be called is converted into binary streaming data, wherein a binary serialization tool adopted in the invention is msgpack, and other third-party serialization tools can be used besides msgpack in the invention, which is not specifically limited in this example embodiment. Taking msgpack as an example, the specific process is as follows: firstly, converting data to be called into binary stream data, rpc _ data being rpc _ package _ to _ msgpace (rpc _ package), wherein rpc _ data is the converted data to be called, rpc _ package _ to _ msgpace is a conversion function, and rpc _ package is the data to be called; secondly, the message queue sends the converted data to be called to the thread or coroutine corresponding to the data calling party through an Ipush instruction (used for inserting one or more instructions into the head of the list) of the thread or coroutine calling message queue corresponding to the data sending party, and the thread or coroutine converts the converted binary streaming data into data in the language format of itself diode/map after receiving the data to be called.
In this example embodiment, when the data sending party and the data calling requesting party call data, the data to be called and the data calling request are both data of a script language type, and the data to be called and the data calling request may be different types of script languages. Referring to fig. 3, the scripting language may be Python type data to be called, LPC (an ancient scripting language used to define and manage objects) type data to be called, and Golang (a strong static type, a compiled type, a concurrent type developed by google, and a programming language with garbage collection function) type data to be called, which is not specifically limited in this exemplary embodiment. When the script language type is data to be called of a Python type, the data calling can be realized by a redis database or a mongodb database or a curl (a file transfer tool which works under a command line by using URL grammar) file transfer tool; when the script language type is a Golang type, the player can call data through the websock network protocol port of the external network, and meanwhile, the local billing callback interface and the GM interface can also be realized through the HTTP port of the internal network. In order to avoid an exception in the data call process, it is necessary to check the remote call channel in the message queue at intervals, and find and process the backlogged data call request early, where the interval time may be 30 seconds or 1 minute, and a person skilled in the art may select different interval times according to different processing scenarios, which is not limited in this example embodiment.
For example, when the scripting language of the data to be called is Python type, referring to fig. 4, the flow of the data calling method is as follows:
s410, establishing a Python type data calling party and a connection between a data sending party and a message queue, and acquiring a remote calling channel;
s420, the data calling party sends a calling data request to a message queue through a brpop instruction based on a third-party protocol library; the third party coroutine library may be a getent, or an eventlet, which is not specifically limited in this example embodiment; the data calling request comprises a called module path, a calling function, a parameter list required by calling, a callback module path, a callback function and a parameter list required by callback, wherein the parameter list required by calling comprises a remote calling channel of the data calling party.
S430, a data sending party packs data to be called into binary streaming data and sends the data to a message queue through an Ipush instruction;
s440, the message queue sends the data to be called to a corresponding data calling party;
s450, based on the received data to be called, the data calling party completes data calling through the callback function.
It should be added that, since the data callers of Python type are stateless nodes, the remote invocation channels of each data caller are the same, so the message queue matches the data to be invoked and the invocation data request according to other parameters except the remote invocation channel in the parameter list required for invocation, so that the CPU of each Python consumer can reach a balanced state.
For example, when the scripting language of the data to be called is LPC type, referring to fig. 5, the flow of the data calling method is as follows:
s510, establishing connection between a data calling party and a message queue and between a data sending party and the message queue, and acquiring a corresponding remote calling channel;
s520, establishing a first thread corresponding to a data sending party, and sending a call data request to a message queue; the data calling request comprises the following steps: the system comprises a called module path, a calling function, a parameter list required by calling, a callback module path, a callback function and a parameter list required by callback, wherein the parameter list required by calling comprises a remote calling channel of the data calling party;
s530, converting data to be called into binary streaming data by a data sending party, and sending the binary streaming data to a message queue; the data to be called comprises a remote calling channel of a target data calling party;
s540, the message queue sends the data to be called to a target data calling party according to a remote calling channel of the target data calling party contained in the data to be called;
and S550, based on the received data to be called, the data calling party completes data calling through the callback function.
It should be added that, in order to prevent the frequent operation of the message queue, which results in too high system latency, low throughput, and failure to complete normal data call, in this exemplary embodiment, a pipeline mechanism of redis is used to increase the throughput of the message queue.
For example, when the scripting language of the data to be called is Golang type, referring to fig. 6, the flow of the data calling method is as follows:
s610, establishing connection between a data calling party and a message queue and between a data sending party and the message queue, and acquiring a corresponding remote calling channel; the Golang type data invoker and the Golang type data sender are used as gateways, the throughput is high, and therefore each data invoker and each data sender have a group of corresponding remote invocation channels.
S620, establishing a first thread corresponding to a data sender, and sending a call data request to a message queue; the data calling request comprises the following steps: the system comprises a called module path, a calling function, a parameter list required by calling, a callback module path, a callback function and a parameter list required by callback, wherein the parameter list required by calling comprises a remote calling channel of the data calling party;
s630, converting the data to be called into binary streaming data by a data sending party, and sending the binary streaming data to a message queue; the data to be called comprises a remote calling channel of a target data calling party;
s640, converting the data to be called into binary streaming data by a data sending party, and sending the binary streaming data to a message queue;
s650, the data calling party receives the data to be called, firstly obtains the address of the real function, and completes the calling of the data to be called through a call method. The parameters of the call method are slices of Value values, in order to obtain a parameter list of the call method, a reflect.
It should be added that, when the data to be called is Golang type data to be called, all the logical servers share one Golang cluster, because Golang type data to be called serves as a gateway, the throughput is high, and the Golang type data to be called is mainly used for processing player connection, client protocol packing and unpacking, and AOI broadcast (for broadcasting messages to players in the geographic vicinity of the game when the game character on the server makes an action). When the Gorang process processes player connection logic, two Goroutines are established for each connection by using a Goroutine (coroutine, concurrency support from a language level) + channel (pipeline for data transmission or data sharing) processing model, and one Goroutine is responsible for reading and writing. When the data type to be called is a gold type and one or more message queues in the cluster where the message queues are located are abnormal, the whole cluster is affected, so that try-catch processing needs to be performed on all data calling interfaces, and the abnormality is captured and printed.
In addition, AOI broadcasting can be realized by combining a Golang process with Python and redis, firstly, a hash _ table is established on a list, wherein a player list in each hash _ table is an AOI broadcasting grid, and each broadcasting grid is provided with a corresponding unique identifier; secondly, the LPC process operates redis through a Python process to maintain a pipeline of each broadcast grid; thirdly, when broadcasting is needed, the LPC process sends a broadcasting request to a Python process, the Python process sends the broadcasting request to all Golang processes, and the Golang processes filter the players needing broadcasting according to the pipeline data corresponding to the AOI broadcasting grids on the redis; finally, since the Golang process will buffer the data on the redis pipe for 1 second, i.e., when the LPC process needs to put a player into the broadcast grid, a 1 second delay may occur, during which the LPC process will repeatedly send some of the necessary protocols to players not in the broadcast grid to prevent loss of the AOI broadcast. In summary, the consumption of one AOI broadcast is: the LPC process sends a remote calling request, the Python process sends a remote calling request, and the remote calling request sent by the Python process is the number of Golang processes. When the Golike performs the broadcasting operation, the consumption of the Golike is only related to the number of the players managed by the Golike, and the Golike process buffers the record saved on the redis for 1 second, so that the load of the redis is reduced.
Furthermore, the disclosure also provides another data calling method. Referring to fig. 7, the data call method may further include steps S710 to S730.
In step S710, a data call request is generated according to the name information of the data to be called and the remote call channel of the data sender corresponding to the data to be called.
In this exemplary embodiment, the name information of the data to be called includes: the method comprises the steps of calling module paths of data to be called, calling functions of the data to be called and parameter lists required by calling.
In step S720, the data call request is sent to a message queue, so that the message queue sends the data call request to a remote call channel of the data sender according to the data call request including the remote call channel of the data sender.
In the present exemplary embodiment, the data call request includes: the system comprises a called module path, a calling function, a parameter list required by calling, a callback module path, a callback function and a parameter list required by callback, wherein the parameter list required by calling comprises a remote calling channel of a data caller.
In step S730, the converted data to be called sent by the message queue is received, where the converted data to be called is binary streaming data obtained by converting the data to be called by the data sending side.
In this example embodiment, a binary serialization tool is used for converting the data to be called, where the binary serialization tool may be msgpack, or other third-party serialization tools may also be used, which is not specifically limited in this example embodiment. Taking msgpack as an example, the specific process is as follows: firstly, data to be called is converted into binary stream data, rpc _ data is rpc _ packet _ to _ msgpace (rpc _ packet), wherein rpc _ data is the converted data to be called, rpc _ packet _ to _ msgpace is a conversion function, and rpc _ packet is the data to be called.
In this exemplary embodiment, after receiving the converted data to be called sent by the message queue, the data calling method further includes: unpacking the received data to be called to obtain unpacked data, and calling the unpacked data according to a callback function included in the data calling request to realize the calling of the data. Specifically, the method comprises the following steps: the message queue sends the data to be called to a thread or a coroutine of a data calling party corresponding to a remote calling channel contained in the data to be called, after the thread or the coroutine monitors the data to be called, the data to be called is unpacked to obtain unpacked data, the unpacked data is sent to a process corresponding to the thread or the coroutine, and the process firstly converts the data to be called into a dit/map format corresponding to the language of the process; secondly, calling a corresponding function, forming a callback data packet (RPC _ CB _ MOD, RPC _ CB _ FUNC and RPC _ CB _ ARGS) according to a return value of the corresponding function, and initiating a data call again by the process according to the setting of the callback data packet, wherein the data call is only a unilateral call and is used for returning the result of the data call.
The data calling method provided by the embodiment of the invention originally designs a data calling implementation model based on a message queue. In addition, the data call implementation model is creatively integrated into the data call implementation method, so that data interaction can be carried out without connection among processes, and the problem that data call can be realized only by predefining a call protocol in the prior art is solved; furthermore, data forwarding is carried out through the message queue, and connection between threads is not required to be established, so that the problem that the number of connections is increased violently due to the fact that processes are required to be connected in the prior art is solved; furthermore, the data to be called sent by the data sender are all converted, so that the problem that data calling cannot be performed among different languages in the prior art is solved.
The data call method of an exemplary embodiment of the present invention is further explained and illustrated below with reference to fig. 8, wherein the data call method may comprise the following steps:
step S810, a data calling party generates a data calling request according to name information of data to be called and a remote calling channel of a data storage party corresponding to the data calling party;
s820, the data calling party sends a data calling request to a message queue;
s830, the message queue sends the data calling request to a data sending party corresponding to a remote calling channel according to the remote calling channel in the data calling request;
step 840, the data sender converts the data to be called and sends the converted data to be called to a message queue;
step S850, the message queue sends the data to be called to a corresponding data calling party;
the exemplary embodiment of the present invention further provides a data invoking device, configured on a data sending party in data invoking, and as shown in fig. 9, the data invoking device may include a receiving module 910, an analyzing module 920, and a converting module 930. Wherein:
a receiving module 910, configured to receive a data call request sent by a message queue, where the data call request is sent to the message queue by a data caller corresponding to a data storage;
the analyzing module 920 is configured to analyze the data calling request to obtain name information of the data to be called, and obtain the data to be called according to the name information;
the converting module 930 is configured to convert the data to be called and send the converted data to be called to the message queue, so that the message queue sends the converted data to be called to the remote calling channel corresponding to the data caller.
The exemplary embodiment of the present invention further provides another data invoking device configured at a data caller in the data invocation, and as shown in fig. 10, the data invoking device may include a request generating module 1010, a request sending module 1020, and a request receiving module 1030. Wherein:
the request generating module 1010 is configured to generate a data call request according to name information of data to be called and a remote call channel of a data sender corresponding to the data to be called;
a request sending module 1020, configured to send the data call request to a message queue, so that the message queue sends the data call request to a remote call channel of the data sender according to the data call request including the remote call channel of the data sender;
a to-be-called data receiving module 1030, configured to receive the converted to-be-called data sent by the message queue, where the converted to-be-called data is binary streaming data obtained by converting the to-be-called data by the data sending side.
In an example embodiment of the present disclosure, before receiving a data call request sent by a message queue, the data call method further includes: and establishing a connection between the data sender and the message queue, establishing a connection between the data caller and the message queue, and acquiring the remote call channel which uniquely identifies the data sender and uniquely identifies the data caller.
In an example embodiment of the present disclosure, converting the data to be called includes: and converting the data to be called into binary streaming data according to a binary serialization format.
In an example embodiment of the present disclosure, the data to be called and the data call request are both data of a script language type, and the data to be called and the data call request may be different types of script languages.
In an example embodiment of the present disclosure, after receiving the converted data to be called sent by the message queue, the data calling method further includes:
unpacking the received data to be called to obtain unpacked data, and calling the unpacked data according to a callback function included in the data calling request to realize the calling of the data.
The specific details of each module in the data calling device have been described in detail in the corresponding data calling method, and therefore are not described herein again.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the invention. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present invention are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
In an exemplary embodiment of the present invention, there is also provided an electronic device capable of implementing the above method.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 1100 according to this embodiment of the invention is described below with reference to fig. 11. The electronic device 1100 shown in fig. 11 is only an example and should not bring any limitations to the function and the scope of use of the embodiments of the present invention.
As shown in fig. 11, the electronic device is embodied in the form of a general purpose computing device. Components of the electronic device may include, but are not limited to: the at least one processing unit 1110, the at least one memory unit 1120, a bus 1130 connecting different system components (including the memory unit 1120 and the processing unit 1110), and a display unit 1140.
Wherein the storage unit stores program code that is executable by the processing unit 1110 to cause the processing unit 1110 to perform steps according to various exemplary embodiments of the present invention as described in the above section "exemplary methods" of the present specification. For example, the processing unit 1110 may execute step S110 as shown in fig. 1: receiving a data calling request sent by a message queue, wherein the data calling request is sent to the message queue by a data calling party corresponding to the data storage party; s120: analyzing the data calling request to obtain name information of the data to be called, and acquiring the data to be called according to the name information; step S130: and converting the data to be called, and sending the converted data to be called to the message queue, so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data calling party.
The storage unit 1120 may include a readable medium in the form of a volatile memory unit, such as a random access memory unit (RAM)11201 and/or a cache memory unit 11202, and may further include a read only memory unit (ROM) 11203.
Storage unit 1120 may also include a program/utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 1130 may be representative of one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 1100 may also communicate with one or more external devices 1200 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 1100, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 1100 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 1150. Also, the electronic device 1100 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the internet) via the network adapter 1160. As shown, the network adapter 1160 communicates with the other modules of the electronic device 1100 over the bus 1130. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to make a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) execute the method according to the embodiment of the present invention.
In an exemplary embodiment of the present invention, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, aspects of the invention may also be implemented in the form of a program product comprising program code means for causing a terminal device to carry out the steps according to various exemplary embodiments of the invention described in the above section "exemplary methods" of the present description, when said program product is run on the terminal device.
According to the program product for realizing the method, the portable compact disc read only memory (CD-ROM) can be adopted, the program code is included, and the program product can be operated on terminal equipment, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.

Claims (10)

1. A data call method, configured to a data sender in a data call, the data call method comprising:
receiving a data calling request sent by a message queue, wherein the data calling request is sent to the message queue by a data calling party corresponding to the data storage party;
analyzing the data calling request to obtain name information of the data to be called, and acquiring the data to be called according to the name information;
and converting the data to be called, and sending the converted data to be called to the message queue, so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data calling party.
2. The data call method according to claim 1, wherein before receiving the data call request sent by the message queue, the data call method further comprises:
establishing connection between the data sending party and the message queue;
and acquiring the remote calling channel which uniquely identifies the data sender.
3. The data calling method according to claim 1, wherein converting the data to be called comprises:
and converting the data to be called into binary streaming data according to a binary serialization format.
4. The data calling method according to claim 1, wherein the data to be called and the data calling request are both data of a scripting language type, and the data to be called and the data calling request may be different scripting languages.
5. A data call method, configured to a data caller in a data call, the data call method comprising:
generating a data calling request according to the name information of the data to be called and a remote calling channel of a data sender corresponding to the data to be called;
sending the data calling request to a message queue so that the message queue sends the data calling request to a remote calling channel of the data sender according to the data calling request including the remote calling channel of the data sender;
and receiving the converted data to be called sent by the message queue, wherein the converted data to be called is binary streaming data obtained by converting the data to be called by the data sending party.
6. The data calling method according to claim 5, wherein after receiving the converted data to be called sent by the message queue, the data calling method further comprises:
unpacking the received data to be called to obtain unpacked data, and calling the unpacked data according to a callback function included in the data calling request to realize the calling of the data.
7. A data call apparatus, configured to a data sender in a data call, the data call apparatus comprising:
the receiving module is used for receiving a data calling request sent by a message queue, wherein the data calling request is sent to the message queue by a data calling party corresponding to the data storage party;
the analysis module is used for analyzing the data calling request to obtain name information of the data to be called and acquiring the data to be called according to the name information;
and the conversion module is used for converting the data to be called and sending the converted data to be called to the message queue so that the message queue sends the converted data to be called to a remote calling channel corresponding to the data calling party.
8. A data call apparatus configured to a data caller in a data call, the data call apparatus comprising:
the request generation module is used for generating a data calling request according to the name information of the data to be called and a remote calling channel of a data sender corresponding to the data to be called;
the request sending module is used for sending the data calling request to a message queue so that the message queue sends the data calling request to a remote calling channel of the data sender according to the data calling request including the remote calling channel of the data sender;
and the data to be called receiving module is used for receiving the converted data to be called sent by the message queue, wherein the converted data to be called is binary streaming data obtained by converting the data to be called by the data sending party.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the data call method of any one of claims 1 to 6.
10. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the data call method of any of claims 1-6 via execution of the executable instructions.
CN202011399197.2A 2020-12-01 2020-12-01 Data calling method and device, computer readable storage medium and electronic equipment Pending CN112433870A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011399197.2A CN112433870A (en) 2020-12-01 2020-12-01 Data calling method and device, computer readable storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011399197.2A CN112433870A (en) 2020-12-01 2020-12-01 Data calling method and device, computer readable storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN112433870A true CN112433870A (en) 2021-03-02

Family

ID=74691872

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011399197.2A Pending CN112433870A (en) 2020-12-01 2020-12-01 Data calling method and device, computer readable storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112433870A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113159858A (en) * 2021-05-06 2021-07-23 山东白令三维科技有限公司 3D printing quotation system, method and device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201739A (en) * 2016-06-29 2016-12-07 上海浦东发展银行股份有限公司信用卡中心 A kind of remote invocation method of Storm based on Redis
CN106606865A (en) * 2015-10-27 2017-05-03 网易(杭州)网络有限公司 Game data intercommunicating method, game data intercommunicating system, terminals and servers
CN106648940A (en) * 2017-03-13 2017-05-10 北京百悟科技有限公司 Remote procedure call method and device
CN106888218A (en) * 2017-04-01 2017-06-23 网易(杭州)网络有限公司 Message treatment method, device, client and service end
CN108255727A (en) * 2018-01-18 2018-07-06 网易(杭州)网络有限公司 Data receiver, sending method and device test system, storage medium
CN110740103A (en) * 2019-09-02 2020-01-31 深圳壹账通智能科技有限公司 Service request processing method and device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106606865A (en) * 2015-10-27 2017-05-03 网易(杭州)网络有限公司 Game data intercommunicating method, game data intercommunicating system, terminals and servers
CN106201739A (en) * 2016-06-29 2016-12-07 上海浦东发展银行股份有限公司信用卡中心 A kind of remote invocation method of Storm based on Redis
CN106648940A (en) * 2017-03-13 2017-05-10 北京百悟科技有限公司 Remote procedure call method and device
CN106888218A (en) * 2017-04-01 2017-06-23 网易(杭州)网络有限公司 Message treatment method, device, client and service end
CN108255727A (en) * 2018-01-18 2018-07-06 网易(杭州)网络有限公司 Data receiver, sending method and device test system, storage medium
CN110740103A (en) * 2019-09-02 2020-01-31 深圳壹账通智能科技有限公司 Service request processing method and device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113159858A (en) * 2021-05-06 2021-07-23 山东白令三维科技有限公司 3D printing quotation system, method and device and storage medium

Similar Documents

Publication Publication Date Title
CN109002362B (en) Service method, device and system and electronic equipment
CN109714332B (en) Protocol conversion method and device based on Thrift and syntax tree analysis
WO2021151312A1 (en) Method for determining inter-service dependency, and related apparatus
CN111737022A (en) Interface calling method, system, equipment and medium based on micro-service
CN112532673B (en) Message sending method and device, computer readable storage medium and electronic equipment
CN112783672B (en) Remote procedure call processing method and system
CN109067860B (en) Mobile terminal message processing method and related device
WO2024021405A1 (en) Data transmission system and method
CN111200606A (en) Deep learning model task processing method, system, server and storage medium
CN114244821B (en) Data processing method, device, equipment, electronic equipment and storage medium
CN115480753A (en) Application integration system and corresponding computer device and storage medium
CN112395098B (en) Application program interface calling method and device, storage medium and electronic equipment
CN112104679B (en) Method, apparatus, device and medium for processing hypertext transfer protocol request
CN112433870A (en) Data calling method and device, computer readable storage medium and electronic equipment
JP2005228183A (en) Program execution method and computer system for executing the program
CN113760562A (en) Link tracking method, device, system, server and storage medium
CN111966653A (en) Data processing method, device, server and storage medium for micro-service call link
US20170286261A1 (en) System and method for providing runtime tracing for a web-based client accessing a transactional middleware platform using an extension interface
CN109005163B (en) HTTP dynamic request service calling method
CN113992644B (en) Internet of things system based on no-service technology and data processing method thereof
CN110548285B (en) Game communication control method and device, medium and electronic equipment
JP5839604B2 (en) APL-GW-FE
CN114785851B (en) Resource call processing method and device, storage medium and electronic equipment
CN114615521B (en) Video processing method and device, computer readable storage medium and electronic equipment
CN113542412B (en) Data transmission method, device, electronic equipment and storage 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