WO2016184315A1 - 一种基于网络连接服务的升级方法和装置 - Google Patents
一种基于网络连接服务的升级方法和装置 Download PDFInfo
- Publication number
- WO2016184315A1 WO2016184315A1 PCT/CN2016/081215 CN2016081215W WO2016184315A1 WO 2016184315 A1 WO2016184315 A1 WO 2016184315A1 CN 2016081215 W CN2016081215 W CN 2016081215W WO 2016184315 A1 WO2016184315 A1 WO 2016184315A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- network connection
- network
- module
- session data
- file descriptor
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0823—Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
Definitions
- the present application relates to the field of computers, and in particular, to an upgrade method and apparatus based on a network connection service.
- Program upgrade is an operation that is often required during system operation and maintenance.
- the service request is usually routed to other service nodes, or the process is directly interrupted and restarted quickly.
- the network connection will be interrupted, and the user request may have an instantaneous error failure.
- the prior art provides an upgrade solution that does not stop the program service when the upgrade is implemented through dynamic library switching.
- its shortcomings are high development difficulty, high requirements on code implementation details, complete isolation of logic and isolation of memory management, and the need to restart the network management module to affect the user experience.
- an upgrade method based on a network connection service including:
- the first process queries the network connection according to a preset condition
- the first process sends the file descriptor and session data of the network connection obtained by the query to the second process;
- the second process continues the network connection according to the received file descriptor and the session data.
- an upgrade device based on a network connection service including:
- a first module configured to start a second process when the first process performs a network connection
- a second module configured to query, by the first process, the network connection according to a preset condition
- a third module configured to send, by the first process, the file descriptor and the session data of the network connection obtained by the query to the second process;
- a fourth module configured by the second process to continue the network connection according to the received file descriptor and the session data.
- the application starts a second process that has completed the upgrade, and the first process switches the appropriate network connection to the second process according to the preset condition, until the first process All network connections are switched to the second process, so that the network connection will not be interrupted due to the upgrade, and the user will not be affected by the network upgrade.
- FIG. 1 is a schematic structural diagram of a network connection service-based upgrading apparatus according to an aspect of the present application
- FIG. 2 is a schematic structural diagram of a network connection service-based upgrading apparatus according to still another aspect of the present application.
- FIG. 3 is a schematic flow chart showing a method for upgrading a network connection service according to an aspect of the present application
- FIG. 4 is a flow chart showing a method for upgrading a network connection service according to still another aspect of the present application.
- the upgrading apparatus 1 shows a schematic structural diagram of a network connection service-based upgrading apparatus according to an aspect of the present application. As shown in FIG. 1, the upgrading apparatus 1 includes a first module 11, a second module 12, a third module 13, and a fourth module 14.
- the first module 11 is configured to start a second process when the first process performs a network connection, and the second module 12 is configured to query, by the first process, the network connection according to a preset condition;
- the first process sends the file descriptor and the session data of the network connection obtained by the query to the second process;
- the fourth module 14 is configured by the second process according to the received file descriptor and the session data. Continue with the network connection.
- the first process is an old process
- the second process is a new process after the upgrade is completed
- the network connection may be a TCP (Transmission Control Protocol) network connection.
- the preset condition needs to ensure that the data stream to be switched by the network connection does not have a context dependency.
- the file descriptor can use FD (File Descriptor) data
- the session data can use Session data.
- the first module 11 starts the second process
- the second module 12 queries the network connection of the first process according to the preset condition
- the third module 13 queries the obtained file descriptor and session data of the network connection.
- Sent to the second process; the fourth module 14 receives the text according to the second process
- the piece descriptor and session data continue the network connection from the first process switch. This ensures that no network service interruption occurs when the network connection is switched from the first process to the second process.
- the upgrading apparatus 1 includes a first module 11, a second module 12, a third module 13, and a fourth module 14.
- the first module 11 is configured to start a second process when the first process performs a network connection, and the second module 12 is configured to query, by the first process, the network connection according to a preset condition;
- the first process sends the file descriptor and the session data of the network connection obtained by the query to the second process;
- the fourth module 14 is configured by the second process according to the received file descriptor and the session data. Continue with the network connection.
- the first process is the old process
- the second process is the new process after the upgrade is completed
- the network connection can be connected by using a TCP network.
- the preset condition needs to ensure that the data stream to be switched by the network connection does not have a context dependency.
- the file descriptor can use FD data
- the session data can use Session data.
- the session data includes information such as user authorization status and service processing definition variables, and each session data manages a TCP network connection.
- the first module 11 starts the second process
- the second module 12 queries the network connection of the first process according to the preset condition
- the third module 13 queries the obtained file descriptor and session data of the network connection.
- Sending to the second process; the fourth module 14 continues the network connection of the first process switching according to the file descriptor and the session data received by the second process. This ensures that no network service interruption occurs when the network connection is switched from the first process to the second process.
- the first module 11 includes: a first submodule 111 and a first two submodule 112.
- the first sub-module 111 is configured to start the second process and start network monitoring of the second process when the first process performs network monitoring; the first two sub-module 112 is configured to close the first Network monitoring of a process.
- the first sub-module 111 starts the network monitoring of the second process, and during the startup process of the network monitoring of the second process, the first process and the second process are both in the network monitoring situation.
- the newly established network connection will be randomly assigned to either the first process or the second process to ensure that the network service will not be interrupted.
- the first two sub-modules 112 close the first process to ensure that the newly established network connections are all assigned to the second process.
- the listening port needs to be set to REUSE_PORT mode to allow the first process and the second process to listen to the same port at the same time.
- the preset condition includes: the data connection of the network connection does not have an interdependency relationship.
- the second module is further configured to: query a network connection that does not have an unprocessed network request or a network response; or query a data flow network connection that has a breakpoint resuming state.
- the Request (Request) and Response (Response) methods are used for communication.
- the network connection can be The first process switches to the second process, and the network service is not interrupted.
- data stream network connections such as TCP communication of video streams
- video streams are generally sent as block data, that is, data is transmitted by using one piece of content.
- the network connection of the video stream can be first. The process switches to the second process and the network service is not interrupted.
- the upgrading apparatus 1 further includes: a fifth module 15.
- the fifth module 15 is configured to close the read/write event of the network connection obtained by the first process query.
- the fifth module 15 closes the read/write event of the first process, and the closed read/write event should be a read/write event of the network connection obtained by querying according to the preset condition, thereby cutting off the network connection of the second process.
- the third module 13 is further configured to: send, by the first process, the file descriptor and the session data to the second process by using inter-process data communication.
- the third module 13 establishes inter-process data communication between the first process and the second process through the Socket domain socket, so that the first process successfully sends the file descriptor and the session data to the second process.
- the third module 13 is further configured to serialize the session data by the first process; the first process sends the serialized session data to the second process.
- the third module 13 serializes the session data to facilitate network transmission.
- the fourth module 14 includes: a fourth sub-module 141 and a fourth sub-module 142.
- the upgrade device 1 further includes a sixth module 16.
- the fourth sub-module 141 is configured to deserialize the received session data into a corresponding object
- the fourth second sub-module 142 is configured to perform, by the second process, the network transceiver by using the received file descriptor.
- the sixth module 16 closes the file descriptor of the network connection of the first process and releases the resource.
- the fourth sub-module 141 deserializes the received session data (Session), and processes it into an object structure or a data structure that can be easily recognized.
- the fourth two submodule 142 controls the network transceiver module to transmit and receive the network connection data that is switched to the second process according to the file descriptor sent by the first process. At this point, the network connection of the first process is successfully switched to the second process.
- the sixth module 16 closes the file descriptor of the first process and releases the resources to close the network connection of the first process. Repeat the above steps of switching and closing the network connection until all network connections of the first process are switched to the second process, thereby ensuring that the network service is not interrupted during the upgrade.
- FIG. 3 is a flow chart showing a method for upgrading a network connection service according to an aspect of the present application. As shown in FIG. 3, the upgrade method includes:
- Step S301 when the first process performs a network connection, starting the second process
- Step S302 the first process queries the network connection according to a preset condition
- Step S303 the first process sends the file descriptor and session data of the network connection obtained by the query to the second process;
- Step S304 the second process continues the network connection according to the received file descriptor and the session data.
- the first process is the old process
- the second process is the new process after the upgrade is completed
- the network connection can be connected by using a TCP network.
- the preset condition needs to ensure that the data stream to be switched by the network connection does not have a context dependency.
- the file descriptor can use FD data
- the session data can use Session data.
- the session data includes information such as user authorization status and service processing definition variables, and each session data manages a TCP network connection.
- the second process is started; the network connection of the first process is queried according to the preset condition; the file descriptor and the session data of the network connection obtained by the query are sent to the second process; according to the second process The received file descriptor and session data continue with the network connection from the first process switch. This ensures that no network service interruption occurs when the network connection is switched from the first process to the second process.
- step S301 when the first process performs a network connection, starting the second process includes:
- Step S3011 When the first process performs network monitoring, start the second process and start network monitoring of the second process.
- step S3012 the network monitoring of the first process is closed.
- the network monitoring of the second process is started.
- the network monitoring of both the first process and the second process occurs, and the newly established network connection occurs. Any one of the first process or the second process is randomly assigned to ensure that the network service is not interrupted.
- the first process is closed to ensure that the newly established network connection is assigned to the second process.
- the listening port needs to be set to REUSE_PORT mode to allow the first process and the second process to listen to the same port at the same time.
- the preset condition includes: the data connection of the network connection does not have an interdependency relationship.
- the querying, by the first process, the network connection according to the preset condition includes: querying a network connection that has not been processed or a network response; or querying a data flow network connection having a resumed state.
- the Request (Request) and Response (Response) modes are used for communication.
- the network connection can be switched from the first process to the second process.
- the network service will not be interrupted.
- data stream network connections such as TCP for video streams Connection
- the video stream is generally sent as block data, that is, the data is transmitted by using one piece of content.
- the network connection of the video stream can be switched from the first process to the second process. Will not be interrupted.
- the upgrading method further includes:
- Step S305 closing the read/write event of the network connection obtained by the first process query.
- the read and write event of the first process is closed, and the read and write event that is closed should be a read/write event of the network connection obtained by querying according to the preset condition, thereby cutting off the network connection of the second process.
- step S303 the sending, by the first process, the file descriptor and session data of the network connection obtained by the query to the second process includes:
- the first process sends the file descriptor and the session data to the second process by inter-process data communication.
- establishment of inter-process data communication between the first process and the second process is established through the Socket domain socket, so that the first process successfully sends the file descriptor and the session data to the second process.
- the upgrading method further includes:
- Step S306 the first process serializes the session data.
- Step S307 the first process sends the serialized session data to the second process.
- session data is serialized for network transmission.
- step S304 the performing, by the second process, the network connection according to the received file descriptor and the session data includes:
- Step S3041 the second process deserializes the received session data into a corresponding object
- Step S3042 The second process performs network sending and receiving by using the received file descriptor.
- Step S3043 closing the file descriptor of the network connection of the first process and releasing the resource.
- the received session data (Session) is processed into an object structure or a data structure that can be easily recognized.
- the control network transceiver module transmits and receives the network connection data that is switched to the second process.
- the network connection of the first process is successfully switched to the second process.
- the file descriptor of the first process is closed and the resources are released to close the network connection of the first process. Repeat the above steps of switching and closing the network connection until all network connections of the first process are switched to the second process, thereby ensuring that the network service is not interrupted during the upgrade.
- FIG. 4 is a flow chart showing a method for upgrading a network connection service according to still another aspect of the present application. As shown in FIG. 4, the method includes:
- Step S401 When the first process performs network monitoring, start the second process and start network monitoring of the second process.
- the network monitoring of the second process is started.
- the network monitoring of both the first process and the second process occurs, and the newly established network connection occurs.
- Any one of the first process or the second process is randomly assigned to ensure that the network service is not interrupted.
- the listening port needs to be set to REUSE_PORT mode to allow the first process and the second process to listen to the same port at the same time.
- Step S402 shutting down network monitoring of the first process.
- the first process is closed to ensure that the newly established network connection is assigned to the second process.
- Step S403 the first process queries the network connection according to a preset condition.
- the preset condition includes: querying a network connection that does not have an unprocessed network request or a network response; or querying a data flow network connection having a resumed resume state.
- the Request (Request) and Response (Response) methods are used for communication.
- the network connection can be switched from the first process to the second process.
- the service will not be interrupted.
- querying a data stream network connection with a resume status of a breakpoint for example, for a TCP connection of a video stream, the video stream is generally sent as a block data, that is, the data is sent by using one piece of content, when the complete piece of data is sent,
- the network connection of the video stream can be switched from the first process to the second process, and the network service is not interrupted.
- Step S404 closing the read/write event of the network connection obtained by the first process query.
- the read and write event of the first process is closed, and the read and write event that is closed should be a read/write event of the network connection obtained by querying according to the preset condition, thereby cutting off the network connection of the second process.
- Step S405 the first process serializes the session data.
- session data is serialized for network transmission.
- Step S406 the first process sends the file descriptor and the serialized session data to the second process by inter-process data communication.
- establishment of inter-process data communication between the first process and the second process is established through the Socket domain socket, so that the first process successfully sends the file descriptor and the session data to the second process.
- Step S407 the second process deserializes the received session data into a corresponding object.
- the received session data (Session) is processed into an object structure or a data structure that can be easily recognized.
- Step S408 the second process performs network transmission and reception by using the received file descriptor.
- control network transceiver module transmits and receives the network connection data switched to the second process. At this point, the network connection of the first process is successfully switched to the second process.
- Step S409 closing the file descriptor of the network connection of the first process and releasing the resource.
- the file descriptor of the first process is closed and resources are released to close the network connection of the first process. Repeat the above steps of switching and closing the network connection until all network connections of the first process are switched to the second process, thereby ensuring that the network service is not interrupted during the upgrade.
- the present application can be implemented in software and/or a combination of software and hardware, for example, using an application specific integrated circuit (ASIC), a general purpose computer, or any other similar hardware device.
- the software program of the present application can be executed by a processor to implement the steps or functions described above.
- the software programs (including related data structures) of the present application can be stored in a computer readable recording medium such as a RAM memory, a magnetic or optical drive or a floppy disk and the like.
- some of the steps or functions of the present application may be implemented in hardware, for example, as a circuit that cooperates with a processor to perform various steps or functions.
- a portion of the present application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide a method and/or technical solution in accordance with the present application.
- the program instructions for invoking the method of the present application may be stored in a fixed or removable recording medium, and/or transmitted by a data stream in a broadcast or other signal bearing medium, and/or stored in a The working memory of the computer device in which the program instructions are run.
- an embodiment in accordance with the present application includes a device including a memory for storing computer program instructions and a processor for executing program instructions, wherein when the computer program instructions are executed by the processor, triggering
- the apparatus operates based on the aforementioned methods and/or technical solutions in accordance with various embodiments of the present application.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本申请的目的是提供一种基于网络连接服务的升级方法和装置,所述方法包括:在第一进程进行网络连接时,启动第二进程;所述第一进程根据预设条件查询所述网络连接;所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接。与现有技术相比,本申请在第一进程进行网络传输时,启动已经完成升级的第二进程,第一进程根据预设条件将合适的网络连接切换至第二进程,直至第一进程的全部网络连接都切换至第二进程,从而保证不会因为升级而中断网络连接,对于用户而言,不会因为网络升级而受到影响。
Description
本申请要求2015年05月15日递交的申请号为201510246567.1、发明名称为“一种基于网络连接服务的升级方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及计算机领域,尤其涉及一种基于网络连接服务的升级方法和装置。
程序升级是系统运维过程中经常需要进行的操作。现有技术在程序升级时,通常将服务请求路由到其他服务节点上,或者,直接中断进程并快速进行重启。然而不论何种方式,都会导致网络连接中断的问题,用户请求可能会有瞬间的错误失败。现有技术提供了一种升级方案,通过动态库切换实现升级时不停止程序服务。然而其缺点是开发难度高,对代码实现细节要求高,需要做到逻辑的完全隔离以及内存管理的隔离,而且对于网络管理模块的升级,仍然需要进行重启,影响用户体验。
发明内容
本申请的一个目的是,提供一种基于网络连接服务的升级方法和装置。
根据本申请的一方面,提供了一种基于网络连接服务的升级方法,包括:
在第一进程进行网络连接时,启动第二进程;
所述第一进程根据预设条件查询所述网络连接;
所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;
所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接。
根据本申请的另一方面,还提供了一种基于网络连接服务的升级装置,包括:
第一模块,用于在第一进程进行网络连接时,启动第二进程;
第二模块,用于所述第一进程根据预设条件查询所述网络连接;
第三模块,用于所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;
第四模块,用于所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接。
与现有技术相比,本申请在第一进程进行网络传输时,启动已经完成升级的第二进程,第一进程根据预设条件将合适的网络连接切换至第二进程,直至第一进程的全部网络连接都切换至第二进程,从而保证不会因为升级而中断网络连接,对于用户而言,不会因为网络升级而受到影响。
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:
图1示出根据本申请一个方面的基于网络连接服务的升级装置的结构示意图;
图2示出根据本申请又一个方面的基于网络连接服务的升级装置的结构示意图;
图3示出根据本申请一个方面的基于网络连接服务的升级方法的流程示意图;
图4示出根据本申请又一个方面的基于网络连接服务的升级方法的流程示意图。
附图中相同或相似的附图标记代表相同或相似的部件。
下面结合附图对本申请作进一步详细描述。
图1示出根据本申请一个方面的基于网络连接服务的升级装置的结构示意图。如图1所示,该升级装置1包括:第一模块11、第二模块12、第三模块13和第四模块14。
其中,第一模块11用于在第一进程进行网络连接时,启动第二进程;第二模块12用于所述第一进程根据预设条件查询所述网络连接;第三模块13用于所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;第四模块14用于所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接。
在此,第一进程为旧进程,第二进程为升级完成后的新进程,网络连接可以采用TCP(Transmission Control Protocol,传输控制协议)网络连接。预设条件需保证待切换网络连接的数据流不具有上下文的依赖关系。文件描述符可以采用FD(File Descriptor)数据,会话数据可以采用Session数据。在第二进程升级完成后,第一模块11启动第二进程;第二模块12根据预设条件查询第一进程的网络连接;第三模块13将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;第四模块14根据第二进程接收到的文
件描述符和会话数据继续进行第一进程切换来的网络连接。由此保证在将网络连接从第一进程切换至第二进程时,不会发生网络服务中断。
图2示出根据本申请又一个方面的基于网络连接服务的升级装置的结构示意图。如图2所示,该升级装置1包括:第一模块11、第二模块12、第三模块13和第四模块14。
其中,第一模块11用于在第一进程进行网络连接时,启动第二进程;第二模块12用于所述第一进程根据预设条件查询所述网络连接;第三模块13用于所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;第四模块14用于所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接。
在此,第一进程为旧进程,第二进程为升级完成后的新进程,网络连接可以采用TCP网络连接。预设条件需保证待切换网络连接的数据流不具有上下文的依赖关系。文件描述符可以采用FD数据,会话数据可以采用Session数据,Session数据包括用户授权状态、业务处理定义变量等信息,每个Session数据管理一个TCP网络连接。在第二进程升级完成后,第一模块11启动第二进程;第二模块12根据预设条件查询第一进程的网络连接;第三模块13将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;第四模块14根据第二进程接收到的文件描述符和会话数据继续进行第一进程切换来的网络连接。由此保证在将网络连接从第一进程切换至第二进程时,不会发生网络服务中断。
具体地,所述第一模块11包括:第一一子模块111和第一二子模块112。
其中,第一一子模块111用于在所述第一进程进行网络监听时,启动所述第二进程并且启动所述第二进程的网络监听;第一二子模块112用于关闭所述第一进程的网络监听。
在此,第一一子模块111启动第二进程的网络监听,在第二进程的网络监听的启动过程中,会出现第一进程和第二进程的都在进行网络监听的情况,此时,新建立的网络连接会被随机分配至第一进程或第二进程的任意之一,以保证网络服务不会被中断。当第二进程启动完毕后,第一二子模块112关闭第一进程以保证新建立的网络连接都被分配至第二进程。对于TCP连接,监听的端口需要设置为REUSE_PORT模式,以便允许第一进程和第二进程同时监听同一端口。
具体地,所述预设条件包括:所述网络连接的数据流不具有相互依赖关系。所述第二模块还用于:查询没有未处理完成的网络请求或网络响应的网络连接;或者,查询具有断点续传状态的数据流网络连接。
例如,对于RPC(Remote Procedure Call Protocol,远程过程调用协议),采用Request(请求)和Response(响应)方式进行通信,当TCP链路上没有尚未处理完成的Request或者Response时,可以将网络连接由第一进程切换至第二进程,此时网络服务不会被中断。对于数据流网络连接,例如视频流的TCP通信,视频流一般为块数据发送,即对数据采用一块一块内容进行发送,当完整的发送完一块数据时,可以将视频流的网络连接由第一进程切换至第二进程,此时网络服务不会被中断。
可选地,该升级装置1还包括:第五模块15。
其中,第五模块15用于关闭所述第一进程查询得到的网络连接的读写事件。
在此,第五模块15关闭第一进程的读写事件,被关闭的读写事件应为根据预设条件查询得到的网络连接的读写事件,从而切断第二进程的网络连接。
具体地,所述第三模块13还用于:所述第一进程通过进程间数据通信将所述文件描述符和所述会话数据发送至所述第二进程。
在此,第三模块13通过Socket域套接字在第一进程和第二进程之间建立进程间数据通信,以便于第一进程将文件描述符和会话数据成功发送至所述第二进程。
具体地,所述第三模块13还用于所述第一进程对所述会话数据进行序列化;所述第一进程将所述序列化得到的所述会话数据发送至所述第二进程。
在此,第三模块13将会话数据进行序列化,便于网络传输。
具体地,所述第四模块14包括:第四一子模块141和第四二子模块142。该升级装置1还包括:第六模块16。
其中,第四一子模块141用于所述第二进程将接收的会话数据反序列化成为相应对象;第四二子模块142用于所述第二进程通过接收的文件描述符进行网络收发。第六模块16关闭所述第一进程的网络连接的文件描述符并且释放资源。
在此,第四一子模块141将接收到的会话数据(Session)进行反序列化,处理成为可方便识别的对象结构体或者数据结构。第四二子模块142根据第一进程发送来的文件描述符,控制网络收发模块对被切换至第二进程的网络连接数据进行收发。此时第一进程的网络连接成功被切换至第二进程。成功切换后,第六模块16关闭第一进程的文件描述符并且释放资源以关闭第一进程的网络连接。重复以上切换以及关闭网络连接的步骤,直至将第一进程的全部网络连接切换至第二进程,从而保证在升级时网络服务不被中断。
图3示出根据本申请一个方面的基于网络连接服务的升级方法的流程示意图。如图3所示,所述升级方法包括:
步骤S301,在第一进程进行网络连接时,启动第二进程;
步骤S302,所述第一进程根据预设条件查询所述网络连接;
步骤S303,所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;
步骤S304,所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接。
在此,第一进程为旧进程,第二进程为升级完成后的新进程,网络连接可以采用TCP网络连接。预设条件需保证待切换网络连接的数据流不具有上下文的依赖关系。文件描述符可以采用FD数据,会话数据可以采用Session数据,Session数据包括用户授权状态、业务处理定义变量等信息,每个Session数据管理一个TCP网络连接。在第二进程升级完成后,启动第二进程;根据预设条件查询第一进程的网络连接;将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;根据第二进程接收到的文件描述符和会话数据继续进行第一进程切换来的网络连接。由此保证在将网络连接从第一进程切换至第二进程时,不会发生网络服务中断。
具体地,步骤S301,所述在第一进程进行网络连接时,启动第二进程包括:
步骤S3011,在所述第一进程进行网络监听时,启动所述第二进程并且启动所述第二进程的网络监听;
步骤S3012,关闭所述第一进程的网络监听。
在此,启动第二进程的网络监听,在第二进程的网络监听的启动过程中,会出现第一进程和第二进程的都在进行网络监听的情况,此时,新建立的网络连接会被随机分配至第一进程或第二进程的任意之一,以保证网络服务不会被中断。当第二进程启动完毕后,关闭第一进程以保证新建立的网络连接都被分配至第二进程。对于TCP连接,监听的端口需要设置为REUSE_PORT模式,以便允许第一进程和第二进程同时监听同一端口。
具体地,所述预设条件包括:所述网络连接的数据流不具有相互依赖关系。所述第一进程根据预设条件查询所述网络连接包括:查询没有未处理完成的网络请求或网络响应的网络连接;或者,查询具有断点续传状态的数据流网络连接。
例如,对于RPC通信,采用Request(请求)和Response(响应)方式进行通信,当TCP链路上没有尚未处理完成的Request或者Response时,可以将网络连接由第一进程切换至第二进程,此时网络服务不会被中断。对于数据流网络连接,例如视频流的TCP
连接,视频流一般为块数据发送,即对数据采用一块一块内容进行发送,当完整的发送完一块数据时,可以将视频流的网络连接由第一进程切换至第二进程,此时网络服务不会被中断。
可选地,所述升级方法还包括:
步骤S305,关闭所述第一进程查询得到的网络连接的读写事件。
在此,关闭第一进程的读写事件,被关闭的读写事件应为根据预设条件查询得到的网络连接的读写事件,从而切断第二进程的网络连接。
具体地,步骤S303,所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程包括:
所述第一进程通过进程间数据通信将所述文件描述符和所述会话数据发送至所述第二进程。
在此,建立通过Socket域套接字在第一进程和第二进程之间建立进程间数据通信,以便于第一进程将文件描述符和会话数据成功发送至所述第二进程。
具体地,所述升级方法还包括:
步骤S306,所述第一进程对所述会话数据进行序列化;
步骤S307,所述第一进程将所述序列化得到的所述会话数据发送至所述第二进程。
在此,将会话数据进行序列化,便于网络传输。
具体地,步骤S304,所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接包括:
步骤S3041,所述第二进程将接收的会话数据反序列化成为相应对象;
步骤S3042,所述第二进程通过接收的文件描述符进行网络收发;
步骤S3043,关闭所述第一进程的网络连接的文件描述符并且释放资源。
在此,将接收到的会话数据(Session)处理成为可方便识别的对象结构体或者数据结构。根据第一进程发送来的文件描述符,控制网络收发模块对被切换至第二进程的网络连接数据进行收发。此时第一进程的网络连接成功被切换至第二进程。成功切换后,关闭第一进程的文件描述符并且释放资源以关闭第一进程的网络连接。重复以上切换以及关闭网络连接的步骤,直至将第一进程的全部网络连接切换至第二进程,从而保证在升级时网络服务不被中断。
图4示出根据本申请又一个方面的基于网络连接服务的升级方法的流程示意图。如图4所示,所述方法包括:
步骤S401,在所述第一进程进行网络监听时,启动所述第二进程并且启动所述第二进程的网络监听;
在此,启动第二进程的网络监听,在第二进程的网络监听的启动过程中,会出现第一进程和第二进程的都在进行网络监听的情况,此时,新建立的网络连接会被随机分配至第一进程或第二进程的任意之一,以保证网络服务不会被中断。对于TCP连接,监听的端口需要设置为REUSE_PORT模式,以便允许第一进程和第二进程同时监听同一端口。
步骤S402,关闭所述第一进程的网络监听。
在此,当第二进程启动完毕后,关闭第一进程以保证新建立的网络连接都被分配至第二进程。
步骤S403,所述第一进程根据预设条件查询所述网络连接.
在此,所述预设条件包括:查询没有未处理完成的网络请求或网络响应的网络连接;或者,查询具有断点续传状态的数据流网络连接。
例如,查询没有尚未处理完成的网络请求或网络响应的网络连接。对于RPC通信,采用Request(请求)和Response(响应)方式进行通信,当TCP链路上没有尚未处理完成的Request或者Response时,可以将网络连接由第一进程切换至第二进程,此时网络服务不会被中断。或者,查询具有断点续传状态的数据流网络连接,例如对于视频流的TCP连接,视频流一般为块数据发送,即对数据采用一块一块内容进行发送,当完整的发送完一块数据时,可以将视频流的网络连接由第一进程切换至第二进程,此时网络服务不会被中断。
步骤S404,关闭所述第一进程查询得到的网络连接的读写事件。
在此,关闭第一进程的读写事件,被关闭的读写事件应为根据预设条件查询得到的网络连接的读写事件,从而切断第二进程的网络连接。
步骤S405,所述第一进程对所述会话数据进行序列化。
在此,将会话数据进行序列化,便于网络传输。
步骤S406,所述第一进程通过进程间数据通信将所述文件描述符和序列化得到的所述会话数据发送至所述第二进程。
在此,建立通过Socket域套接字在第一进程和第二进程之间建立进程间数据通信,以便于第一进程将文件描述符和会话数据成功发送至所述第二进程。
步骤S407,所述第二进程将接收的会话数据反序列化成为相应对象。
在此,将接收到的会话数据(Session)处理成为可方便识别的对象结构体或者数据结构。
步骤S408,所述第二进程通过接收的文件描述符进行网络收发。
在此,根据第一进程发送来的文件描述符,控制网络收发模块对被切换至第二进程的网络连接数据进行收发。此时第一进程的网络连接成功被切换至第二进程。
步骤S409,关闭所述第一进程的网络连接的文件描述符并且释放资源。
在此,成功切换后,关闭第一进程的文件描述符并且释放资源以关闭第一进程的网络连接。重复以上切换以及关闭网络连接的步骤,直至将第一进程的全部网络连接切换至第二进程,从而保证在升级时网络服务不被中断。
需要注意的是,本申请可在软件和/或软件与硬件的组合体中被实施,例如,可采用专用集成电路(ASIC)、通用目的计算机或任何其他类似硬件设备来实现。在一个实施例中,本申请的软件程序可以通过处理器执行以实现上文所述步骤或功能。同样地,本申请的软件程序(包括相关的数据结构)可以被存储到计算机可读记录介质中,例如,RAM存储器,磁或光驱动器或软磁盘及类似设备。另外,本申请的一些步骤或功能可采用硬件来实现,例如,作为与处理器配合从而执行各个步骤或功能的电路。
另外,本申请的一部分可被应用为计算机程序产品,例如计算机程序指令,当其被计算机执行时,通过该计算机的操作,可以调用或提供根据本申请的方法和/或技术方案。而调用本申请的方法的程序指令,可能被存储在固定的或可移动的记录介质中,和/或通过广播或其他信号承载媒体中的数据流而被传输,和/或被存储在根据所述程序指令运行的计算机设备的工作存储器中。在此,根据本申请的一个实施例包括一个装置,该装置包括用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被该处理器执行时,触发该装置运行基于前述根据本申请的多个实施例的方法和/或技术方案。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。装置权利
要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。
Claims (16)
- 一种基于网络连接服务的升级方法,其中,所述方法包括:在第一进程进行网络连接时,启动第二进程;所述第一进程根据预设条件查询所述网络连接;所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接。
- 根据权利要求1所述的方法,其中,所述在第一进程进行网络连接时,启动第二进程包括:在所述第一进程进行网络监听时,启动所述第二进程并且启动所述第二进程的网络监听;关闭所述第一进程的网络监听。
- 根据权利要求1或2所述的方法,其中,所述预设条件包括:所述网络连接的数据流不具有相互依赖关系。
- 根据权利要求3所述的方法,其中,所述第一进程根据预设条件查询所述网络连接包括:查询没有未处理完成的网络请求或网络响应的网络连接;或者,查询具有断点续传状态的数据流网络连接。
- 根据权利要求1至4中任一项所述的方法,其中,所述方法还包括:关闭所述第一进程查询得到的网络连接的读写事件。
- 根据权利要求1至5中任一项所述的方法,其中,所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程包括:所述第一进程通过进程间数据通信将所述文件描述符和所述会话数据发送至所述第二进程。
- 根据权利要求6所述的方法,其中,所述方法还包括:所述第一进程对所述会话数据进行序列化;所述第一进程将所述序列化得到的所述会话数据发送至所述第二进程。
- 根据权利要求7所述的方法,其中,所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接包括:所述第二进程将接收的会话数据反序列化成为相应对象;所述第二进程通过接收的文件描述符进行网络收发;关闭所述第一进程的网络连接的文件描述符并且释放资源。
- 一种基于网络连接服务的升级装置,其中,所述装置包括:第一模块,用于在第一进程进行网络连接时,启动第二进程;第二模块,用于所述第一进程根据预设条件查询所述网络连接;第三模块,用于所述第一进程将查询得到的网络连接的文件描述符和会话数据发送至所述第二进程;第四模块,用于所述第二进程根据接收到的所述文件描述符和所述会话数据继续进行所述网络连接。
- 根据权利要求9所述的装置,其中,所述第一模块包括:第一一子模块,用于在所述第一进程进行网络监听时,启动所述第二进程并且启动所述第二进程的网络监听;第一二子模块,用于关闭所述第一进程的网络监听。
- 根据权利要求9或10所述的装置,其中,所述预设条件包括:所述网络连接的数据流不具有相互依赖关系。
- 根据权利要求11所述的装置,其中,所述第二模块还用于:查询没有未处理完成的网络请求或网络响应的网络连接;或者,查询具有断点续传状态的数据流网络连接。
- 根据权利要求9至12中任一项所述的装置,其中,所述装置还包括:第五模块,用于关闭所述第一进程查询得到的网络连接的读写事件。
- 根据权利要求9至13中任一项所述的装置,其中,所述第三模块还用于:所述第一进程通过进程间数据通信将所述文件描述符和所述会话数据发送至所述第二进程。
- 根据权利要求9至14中任一项所述的装置,其中,所述第三模块还用于:所述第一进程对所述会话数据进行序列化;所述第一进程将所述序列化得到的所述会话数据发送至所述第二进程。
- 根据权利要求14所述的装置,其中,所述第四模块包括:第四一子模块,用于所述第二进程将接收的会话数据反序列化成为相应对象;第四二子模块,用于所述第二进程通过接收的文件描述符进行网络收发;所述装置还包括:第六模块,用于关闭所述第一进程的网络连接的文件描述符并且释放资源。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510246567.1A CN106301820B (zh) | 2015-05-15 | 2015-05-15 | 一种基于网络连接服务的升级方法和装置 |
| CN201510246567.1 | 2015-05-15 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2016184315A1 true WO2016184315A1 (zh) | 2016-11-24 |
Family
ID=57319478
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2016/081215 Ceased WO2016184315A1 (zh) | 2015-05-15 | 2016-05-06 | 一种基于网络连接服务的升级方法和装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN106301820B (zh) |
| WO (1) | WO2016184315A1 (zh) |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107896163B (zh) * | 2017-11-10 | 2020-11-24 | 中国银行股份有限公司 | 一种网银系统的升级方法、装置及网银服务系统 |
| CN111897666B (zh) * | 2020-08-05 | 2024-02-06 | 北京图森未来科技有限公司 | 用于多进程之间通信的方法、设备及系统 |
| CN112596771B (zh) * | 2020-12-01 | 2024-10-29 | 北京明朝万达科技股份有限公司 | 一种不间断服务升级的方法及系统 |
| CN114915669A (zh) * | 2021-02-08 | 2022-08-16 | 北京金山云网络技术有限公司 | 一种基于quic协议的服务升级方法、装置及电子设备 |
| CN115048178A (zh) * | 2021-02-26 | 2022-09-13 | 阿里巴巴集团控股有限公司 | 报文发送和接收方法、装置、电子设备、介质及程序产品 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101102219A (zh) * | 2007-07-30 | 2008-01-09 | 华为技术有限公司 | 软件升级系统以及软件升级方法 |
| US20150039732A1 (en) * | 2013-07-31 | 2015-02-05 | Sap Ag | Mobile application framework extensibiilty |
| CN104461628A (zh) * | 2014-12-09 | 2015-03-25 | 珠海迈科智能科技股份有限公司 | 一种控制服务器程序更新的方法和装置 |
| CN105100232A (zh) * | 2015-07-14 | 2015-11-25 | 焦点科技股份有限公司 | 一种不中断服务的服务端程序平滑升级的方法 |
Family Cites Families (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8146073B2 (en) * | 2004-09-30 | 2012-03-27 | Microsoft Corporation | Updating software while it is running |
| CN100451965C (zh) * | 2005-12-07 | 2009-01-14 | 英业达股份有限公司 | 动态升级程序的方法 |
| CN101673205B (zh) * | 2009-09-28 | 2012-07-04 | 杭州华三通信技术有限公司 | 接口板升级方法及系统 |
| CN102299940A (zh) * | 2010-06-25 | 2011-12-28 | 龚华清 | 一种不间断网络服务的软件升级方法 |
| US8595715B2 (en) * | 2010-12-31 | 2013-11-26 | International Business Machines Corporation | Dynamic software version selection |
| EP2744166B1 (en) * | 2011-09-19 | 2019-04-03 | Huawei Technologies Co., Ltd. | Method for migrating a user link, method for migrating a user service, apparatuses and system |
| CN103533064A (zh) * | 2013-10-21 | 2014-01-22 | 济南政和科技有限公司 | 不间断网络用户在线状态的服务器程序升级方法 |
-
2015
- 2015-05-15 CN CN201510246567.1A patent/CN106301820B/zh active Active
-
2016
- 2016-05-06 WO PCT/CN2016/081215 patent/WO2016184315A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101102219A (zh) * | 2007-07-30 | 2008-01-09 | 华为技术有限公司 | 软件升级系统以及软件升级方法 |
| US20150039732A1 (en) * | 2013-07-31 | 2015-02-05 | Sap Ag | Mobile application framework extensibiilty |
| CN104461628A (zh) * | 2014-12-09 | 2015-03-25 | 珠海迈科智能科技股份有限公司 | 一种控制服务器程序更新的方法和装置 |
| CN105100232A (zh) * | 2015-07-14 | 2015-11-25 | 焦点科技股份有限公司 | 一种不中断服务的服务端程序平滑升级的方法 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106301820B (zh) | 2020-03-10 |
| CN106301820A (zh) | 2017-01-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2016184315A1 (zh) | 一种基于网络连接服务的升级方法和装置 | |
| CN104346559B (zh) | 权限请求响应方法及相应的装置 | |
| KR20060051932A (ko) | 소프트웨어를 실행 동안 업데이트하는 시스템, 방법 및컴퓨터-판독가능 매체 | |
| WO2016177260A1 (zh) | 利博伟特软件热升级方法及设备 | |
| CN107682460B (zh) | 一种分布式存储集群数据通信方法及系统 | |
| WO2014183556A1 (zh) | 应用程序的处理方法和装置 | |
| WO2015078341A1 (zh) | 应用程序远程更新的方法和装置 | |
| WO2016041322A1 (zh) | 移动智能终端下转发应用内流量的方法 | |
| US9363157B2 (en) | Remotely controlling devices and processing asynchronous events for testing | |
| WO2019227836A1 (zh) | 一种基于bmc的文件传输方法、装置、设备及介质 | |
| US11403093B1 (en) | Application modification with proxy service process | |
| CN111209265B (zh) | 一种数据库切换方法和终端设备 | |
| CN111615819B (zh) | 一种传输数据的方法和装置 | |
| TWI668634B (zh) | 基於軟體容器提供雲端服務之系統及方法 | |
| WO2018036255A1 (zh) | 一种恢复网络设备的出厂配置的方法、装置及网络设备 | |
| WO2012041239A1 (zh) | 一种输入工具调用的系统、方法及一种代理设备 | |
| WO2018184594A1 (zh) | 远程控制设备的方法及远程控制系统 | |
| US6892321B2 (en) | Transition to switch node adapter diagnostics using adapter device driver | |
| US20090259634A1 (en) | Recording Apparatus, File Descriptor Generation Method, and Program | |
| CN115878136A (zh) | 一种基于裸金属服务器的部署方法、装置及系统 | |
| CN114201549A (zh) | 切换方法、系统、服务器及存储介质 | |
| WO2026036597A1 (zh) | 数据通道的处理方法、装置、通信设备、存储介质和计算机程序产品 | |
| US20260044336A1 (en) | Gateway and gateway hot upgrade method and system | |
| KR20050112912A (ko) | 소켓 어플리케이션 프로그램을 이용한 데이터 중계 시스템및 데이터 중계 방법 | |
| US9608914B2 (en) | Information processing apparatus and information processing method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16795802 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 16795802 Country of ref document: EP Kind code of ref document: A1 |