[go: up one dir, main page]

CN107277022B - Process marking method and device - Google Patents

Process marking method and device Download PDF

Info

Publication number
CN107277022B
CN107277022B CN201710501482.2A CN201710501482A CN107277022B CN 107277022 B CN107277022 B CN 107277022B CN 201710501482 A CN201710501482 A CN 201710501482A CN 107277022 B CN107277022 B CN 107277022B
Authority
CN
China
Prior art keywords
sequence
remote procedure
procedure call
request information
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.)
Active
Application number
CN201710501482.2A
Other languages
Chinese (zh)
Other versions
CN107277022A (en
Inventor
田新雪
马书惠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group 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 China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN201710501482.2A priority Critical patent/CN107277022B/en
Publication of CN107277022A publication Critical patent/CN107277022A/en
Application granted granted Critical
Publication of CN107277022B publication Critical patent/CN107277022B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Multi Processors (AREA)

Abstract

本发明实施例提供一种进程标记方法及装置。该方法包括:将远程过程调用协议的请求信息写入第一序列中;处理数据库事务;如果数据库事务失败,则移动所述第一序列的偏移坐标,所述偏移坐标用于标识所述请求信息已被处理完毕;如果数据库事务成功,则将所述请求信息写入第二序列中;如果所述请求信息成功写入所述第二序列中,则移动所述第一序列的偏移坐标。本发明实施例通过把队列技术应用到纯远程过程调用协议同步组合的微服务集群里,提高了远程过程调用协议和异步队列的业务消息的准确度。

Figure 201710501482

Embodiments of the present invention provide a process marking method and apparatus. The method includes: writing request information of a remote procedure call protocol into a first sequence; processing a database transaction; if the database transaction fails, moving offset coordinates of the first sequence, where the offset coordinates are used to identify the The request information has been processed; if the database transaction is successful, write the request information into the second sequence; if the request information is successfully written into the second sequence, move the offset of the first sequence coordinate. The embodiments of the present invention improve the accuracy of the business messages of the remote procedure call protocol and the asynchronous queue by applying the queuing technology to the micro-service cluster synchronously combined by the pure remote procedure call protocol.

Figure 201710501482

Description

进程标记方法及装置Process marking method and device

技术领域technical field

本发明实施例涉及通信技术领域,尤其涉及一种进程标记方法及装置。Embodiments of the present invention relate to the field of communication technologies, and in particular, to a process marking method and apparatus.

背景技术Background technique

远程过程调用协议,是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议。远程过程调用协议假定某些传输协议的存在,如TCP或UDP,为通信程序之间携带信息数据。在OSI网络通信模型中,远程过程调用协议跨越了传输层和应用层。远程过程调用协议使得开发包括网络分布式多程序在内的应用程序更加容易。远程过程调用协议采用客户机/服务器模式。请求程序就是一个客户机,而服务提供程序就是一个服务器。首先,客户机调用进程发送一个有进程参数的调用信息到服务进程,然后等待应答信息。在服务器端,进程保持睡眠状态直到调用信息到达为止。当一个调用信息到达,服务器获得进程参数,计算结果,发送答复信息,然后等待下一个调用信息,最后,客户端调用进程接收答复信息,获得进程结果,然后调用执行继续进行。A remote procedure call protocol is a protocol that requests services from a remote computer program over a network without knowing the underlying network technology. Remote Procedure Call Protocol assumes the existence of some transport protocol, such as TCP or UDP, to carry information data between communicating programs. In the OSI network communication model, the remote procedure call protocol spans the transport layer and the application layer. Remote procedure call protocols make it easier to develop applications including network distributed multiprogramming. The remote procedure call protocol uses a client/server model. The requestor is a client, and the service provider is a server. First, the client calling process sends a call message with process parameters to the server process, and then waits for a reply message. On the server side, the process stays asleep until the call message arrives. When a call message arrives, the server obtains the process parameters, calculates the result, sends a reply message, and then waits for the next call message. Finally, the client calls the process to receive the reply message, obtain the process result, and then the call execution continues.

但是,一个远程过程调用协议的处理线程对应一个高吞吐量的分布式发布订阅消息系统的函数,该函数用于跟踪该线程的处理状态,如果多个远程过程调用协议的处理线程并发执行,将导致需要大量的高吞吐量的分布式发布订阅消息系统的函数,造成远程过程调用协议和异步队列的业务消息不准确。However, the processing thread of a remote procedure call protocol corresponds to a function of a high-throughput distributed publish-subscribe message system. This function is used to track the processing status of the thread. If multiple processing threads of the remote procedure call protocol are executed concurrently, the This leads to the need for a large number of high-throughput distributed publish-subscribe message system functions, resulting in inaccurate business messages of remote procedure call protocols and asynchronous queues.

发明内容SUMMARY OF THE INVENTION

本发明实施例提供一种进程标记方法及装置,以提高远程过程调用协议和异步队列的业务消息的准确度。The embodiments of the present invention provide a process marking method and device, so as to improve the accuracy of the service messages of the remote procedure call protocol and the asynchronous queue.

本发明实施例的一个方面是提供一种进程标记方法,包括:An aspect of the embodiments of the present invention is to provide a process marking method, including:

将远程过程调用协议的请求信息写入第一序列中;Write the request information of the remote procedure call protocol into the first sequence;

处理数据库事务;handle database transactions;

如果数据库事务失败,则移动所述第一序列的偏移坐标,所述偏移坐标用于标识所述请求信息已被处理完毕;If the database transaction fails, move the offset coordinates of the first sequence, and the offset coordinates are used to identify that the request information has been processed;

如果数据库事务成功,则将所述请求信息写入第二序列中;If the database transaction is successful, writing the request information into the second sequence;

如果所述请求信息成功写入所述第二序列中,则移动所述第一序列的偏移坐标。If the request information is successfully written into the second sequence, the offset coordinates of the first sequence are moved.

本发明实施例的另一个方面是提供一种进程标记装置,包括:Another aspect of the embodiments of the present invention is to provide a process marking device, including:

写入模块,用于将远程过程调用协议的请求信息写入第一序列中;The writing module is used to write the request information of the remote procedure call protocol into the first sequence;

处理模块,用于处理数据库事务;Processing module for processing database transactions;

移动模块,用于当数据库事务失败时,移动所述第一序列的偏移坐标,所述偏移坐标用于标识所述请求信息已被处理完毕;a moving module, configured to move the offset coordinates of the first sequence when the database transaction fails, and the offset coordinates are used to identify that the request information has been processed;

如果数据库事务成功,则所述写入模块将所述请求信息写入第二序列中;If the database transaction is successful, the writing module writes the request information into the second sequence;

如果所述请求信息成功写入所述第二序列中,则所述移动模块移动所述第一序列的偏移坐标。If the request information is successfully written into the second sequence, the moving module moves the offset coordinates of the first sequence.

本发明实施例提供的进程标记方法及装置,通过把队列技术应用到纯远程过程调用协议同步组合的微服务集群里,提高了远程过程调用协议和异步队列的业务消息的准确度。The process marking method and device provided by the embodiments of the present invention improve the accuracy of the business messages of the remote procedure call protocol and the asynchronous queue by applying the queuing technology to the microservice cluster synchronously combined by the pure remote procedure call protocol.

附图说明Description of drawings

图1为本发明实施例提供的进程标记方法流程图;1 is a flowchart of a process marking method provided by an embodiment of the present invention;

图2为本发明另一实施例提供的进程标记方法流程图;2 is a flowchart of a process marking method provided by another embodiment of the present invention;

图3为本发明实施例提供的进程标记装置的结构图;3 is a structural diagram of a process marking device provided by an embodiment of the present invention;

图4为本发明另一实施例提供的进程标记装置的结构图。FIG. 4 is a structural diagram of a process marking apparatus provided by another embodiment of the present invention.

具体实施方式Detailed ways

为了防止数据库写入成功,然后写队列,但是队列写入失败,返回错误,让上游重试,上游可能会放弃,导致消息丢失的现象,或者是数据库写入成功,然后全机房断电的现象出现,也就是说我们需要防止当数据库的事务成功时,消息一定要保证写入队列里,如果数据库的事务失败,消息不应该出现在队列里,所以肯定不能先写队列,再写数据库,否则要让高吞吐量的分布式发布订阅消息系统支持消息的回滚的现象发生。本实施例提出仅依靠高吞吐量的分布式发布订阅消息系统和MySQL这两个组件,实现数据库与队列的一致性的方法。In order to prevent the database write successfully, and then write to the queue, but the queue write fails, returns an error, let the upstream retry, the upstream may give up, resulting in message loss, or the database is successfully written, and then the entire computer room is powered off. Appears, that is to say, we need to prevent the message from being written to the queue when the transaction of the database is successful. If the transaction of the database fails, the message should not appear in the queue, so it must not be written to the queue first, and then to the database, otherwise It is necessary for a high-throughput distributed publish-subscribe messaging system to support message rollback. This embodiment proposes a method for realizing the consistency between the database and the queue only by relying on the two components of a high-throughput distributed publish-subscribe message system and MySQL.

图1为本发明实施例提供的进程标记方法流程图。本发明实施例提供的进程标记方法具体步骤如下:FIG. 1 is a flowchart of a process marking method provided by an embodiment of the present invention. The specific steps of the process marking method provided by the embodiment of the present invention are as follows:

步骤S101、将远程过程调用协议的请求信息写入第一序列中。Step S101: Write the request information of the remote procedure call protocol into the first sequence.

在本实施例中,第一序列具体可以是头写入队列,第二序列具体可以是事务队列。远程过程调用协议采用客户机/服务器模式。请求程序就是一个客户机,而服务提供程序就是一个服务器。首先,客户机调用进程发送一个有进程参数的调用信息到服务进程,然后等待应答信息。在服务器端,进程保持睡眠状态直到调用信息到达为止。当一个调用信息到达,服务器获得进程参数,计算结果,发送答复信息,然后等待下一个调用信息,最后,客户端调用进程接收答复信息,获得进程结果,然后调用执行继续进行。In this embodiment, the first sequence may specifically be a head write queue, and the second sequence may specifically be a transaction queue. The remote procedure call protocol uses a client/server model. The requestor is a client, and the service provider is a server. First, the client calling process sends a call message with process parameters to the server process, and then waits for a reply message. On the server side, the process stays asleep until the call message arrives. When a call message arrives, the server obtains the process parameters, calculates the result, sends a reply message, and then waits for the next call message. Finally, the client calls the process to receive the reply message, obtain the process result, and then the call execution continues.

在本实施例中,可以将远程过程调用协议的请求信息写入头写入队列中,如果这个消息就写入失败,直接返回错误给调用方,让其重试。In this embodiment, the request information of the remote procedure call protocol can be written into the header write queue, and if the message fails to be written, an error is directly returned to the caller for retry.

步骤S102、处理数据库事务。Step S102, processing database transactions.

步骤S103、如果数据库事务失败,则移动所述第一序列的偏移坐标,所述偏移坐标用于标识所述请求信息已被处理完毕。Step S103: If the database transaction fails, move the offset coordinates of the first sequence, where the offset coordinates are used to identify that the request information has been processed.

如果数据库事务失败,移动头写入队列的偏移坐标,代表这个请求已经被处理完毕。If the database transaction fails, the offset coordinate of the moving head is written to the queue, indicating that the request has been processed.

步骤S104、如果数据库事务成功,则将所述请求信息写入第二序列中。Step S104, if the database transaction is successful, write the request information into the second sequence.

如果数据库事务成功,接下来写入事务队列这个程序。If the database transaction is successful, the next procedure is to write to the transaction queue.

步骤S105、如果所述请求信息成功写入所述第二序列中,则移动所述第一序列的偏移坐标。Step S105: If the request information is successfully written into the second sequence, move the offset coordinates of the first sequence.

如果写入队列成功,移动头写入队列的偏移坐标,代表这个请求已经被处理完毕。另外,如果写入队列失败,返回成功给调用方,然后异步去重试写入事务队列这个程序。If the write queue is successful, move the offset coordinate of the head write queue, indicating that the request has been processed. In addition, if the write to the queue fails, return success to the caller, and then asynchronously retry the process of writing to the transaction queue.

在数据库事务成功到消息写入到事务队列这个程序中间,头写入队列的偏移坐标都是没有被移动的,也就是如果这个过程被中断,可以从头写入队列恢复回来。经过重试,最终事务队列写入成功。这个时候移动头写入队列的偏移坐标,标记这个请求被处理完毕。In the process between the successful database transaction and the message writing to the transaction queue, the offset coordinates of the head write queue are not moved, that is, if the process is interrupted, it can be resumed from the head write queue. After retries, the final transaction queue is successfully written. At this time, the offset coordinate of the moving head is written to the queue, marking that the request has been processed.

以上过程,通过引入头写入队列以及控制这个程序的偏移坐标位置,来标记完整的分布式事务是否已经被处理完成。该方法不同于以往的以数据库的事务为标准来衡量这个处理是否完成的方法。在这个过程中没有回滚的需求,只要数据库写入成功,消息队列写入无论如何都要成功。整个方案的关键是通过头写入队列的写入和偏移坐标的移动这两个动作,标记了一个分布式事务的范围。只要这个过程没有完全做完,就会通过不断重试头写入队列的方式保证其最终会被完整执行。The above process marks whether the complete distributed transaction has been processed by introducing the head write queue and controlling the offset coordinate position of the program. This method is different from the previous method of measuring whether the processing is completed based on the transaction of the database. There is no need for rollback in this process, as long as the database write is successful, the message queue write must succeed no matter what. The key to the whole scheme is to mark the scope of a distributed transaction through the writing of the head write queue and the movement of the offset coordinates. As long as this process is not completely completed, it will be guaranteed that it will eventually be fully executed by continuously retrying the head write queue.

本发明实施例通过把队列技术应用到纯远程过程调用协议同步组合的微服务集群里,提高了远程过程调用协议和异步队列的业务消息的准确度。The embodiments of the present invention improve the accuracy of the business messages of the remote procedure call protocol and the asynchronous queue by applying the queuing technology to the micro-service cluster synchronously combined by the pure remote procedure call protocol.

图2为本发明另一实施例提供的进程标记方法流程图。在上述实施例的基础上,本发明实施例提供的进程标记方法具体步骤如下:FIG. 2 is a flowchart of a process marking method provided by another embodiment of the present invention. On the basis of the foregoing embodiment, the specific steps of the process marking method provided by the embodiment of the present invention are as follows:

步骤S201、标记每个远程过程调用协议线程,每个远程过程调用协议线程对应一个偏移坐标,所述偏移坐标用于标识所述远程过程调用协议线程是否执行成功。Step S201: Mark each RPC protocol thread, each RPC protocol thread corresponds to an offset coordinate, and the offset coordinate is used to identify whether the RPC protocol thread is successfully executed.

步骤S202、若第一远程过程调用协议线程在第二远程过程调用协议线程之前,所述第二远程过程调用协议线程被成功执行,所述第一远程过程调用协议线程没有被执行,则不移动所述偏移坐标。Step S202, if the first remote procedure call protocol thread is before the second remote procedure call protocol thread, the second remote procedure call protocol thread is successfully executed, and the first remote procedure call protocol thread is not executed, do not move the offset coordinates.

步骤S203、若第一远程过程调用协议线程在第二远程过程调用协议线程之前,所述第一远程过程调用协议线程被成功执行,所述第二远程过程调用协议线程没有被执行,则移动所述偏移坐标。Step S203: If the first remote procedure call protocol thread is before the second remote procedure call protocol thread, the first remote procedure call protocol thread is successfully executed, and the second remote procedure call protocol thread is not executed. the offset coordinates.

如果要把重要的业务逻辑挂在消息队列后面。必须要保证消息队列里的数据的完整性,不能有丢失的情况。所以不能是把消息队列的写入作为一个旁路的逻辑,而是应该把消息队列放入到主流程。如果消息队列写入失败或者超时,都应该直接返回错误,而不是允许继续执行。If you want to hang important business logic behind the message queue. The integrity of the data in the message queue must be guaranteed, and there can be no loss. Therefore, the writing of the message queue cannot be used as a bypass logic, but the message queue should be put into the main process. If the message queue write fails or times out, an error should be returned directly instead of allowing execution to continue.

本方案中我们将这个本地的队列封装到一个高吞吐量的分布式发布订阅消息系统的代理作为本地写入的代理,也就是说引入本地队列作为兜底。高吞吐量的分布式发布订阅消息系统的稳定性和延迟时常不能满足在线服务的需要。例如,如果要可靠写入三个副本,高吞吐量的分布式发布订阅消息系统需要等待多个中间件的应答,这个延迟可能会有比较大的波动。在无法及时写入的情况,所以我们需要使用本文提出的本地文件兜底的方式充当一个缓冲,实际上是通过引入本地文件队列结合远程分布式队列构成一个可用性更高,延迟更低的组合队列方案。In this solution, we encapsulate this local queue into a high-throughput distributed publish-subscribe messaging system as the agent for local writing, that is to say, introduce the local queue as the bottom line. The stability and latency of high-throughput distributed publish-subscribe messaging systems often cannot meet the needs of online services. For example, if three replicas are to be written reliably, a high-throughput distributed publish-subscribe messaging system needs to wait for responses from multiple middleware, and this delay may fluctuate greatly. In the case where it is impossible to write in time, we need to use the local file method proposed in this article to act as a buffer. In fact, a combined queue scheme with higher availability and lower latency is formed by introducing a local file queue and a remote distributed queue. .

在没有头写入队列的时候,远程过程调用协议执行过程如下:串行过程,因为没有保护,所以可能被中断,不能被确保完整执行。引入头写入队列的目的就是让这个过程变得可靠。When no header is written to the queue, the remote procedure call protocol executes as follows: The serial procedure, because it is not protected, may be interrupted and cannot be guaranteed to execute completely. The purpose of introducing the head write queue is to make this process reliable.

假设是整个处理过程,对于一个高吞吐量的分布式发布订阅消息系统的函数是独占的,这也就意味着有多少个远程过程调用协议的并发处理线程(或者协程)就需要有多少个对应的函数来跟踪对应线程的处理状态。这样就会变得很不经济,需要大量的高吞吐量的分布式发布订阅消息系统函数。但是如果让多个远程过程调用协议线程共享一个高吞吐量的分布式发布订阅消息系统函数,需要新增加一个管理者单元去协调多个远程过程调用协议线程的坐标的移动并标记事务的执行成功。具体过程如下:Assuming the entire processing process, the functions of a high-throughput distributed publish-subscribe message system are exclusive, which means that there are as many concurrent processing threads (or coroutines) as there are multiple remote procedure call protocols. The corresponding function to track the processing status of the corresponding thread. This becomes very uneconomical and requires a large number of high-throughput distributed publish-subscribe messaging system functions. However, if multiple remote procedure call protocol threads share a high-throughput distributed publish-subscribe message system function, a new manager unit needs to be added to coordinate the movement of the coordinates of multiple remote procedure call protocol threads and mark the execution of the transaction successfully. . The specific process is as follows:

远程过程调用协议线程1,写入了A1(头写入日志),其偏移坐标为1。The remote procedure call protocol thread 1 has written to A1 (the header is written to the log), and its offset coordinate is 1.

远程过程调用协议线程2,写入了A2,其偏移坐标为2。Remote procedure call protocol thread 2, wrote A2, its offset coordinate is 2.

远程过程调用协议线程3,写入了A3,其偏移坐标为3。The remote procedure call protocol thread 3 has written A3, and its offset coordinate is 3.

远程过程调用协议线程3执行完毕,欲把A3标记为执行成功,移动偏移坐标到3。但是因为前面1和2,还没有执行成功,这个时候偏移坐标不能被移动。After the remote procedure call protocol thread 3 is executed, to mark A3 as successful, move the offset coordinate to 3. However, because the previous 1 and 2 have not been successfully executed, the offset coordinates cannot be moved at this time.

远程过程调用协议线程1执行完毕,欲把A1标记为执行成功,移动偏移坐标到1。因为前面没有尚未执行完成的A,所以这个时候偏移坐标被移动到1成功。After the remote procedure call protocol thread 1 is executed, to mark A1 as successful, move the offset coordinate to 1. Because there is no A that has not yet been executed, the offset coordinate is moved to 1 successfully at this time.

远程过程调用协议线程2执行完毕,欲把A2标记为执行成功,移动偏移坐标到2。因为后面的3已经被执行完了,所以偏移坐标被直接更新为3。After the remote procedure call protocol thread 2 is executed, to mark A2 as successful, move the offset coordinate to 2. Because the latter 3 has been executed, the offset coordinate is directly updated to 3.

步骤S204、将远程过程调用协议的请求信息写入第一序列中。Step S204: Write the request information of the remote procedure call protocol into the first sequence.

步骤S205、处理数据库事务。Step S205, processing database transactions.

步骤S206、如果数据库事务失败,则移动所述第一序列的偏移坐标,所述偏移坐标用于标识所述请求信息已被处理完毕。Step S206: If the database transaction fails, move the offset coordinates of the first sequence, and the offset coordinates are used to identify that the request information has been processed.

步骤S207、如果数据库事务成功,则将所述请求信息写入第二序列中。Step S207, if the database transaction is successful, write the request information into the second sequence.

步骤S208、如果所述请求信息成功写入所述第二序列中,则移动所述第一序列的偏移坐标。Step S208: If the request information is successfully written into the second sequence, move the offset coordinates of the first sequence.

本发明实施例通过把队列技术应用到纯远程过程调用协议同步组合的微服务集群里,提高了远程过程调用协议和异步队列的业务消息的准确度。The embodiments of the present invention improve the accuracy of the business messages of the remote procedure call protocol and the asynchronous queue by applying the queuing technology to the micro-service cluster synchronously combined by the pure remote procedure call protocol.

图3为本发明实施例提供的进程标记装置的结构图。本发明实施例提供的进程标记装置可以执行进程标记方法实施例提供的处理流程,如图3所示,进程标记装置30包括:写入模块31、处理模块32、移动模块33,其中,写入模块31用于将远程过程调用协议的请求信息写入第一序列中;处理模块32用于处理数据库事务;移动模块33用于当数据库事务失败时,移动所述第一序列的偏移坐标,所述偏移坐标用于标识所述请求信息已被处理完毕;如果数据库事务成功,则写入模块31将所述请求信息写入第二序列中;如果所述请求信息成功写入所述第二序列中,则移动模块33移动所述第一序列的偏移坐标。FIG. 3 is a structural diagram of a process marking apparatus provided by an embodiment of the present invention. The process marking apparatus provided by the embodiment of the present invention may execute the processing flow provided by the process marking method embodiment. As shown in FIG. 3 , the process marking apparatus 30 includes: a writing module 31 , a processing module 32 , and a moving module 33 , wherein the writing The module 31 is used to write the request information of the remote procedure call protocol into the first sequence; the processing module 32 is used to process the database transaction; the moving module 33 is used to move the offset coordinates of the first sequence when the database transaction fails, The offset coordinates are used to identify that the request information has been processed; if the database transaction is successful, the writing module 31 writes the request information into the second sequence; if the request information is successfully written into the first sequence. In the second sequence, the moving module 33 moves the offset coordinates of the first sequence.

本发明实施例通过把队列技术应用到纯远程过程调用协议同步组合的微服务集群里,提高了远程过程调用协议和异步队列的业务消息的准确度。The embodiments of the present invention improve the accuracy of the business messages of the remote procedure call protocol and the asynchronous queue by applying the queuing technology to the micro-service cluster synchronously combined by the pure remote procedure call protocol.

图4为本发明另一实施例提供的进程标记装置的结构图。在上述实施例的基础上,如果所述请求信息没有成功写入所述第二序列中,则写入模块31重新将所述请求信息写入第二序列中。FIG. 4 is a structural diagram of a process marking apparatus provided by another embodiment of the present invention. On the basis of the above embodiment, if the request information is not successfully written into the second sequence, the writing module 31 re-writes the request information into the second sequence.

进一步的,进程标记装置30还包括:标记模块34,标记模块34用于标记每个远程过程调用协议线程,每个远程过程调用协议线程对应一个偏移坐标,所述偏移坐标用于标识所述远程过程调用协议线程是否执行成功。Further, the process marking device 30 further includes: a marking module 34, the marking module 34 is used to mark each remote procedure call protocol thread, each remote procedure call protocol thread corresponds to an offset coordinate, and the offset coordinate is used to identify all the remote procedure call protocol threads. Whether the remote procedure call protocol thread is executed successfully.

若第一远程过程调用协议线程在第二远程过程调用协议线程之前,所述第二远程过程调用协议线程被成功执行,所述第一远程过程调用协议线程没有被执行,则移动模块33不移动所述偏移坐标。If the first RPC protocol thread is before the second RPC protocol thread, the second RPC protocol thread is successfully executed, and the first RPC protocol thread is not executed, the moving module 33 does not move the offset coordinates.

若第一远程过程调用协议线程在第二远程过程调用协议线程之前,所述第一远程过程调用协议线程被成功执行,所述第二远程过程调用协议线程没有被执行,则移动模块33移动所述偏移坐标。If the first RPC protocol thread is before the second RPC protocol thread, the first RPC protocol thread is successfully executed, and the second RPC protocol thread is not executed, the moving module 33 moves the the offset coordinates.

本发明实施例提供的进程标记装置可以具体用于执行上述图1所提供的方法实施例,具体功能此处不再赘述。The process marking apparatus provided in the embodiment of the present invention may be specifically used to execute the method embodiment provided in the foregoing FIG. 1 , and the specific functions will not be repeated here.

本发明实施例通过把队列技术应用到纯远程过程调用协议同步组合的微服务集群里,提高了远程过程调用协议和异步队列的业务消息的准确度。The embodiments of the present invention improve the accuracy of the business messages of the remote procedure call protocol and the asynchronous queue by applying the queuing technology to the micro-service cluster synchronously combined by the pure remote procedure call protocol.

综上所述,本发明实施例通过把队列技术应用到纯远程过程调用协议同步组合的微服务集群里,提高了远程过程调用协议和异步队列的业务消息的准确度。To sum up, the embodiments of the present invention improve the accuracy of business messages of the remote procedure call protocol and the asynchronous queue by applying the queuing technology to the microservice cluster synchronously combined by the pure remote procedure call protocol.

在本发明所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.

上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本发明各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The above-mentioned integrated units implemented in the form of software functional units can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute the methods described in the various embodiments of the present invention. some steps. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .

本领域技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的装置的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of the description, only the division of the above functional modules is used for illustration. The internal structure is divided into different functional modules to complete all or part of the functions described above. For the specific working process of the apparatus described above, reference may be made to the corresponding process in the foregoing method embodiments, and details are not described herein again.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features thereof can be equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention. scope.

Claims (8)

1.一种进程标记方法,其特征在于,包括:1. a process marking method, is characterized in that, comprises: 将远程过程调用协议的请求信息写入第一序列中;Write the request information of the remote procedure call protocol into the first sequence; 处理数据库事务;handle database transactions; 如果数据库事务失败,则移动所述第一序列的偏移坐标,所述偏移坐标用于标识所述请求信息已被处理完毕;If the database transaction fails, move the offset coordinates of the first sequence, and the offset coordinates are used to identify that the request information has been processed; 如果数据库事务成功,则将所述请求信息写入第二序列中;If the database transaction is successful, writing the request information into the second sequence; 如果所述请求信息成功写入所述第二序列中,则移动所述第一序列的偏移坐标;If the request information is successfully written into the second sequence, moving the offset coordinates of the first sequence; 如果所述请求信息没有成功写入所述第二序列中,则重新将所述请求信息写入第二序列中。If the request information is not successfully written into the second sequence, the request information is rewritten into the second sequence. 2.根据权利要求1所述的方法,其特征在于,所述将远程过程调用协议的请求信息写入第一序列中之前,还包括:2. The method according to claim 1, wherein before the request information of the remote procedure call protocol is written into the first sequence, the method further comprises: 标记每个远程过程调用协议线程,每个远程过程调用协议线程对应一个偏移坐标,所述偏移坐标用于标识所述远程过程调用协议线程是否执行成功。Each RPC protocol thread is marked, and each RPC protocol thread corresponds to an offset coordinate, and the offset coordinate is used to identify whether the RPC protocol thread is executed successfully. 3.根据权利要求2所述的方法,其特征在于,若第一远程过程调用协议线程在第二远程过程调用协议线程之前,所述第二远程过程调用协议线程被成功执行,所述第一远程过程调用协议线程没有被执行,则不移动所述偏移坐标。3. The method according to claim 2, wherein if the first remote procedure call protocol thread is before the second remote procedure call protocol thread, the second remote procedure call protocol thread is successfully executed, and the first remote procedure call protocol thread is successfully executed. If the RPC thread is not being executed, the offset coordinates are not moved. 4.根据权利要求2所述的方法,其特征在于,若第一远程过程调用协议线程在第二远程过程调用协议线程之前,所述第一远程过程调用协议线程被成功执行,所述第二远程过程调用协议线程没有被执行,则移动所述偏移坐标。4. The method according to claim 2, wherein if the first RPC protocol thread is before the second RPC protocol thread, the first RPC protocol thread is successfully executed, the second RPC protocol thread is successfully executed. If the remote procedure call protocol thread is not being executed, the offset coordinates are moved. 5.一种进程标记装置,其特征在于,包括:5. A process marking device, characterized in that, comprising: 写入模块,用于将远程过程调用协议的请求信息写入第一序列中;The writing module is used to write the request information of the remote procedure call protocol into the first sequence; 处理模块,用于处理数据库事务;Processing module for processing database transactions; 移动模块,用于当数据库事务失败时,移动所述第一序列的偏移坐标,所述偏移坐标用于标识所述请求信息已被处理完毕;a moving module, configured to move the offset coordinates of the first sequence when the database transaction fails, and the offset coordinates are used to identify that the request information has been processed; 如果数据库事务成功,则所述写入模块将所述请求信息写入第二序列中;If the database transaction is successful, the writing module writes the request information into the second sequence; 如果所述请求信息成功写入所述第二序列中,则所述移动模块移动所述第一序列的偏移坐标;If the request information is successfully written into the second sequence, the moving module moves the offset coordinates of the first sequence; 如果所述请求信息没有成功写入所述第二序列中,则所述写入模块重新将所述请求信息写入第二序列中。If the request information is not successfully written into the second sequence, the writing module re-writes the request information into the second sequence. 6.根据权利要求5所述的进程标记装置,其特征在于,还包括:6. The process marking device according to claim 5, further comprising: 标记模块,用于标记每个远程过程调用协议线程,每个远程过程调用协议线程对应一个偏移坐标,所述偏移坐标用于标识所述远程过程调用协议线程是否执行成功。The marking module is used to mark each remote procedure call protocol thread, and each remote procedure call protocol thread corresponds to an offset coordinate, and the offset coordinate is used to identify whether the execution of the remote procedure call protocol thread is successful. 7.根据权利要求6所述的进程标记装置,其特征在于,若第一远程过程调用协议线程在第二远程过程调用协议线程之前,所述第二远程过程调用协议线程被成功执行,所述第一远程过程调用协议线程没有被执行,则所述移动模块不移动所述偏移坐标。7. The process marking device according to claim 6, wherein if the first RPC protocol thread is before the second RPC protocol thread, the second RPC protocol thread is successfully executed, the If the first remote procedure call protocol thread is not executed, the moving module does not move the offset coordinates. 8.根据权利要求7所述的进程标记装置,其特征在于,若第一远程过程调用协议线程在第二远程过程调用协议线程之前,所述第一远程过程调用协议线程被成功执行,所述第二远程过程调用协议线程没有被执行,则所述移动模块移动所述偏移坐标。8. The process marking device according to claim 7, wherein if the first RPC protocol thread is before the second RPC protocol thread, the first RPC protocol thread is successfully executed, the If the second remote procedure call protocol thread is not executed, the moving module moves the offset coordinates.
CN201710501482.2A 2017-06-27 2017-06-27 Process marking method and device Active CN107277022B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710501482.2A CN107277022B (en) 2017-06-27 2017-06-27 Process marking method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710501482.2A CN107277022B (en) 2017-06-27 2017-06-27 Process marking method and device

Publications (2)

Publication Number Publication Date
CN107277022A CN107277022A (en) 2017-10-20
CN107277022B true CN107277022B (en) 2020-03-13

Family

ID=60069666

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710501482.2A Active CN107277022B (en) 2017-06-27 2017-06-27 Process marking method and device

Country Status (1)

Country Link
CN (1) CN107277022B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108415736B (en) * 2018-02-06 2021-03-30 新浪网技术(中国)有限公司 Method, device and equipment for marking program process by using process file system
CN110532066A (en) * 2018-05-23 2019-12-03 中国移动通信集团浙江有限公司 A kind of realization method and system of transaction consistency
CN110659141B (en) * 2018-06-30 2022-01-04 武汉斗鱼网络科技有限公司 Instruction execution method and related equipment
CN109725944A (en) * 2018-12-29 2019-05-07 北京三快在线科技有限公司 Remote procedure calling (PRC) method and device, electronic equipment, storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1725186A (en) * 2004-07-23 2006-01-25 中兴通讯股份有限公司 Multiple data base data syne method
CN101097527A (en) * 2006-06-27 2008-01-02 中国银联股份有限公司 A process scheduling method and system for an application process
CN102023974A (en) * 2009-09-14 2011-04-20 中国移动通信集团公司 Method, device and system for processing message by message queue
US8185622B2 (en) * 2007-10-16 2012-05-22 Ricoh Company, Ltd. Condition dependent data maintenance system for a plurality of functional entities
CN105095364A (en) * 2015-06-26 2015-11-25 车智互联(北京)科技有限公司 Data synchronizing system and method
CN105956166A (en) * 2016-05-19 2016-09-21 北京京东尚科信息技术有限公司 Database reading-writing method and database reading-writing apparatus

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7617253B2 (en) * 2005-12-19 2009-11-10 Commvault Systems, Inc. Destination systems and methods for performing data replication

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1725186A (en) * 2004-07-23 2006-01-25 中兴通讯股份有限公司 Multiple data base data syne method
CN101097527A (en) * 2006-06-27 2008-01-02 中国银联股份有限公司 A process scheduling method and system for an application process
US8185622B2 (en) * 2007-10-16 2012-05-22 Ricoh Company, Ltd. Condition dependent data maintenance system for a plurality of functional entities
CN102023974A (en) * 2009-09-14 2011-04-20 中国移动通信集团公司 Method, device and system for processing message by message queue
CN105095364A (en) * 2015-06-26 2015-11-25 车智互联(北京)科技有限公司 Data synchronizing system and method
CN105956166A (en) * 2016-05-19 2016-09-21 北京京东尚科信息技术有限公司 Database reading-writing method and database reading-writing apparatus

Also Published As

Publication number Publication date
CN107277022A (en) 2017-10-20

Similar Documents

Publication Publication Date Title
CN107277022B (en) Process marking method and device
US10592464B2 (en) Methods for enabling direct memory access (DMA) capable devices for remote DMA (RDMA) usage and devices thereof
US10382380B1 (en) Workload management service for first-in first-out queues for network-accessible queuing and messaging services
US9986028B2 (en) Techniques to replicate data between storage servers
CN107402722B (en) A data migration method and storage device
CN104216862B (en) Communication method and device between user process and system service
US20140289200A1 (en) Control method, and information processing system
CN102023974B (en) A method, device and system for processing messages through a message queue
CN108965457A (en) A kind of message delivery method of distributed cluster system, device, equipment and medium
WO2019037617A1 (en) Data transaction processing method, device, and electronic device
CN114138838B (en) Data processing method, device, equipment and medium
CN110046047A (en) An inter-process communication method, device and computer-readable storage medium
WO2020238748A1 (en) Data synchronization processing method and apparatus, electronic device and computer storage medium
CN111290836A (en) Virtual machine snapshot creating method and device, storage medium and computer equipment
CN107239238B (en) A kind of IO operation method and device based on distributed lock storage
CN106331081B (en) A kind of information synchronization method and device
CN108874555A (en) A kind of method and device for writing message to message-oriented middleware
CN112363762B (en) A fusion command processing method, system, device and medium
CN115774621B (en) A request processing method, system, device and computer-readable storage medium
CN112905668A (en) Database derivative method, apparatus, and medium based on distributed data stream processing engine
CN112148206A (en) A data reading and writing method, device, electronic device and medium
CN103064898A (en) Business locking and unlocking method and device
CN116601616A (en) A data processing device, method and related equipment
CN111061474B (en) Lamda programming device and data processing method thereof
CN111142795A (en) Control method, control device and control device for write operation of distributed storage system

Legal Events

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