WO2020233206A1 - Method and device for processing code execution request - Google Patents

Method and device for processing code execution request Download PDF

Info

Publication number
WO2020233206A1
WO2020233206A1 PCT/CN2020/079558 CN2020079558W WO2020233206A1 WO 2020233206 A1 WO2020233206 A1 WO 2020233206A1 CN 2020079558 W CN2020079558 W CN 2020079558W WO 2020233206 A1 WO2020233206 A1 WO 2020233206A1
Authority
WO
WIPO (PCT)
Prior art keywords
session
code execution
execution request
rules
engine service
Prior art date
Application number
PCT/CN2020/079558
Other languages
French (fr)
Chinese (zh)
Inventor
尹强
刘有
王和平
黄山
杨峙岳
邸帅
卢道和
Original Assignee
深圳前海微众银行股份有限公司
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 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2020233206A1 publication Critical patent/WO2020233206A1/en

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/50Network services
    • H04L67/56Provisioning of proxy services

Definitions

  • This application relates to the technical field of Fintech, and in particular to a method and device for processing code execution requests.
  • the traditional financial industry is gradually transforming to the financial technology (Fintech) field.
  • the financial industry (such as banking, insurance, and securities) generally involves scripting on big data platforms.
  • the script job of the big data platform is generally that the user sends code fragments to the engine server through the client, and the code is executed by the session on the engine server.
  • the existing method of processing code execution requests is roughly as follows: a user submits a code execution request on the client, the forwarding service submits the code execution request to the session specified by the code execution request, and then the specified session executes the code submitted by the user.
  • This application provides a method and device for processing code execution requests, which are used to simplify user operations when processing code execution requests.
  • a method for processing code execution requests is provided, which is applied to an intermediate proxy server, and the intermediate proxy server is in communication connection with the client and engine services in the engine server, and the method includes:
  • the conversations used to execute the code execution request are filtered out; wherein, the total conversation list includes the corresponding user in the engine service All conversations of, N is a positive integer;
  • the intermediate proxy server can screen a suitable session for the code execution request through preset N rules, and submit the code execution request to the session, compared to the current one.
  • the user selects the way of specifying the session.
  • the user does not need to pay attention to the number of sessions in the engine service, and there is no need for the user to specify the session, thereby simplifying the user's operation and improving the user experience.
  • the intermediate proxy server can filter out corresponding sessions from multiple sessions according to N rules, so that the intermediate proxy server has higher flexibility in selecting sessions.
  • the filtering out the session for executing the code execution request from the total session list corresponding to the user according to preset N rules includes: corresponding to the user The total conversation list of is passed through K rules in order to filter out the conversations used to execute the code execution request; wherein, the K rules are the first K of the N rules arranged from high to low according to the preset priority Rule, K is a positive integer less than or equal to N.
  • the N rules are first sorted according to the preset priority, and then when the intermediate proxy server screens the sessions according to the N rules, the first K rules with higher priority are used to filter out the first K rules that satisfy the first K rules.
  • the only session for executing the code execution request on the one hand, it ensures that the corresponding session can be screened out every time, and on the other hand, it can also ensure that the screened out session can meet the higher priority rules, thus guaranteeing to a certain extent The reliability of the conversation.
  • the N rules include one or more of health state rules, concurrency rules, load rules, designated session rules, blacklist session rules, and priority session rules; among them, all
  • the health status rule refers to the selection of sessions whose health status is normal
  • the concurrency rule refers to the selection of sessions whose current concurrency number is less than the maximum concurrency number
  • the load rule refers to the selection of a load that is higher than the expected load within a preset first time period.
  • the maximum duration of the load is lower than the preset second duration of the session
  • the first duration is greater than the second duration
  • the specified session rule refers to selecting the session specified in the code execution request
  • the blacklist session rule refers to the selection of sessions other than the sessions in the preset blacklist.
  • the priority session rule refers to arranging multiple sessions in order of preset priority from high to low, and selecting the session with the highest priority .
  • the N rules there may be multiple possibilities for the N rules. If the N rules are different, the screened sessions will be different accordingly. In this way, the flexibility of the intermediate proxy server for selecting sessions can be further improved.
  • the code execution request is encapsulated as a task, and the task identification code ID is assigned to the task, and the task ID is stored in the relationship
  • the session information corresponding to the session for executing the code execution request is combined with the task ID
  • the corresponding relationship is updated to the relational database, and the session used to execute the code execution request is obtained from the engine service according to the session information corresponding to the session used to execute the code execution request to execute the task And then feed back the status information to the client.
  • the intermediate proxy server allocates a session for each code execution request
  • the corresponding relationship between the session and the task ID that the session needs to be executed can be stored in a relational database. This is not only convenient for the intermediate proxy server to determine in time
  • the task volume of each session also facilitates the intermediate proxy server to follow up the execution progress of each task in time; and, after the intermediate proxy server follows up the execution progress of each task, it feeds back the status information to the client in time, so that the user can obtain the code in time
  • the progress of the operation further enhances the user experience.
  • the method before filtering out the session for executing the code execution request from the total session list corresponding to the user according to the preset N rules, further includes: receiving at least one engine The registration information sent by each engine service in the service; wherein the registration information includes the resource locator URL, service type, and service metadata information of each engine service; further, according to the registration information, the Each engine service sends a first heartbeat; according to the information fed back by each engine service for the first heartbeat, a session list corresponding to each engine service is obtained.
  • the intermediate proxy server will receive the registration information sent by each engine service in advance, and after obtaining the registration information of each engine service, obtain the session list corresponding to each engine service from each engine service, so as to facilitate the management of the intermediate proxy server Sessions under each engine service.
  • the method before filtering out the session for executing the code execution request from the total session list corresponding to the user according to preset N rules, the method further includes: A session list corresponding to each engine service, send a second heartbeat to each session in the session list corresponding to each engine service, and send a second heartbeat to each session in the session list corresponding to each engine service.
  • the heartbeat feedback information determines the health status of each session in the session list corresponding to each engine service.
  • the health status of each session can be determined in time, which facilitates subsequent screening of the sessions whose health status is normal for code execution requests.
  • the intermediate proxy server manages each session, which can also reduce the burden on the engine server.
  • a device for processing code execution requests includes:
  • the receiving module is configured to receive a code execution request sent by the client, where the code execution request includes the code requested to be executed by the user;
  • the session screening module is configured to screen out the sessions used to execute the code execution request from the total session list corresponding to the user according to preset N rules; wherein, the total session list includes the user's current For all the corresponding sessions in the engine service, N is a positive integer;
  • the sending module is configured to send the code requested to be executed by the user to the session for executing the code execution request.
  • the session screening module is specifically configured to: sequentially pass the total session list corresponding to the user through K rules to filter out the sessions used to execute the code execution request; wherein, the K The rules are the first K rules arranged from high to low among the N rules according to the preset priority, and K is a positive integer less than or equal to N.
  • the N rules include one or more of health state rules, concurrency rules, load rules, designated session rules, blacklist session rules, and priority session rules; among them, all
  • the health status rule refers to the selection of sessions whose health status is normal
  • the concurrency rule refers to the selection of sessions whose current concurrency number is less than the maximum concurrency number
  • the load rule refers to the selection of a load that is higher than the expected load within a preset first time period.
  • the specified session rule refers to selecting the session specified in the code execution request
  • the blacklist session rule refers to the selection of sessions other than the sessions in the preset blacklist
  • the priority session rule refers to arranging multiple sessions in order of preset priority from high to low, and selecting the one with the highest priority Conversation.
  • the device further includes a session management module; the receiving module is further configured to encapsulate the code execution request into a task after receiving the code execution request of the client, and perform the The task assignment task identification code ID is stored in a relational database; correspondingly, the session management module is configured to send the code requested by the user to be executed by the sending module to the user After the session for executing the code execution request is executed, the correspondence between the session information corresponding to the session for executing the code execution request and the task ID is updated to the relational database, and the code execution is executed according to the The session information corresponding to the requested session is used to obtain the status information of the task performed by the session used to execute the code execution request from the engine service; the sending module is also used to feed back the status information to the Client.
  • the receiving module is further configured to encapsulate the code execution request into a task after receiving the code execution request of the client, and perform the The task assignment task identification code ID is stored in a relational database
  • the session management module is configured to send the code requested by the user
  • the device further includes a session registration module; the receiving module filters out the total session list corresponding to the user according to the preset N rules for executing the Before the session of the code execution request, it is also used to receive registration information sent by each engine service in at least one engine service; wherein the registration information includes the resource locator URL, service type, and service metadata of each engine service
  • the sending module is also used to send a first heartbeat to each engine service according to the registration information
  • the session registration module is used to send a first heartbeat to the first engine service according to the each engine service Obtain the session list corresponding to each engine service based on the information fed back by the heartbeat.
  • the device further includes a session health status determination module; the sending module is further configured to filter out from the total session list corresponding to the user according to preset N rules Before the session used to execute the code execution request, according to the session list corresponding to each engine service, send a second heartbeat to each session in the session list corresponding to each engine service; accordingly, the The session health status determination module is configured to determine each session in the session list corresponding to each engine service according to the information fed back to the second heartbeat for each session in the session list corresponding to each engine service Health status.
  • a computing device including:
  • At least one processor and
  • a memory connected in communication with the at least one processor
  • the memory stores instructions that can be executed by the at least one processor, and the at least one processor implements any one of the first aspect and any possible implementation manner by executing the instructions stored in the memory The method described.
  • a computer-readable storage medium stores computer instructions.
  • the computer instructions run on a computer, the computer executes the first aspect and any possible design The method of any one of.
  • FIG. 1 is a schematic diagram of an applicable system architecture provided by an embodiment of the application
  • FIG. 2 is a schematic diagram of a brief process of processing a code execution request provided by an embodiment of the application
  • FIG. 3 is a schematic diagram of an interaction flow corresponding to a method for processing code execution requests provided by an embodiment of the application;
  • FIG. 4 is a schematic structural diagram of an apparatus for processing code execution requests provided by an embodiment of the application.
  • FIG. 5 is a schematic structural diagram of a computing device provided by an embodiment of this application.
  • the financial industry (such as banking, insurance, and securities) generally involves scripting on big data platforms.
  • the script job of the big data platform is generally that the user sends code fragments to the engine server through the client, and the code is executed by the session on the engine server.
  • user operations are extremely cumbersome, and it is difficult to meet the actual business needs of banks and other financial industries.
  • an embodiment of the present application proposes a method for processing code execution requests.
  • FIG. 1 is a schematic diagram of an applicable system architecture provided by an embodiment of the application.
  • the system architecture includes a client 11, an intermediate proxy server 12, and an engine server 13.
  • the client 11 communicates with the engine server 13 through the intermediate proxy server 12.
  • the intermediate proxy server 12 may be a single server or a server cluster
  • the engine server 13 may be a single server or a server cluster, which is not limited.
  • the type of engine service is equivalent to the type of engine server, and the engine services corresponding to a type of engine server all belong to the same type.
  • FIG. 2 is a schematic diagram of a brief process of processing a code execution request provided by an embodiment of the application.
  • multiple engine services ie multiple engine servers, such as Spark engine server 131 and Python engine server 132
  • each engine service corresponds to multiple sessions.
  • One session can be understood as A lightweight application, a session can run code alone.
  • the engine server 13 includes the Spark engine server 131 and the Python engine server 132 as an example, but in fact, the type of the engine server 13 is not limited, and the type of engine service is also not limited.
  • the user sends a code execution request through the client 11.
  • the client 11 After the client 11 receives the code execution request, it sends the code execution request to the intermediate proxy server 12.
  • the intermediate proxy server 12 screens out the corresponding sessions for the code execution request, and then The code execution request is sent to the corresponding session in the engine server, and the corresponding code of the user is executed by the corresponding session.
  • FIG. 3 is a schematic diagram of an interaction flow corresponding to a method for processing code execution requests provided by an embodiment of the application.
  • the intermediate proxy server 12 receives a code execution request from the client 11, and the code execution request includes the code requested to be executed by the user.
  • the user can submit a code execution request through the client 11, the client 11 sends the code execution request to the intermediate proxy server 12, and the intermediate proxy server 12 receives the code sent by the client 11. Code execution request.
  • the intermediate proxy server 12 includes multiple intermediate proxy services. In order to avoid excessive load of a certain proxy service, the intermediate proxy server 12 allocates code execution requests of different users to different users in a polling manner. Each intermediate agent service is processed to try to ensure the load balance of each intermediate agent service.
  • the code execution request includes the code requested by the user to execute.
  • the code execution request may also include the engine service type.
  • the engine service type refers to the engine service type designated by the user to execute the code execution request. For example, the user specifies that the code execution request is sent to the Python engine service for execution.
  • the code execution request may also include a session identification code (identification, ID) specified by the user.
  • the client may send the code execution request to the intermediate proxy server 12 in a Representational State Transfer (REST) manner.
  • REST Representational State Transfer
  • Step 302 Encapsulate the code execution request as a task, assign a task ID to the task, and store the task ID in a relational database.
  • the intermediate proxy server 12 encapsulates each code execution request, and then performs a processing for each code execution request.
  • the code execution request assigns the corresponding task ID.
  • the task ID of each task and the state information corresponding to the task may be stored in a relational database.
  • the status information of the task includes one or more of the execution progress of the task, the running intermediate parameters of the code, and the final result of the task processing. For example, the current task has not been executed yet, then the execution progress of the task can be identified as pending.
  • the relational database may be a database in the intermediate proxy server 12 or a database that exists separately in other servers.
  • the relational database is a database that exists separately in other servers, the relational database and the intermediate proxy server 12 can communicate with each other.
  • the intermediate proxy server 12 receives three code execution requests sent by three users, and can encapsulate the three code execution requests into corresponding tasks, assign corresponding IDs, and store them in a relational database.
  • the contents of the relational database are shown in Table 1 below.
  • step 303 the intermediate proxy server 12 receives registration information from the engine service in the engine server 13.
  • a new engine service needs to access the intermediate proxy server 12, it can send registration information to the intermediate proxy server 12. After the intermediate proxy server 12 receives the registration information, it indicates that The new engine service has been successfully registered.
  • the registration information includes the resource locator (Uniform Resource Locator, URL), service type and service metadata information of the engine service.
  • Service metadata information can be understood as some fixed parameters of the engine service, for example, which types of code can be run in the session in the engine service, and which users have the authority to use the engine service, etc.
  • Step 304 After receiving the registration information, the intermediate proxy server 12 sends the first heartbeat to the engine service.
  • the intermediate proxy service 12 may send a first heartbeat to the engine service according to the registration information, and the first heartbeat is used to confirm whether the engine service is running normally.
  • Step 305 The intermediate proxy server 12 receives the information for the first heartbeat feedback sent by the engine service.
  • the engine service after receiving the first heartbeat, the engine service sends information for the first heartbeat feedback to the intermediate proxy server 12, and the information for the first heartbeat feedback includes session information corresponding to at least all sessions included in the engine service.
  • the session information includes the session ID of each session, and the session information may also include the maximum concurrent number of each session.
  • Step 306 The intermediate proxy server 12 obtains a session list corresponding to the engine service according to the information fed back for the first heartbeat.
  • the intermediate proxy server 12 After the intermediate proxy server 12 receives the information for the first heartbeat feedback, it can obtain the session list of the engine service.
  • the session list includes session IDs of all sessions included in the engine service.
  • the session list can also include the maximum number of concurrent sessions.
  • step 303 to step 306 provides a way to obtain the session list of each engine service.
  • Step 303 to step 306 are executed after step 302 as an example in FIG. 3, but in fact, step 303 to step 306 can also be executed before step 301 or before step 302.
  • the intermediate proxy server 12 can obtain the total session list corresponding to the user.
  • the user's total conversation list can be understood as the conversations in all engine services for which the user has usage rights.
  • the user's total conversation list generally includes multiple conversations.
  • the service metadata information includes which users have the authority to use the engine service.
  • the intermediate proxy server 12 obtains the session list of each engine service, it It is possible to determine whether the user has the permission to use the corresponding session in the engine service according to the service metadata information of the engine service, and then determine the total session list corresponding to the user.
  • the intermediate proxy server 12 may store the session list in a relational database.
  • the intermediate proxy server 12 stores the session list of the Spark engine service and the session list of the Python engine service in a relational database.
  • the contents of the relational database are shown in Table 2 below.
  • Step 307 The intermediate proxy server 12 sends a second heartbeat to the sessions in the session list served by each engine.
  • the intermediate proxy server 12 sends the second heartbeat to each session in the session list.
  • the intermediate proxy server 12 may periodically send the second heartbeat to the sessions in the session list corresponding to all engine services.
  • the intermediate proxy server 12 may also send a second heartbeat to the sessions in the session list corresponding to all engine services after receiving the code execution request.
  • the second heartbeat is used to confirm the health status of the session, and the health status can be understood as whether the session can run normally.
  • Each session has a certain life cycle. Some sessions may be stopped due to the expiration of the life cycle, or they may be stopped artificially, or they may exit abnormally due to a memory overflow, etc., resulting in abnormal health status of some sessions.
  • the intermediate proxy server 12 receives the information fed back by the engine service for the second heartbeat, and determines the health status of each session according to the information.
  • each session can feed back information to the intermediate proxy server 12 in a timely manner, and the intermediate proxy server 12 receives the second heartbeat of the session within a preset period of time.
  • the heartbeat feedback information determines that the health status of the session is normal. If the session is abnormal, it may not be able to feed back to the intermediate proxy server 12 in time.
  • the intermediate proxy server 12 does not receive the second heartbeat feedback information of the session within the preset time period, and then determines that the health status of the session is abnormal, so that the intermediate proxy server 12 The server 12 can obtain the health status of each session.
  • the health status of each session may also be updated to the relational database.
  • the intermediate proxy server 12 determines that session 1 is abnormal, and session 2, session 3, and session 4 are normal, it can update the current health status of each session to the relational database in time in.
  • the intermediate proxy server 12 can determine the health status of each session in time, so as to facilitate the screening of corresponding sessions for subsequent code execution requests.
  • step 309 the intermediate proxy server 12 filters out the sessions used to execute the code execution request from the total session list according to the N rules.
  • the intermediate proxy server 12 selects one session from the total session list according to N rules for execution. Code execution request.
  • the intermediate proxy server 12 passes the total conversation list corresponding to the user through K rules in turn, and filters out the conversations used to execute the code execution request.
  • the K rules are the top K of the N rules arranged from high to low according to the preset priority.
  • a rule, K is a positive integer less than or equal to N.
  • the intermediate proxy server 12 can arrange N rules in order from high to low according to the preset priority. If the total conversation list is filtered by the first K rules, there is only one session that meets the first K rules. Then the session is the session used to execute the code execution request, and the session can no longer be screened by the following (NK) rules.
  • NK following
  • the preset priority order of the N rules may be set by the user.
  • the priority order of the N rules corresponding to different users may be different.
  • the user can carry the preset priority order of N rules in the code execution request.
  • the preset priority order of the N rules may also be set by the intermediate proxy server 12 by default.
  • the intermediate proxy server 12 filters out the sessions meeting the N rules from the total session list as the sessions for executing the code execution request.
  • the intermediate proxy server 12 may The notification engine service creates a new session for the code execution request, and uses the newly created session as the session for executing the current code execution request.
  • the selected session strictly meets the N rules, so as to ensure the quality of the session and improve the reliability of the code execution request in the later stage of the session.
  • multiple sessions satisfying N or K rules may be screened out.
  • the intermediate proxy server 12 may select multiple sessions satisfying N or K rules. Any one of the sessions is selected to execute the code execution request, or the session with the highest priority can be selected from multiple sessions satisfying N or K rules to execute the code execution request.
  • the highest priority refers to the priority of the session The highest in the order.
  • the priority order of the sessions may be set by the intermediate proxy server 12 by default, or the intermediate proxy server 12 may be determined according to the average length of code execution of each session, for example, according to the execution of each task in each session within the set time period in the past.
  • the average duration is determined. Among them, the shorter the average duration of the session execution code, the higher the priority corresponding to the session.
  • the N rules can be understood as a set of preset rules for filtering out conversations from the total conversation list.
  • the N rules include one or more of the following (1) to (8) .
  • the eight rules are briefly described below.
  • the health status rule refers to the selection of sessions whose health status is normal.
  • the intermediate proxy server 12 when the intermediate proxy server 12 filters the sessions that meet the health state rules from the total session list, it needs to determine the health status of each session in the total session list. As discussed above in step 307 to step 308, the intermediate proxy server 12 can obtain the latest health status of each session through a relational database to determine the health status of each session.
  • the selection of the session whose health status is normal is compared with the way in which the user specifies the session in the prior art, which not only simplifies the user's operation, but also ensures that the session used to execute the code execution request is normal , To ensure the reliability of the subsequent session.
  • Concurrency rules refer to the selection of sessions whose current concurrent number is less than the maximum concurrent number.
  • the intermediate proxy server 12 filters the sessions meeting the concurrency rule from the total session list, it needs to determine the current number of concurrent sessions for each session.
  • the intermediate proxy server 12 may send confirmation information to each session in real time.
  • the confirmation information is used to confirm the current number of concurrent sessions of each session.
  • the feedback information of each session determines the current concurrent number of each session.
  • the intermediate proxy server 12 stores the session and the number of tasks corresponding to the session in the relational database after allocating the session for each code execution request. In this way, when the current concurrency number of each session needs to be determined, the intermediate proxy server 12 may first obtain the number of tasks corresponding to each session according to the relational database, and after obtaining the number of tasks corresponding to the session, the current number of concurrent sessions can be obtained. Generally speaking, if a session only processes one task, the number of concurrent sessions for that session is one.
  • the intermediate proxy server 12 can determine whether the current concurrency number of each session is less than the maximum concurrency number according to the maximum concurrency number of each session in the session list.
  • the session by selecting the session whose current concurrent number is less than the maximum concurrent number, it can be ensured that after the code execution request is sent to the session, the session can respond to the code execution request in a timely manner, thereby improving the timeliness of processing the code execution request , To enhance the user experience.
  • the load rule refers to the selection of sessions in which the maximum duration in which the load amount is higher than the preset load amount in the preset first duration is lower than the preset second duration, and the first duration is greater than the second duration.
  • the intermediate proxy server 12 When the intermediate proxy server 12 filters the sessions that meet the load rule from the total session list, it needs to determine the load of each session in the first time period, and the load can be characterized by the number of tasks. As discussed in step 302 above, after the intermediate proxy server 12 allocates sessions for each code execution request, the session and the number of tasks corresponding to the session are stored in the relational database. After each session completes the corresponding task, it can also report completion. Information to the intermediate proxy server 12. In this way, the intermediate proxy server 12 can also update the task quantity of each session in the relational database in a timely manner based on the feedback completion information.
  • the intermediate proxy server 12 can obtain the load of each session in real time according to the relational database, and then determine that the load in the first preset time period is higher than the preset load.
  • the maximum duration of If the maximum duration is less than the second duration, it means that the load of the session can process the corresponding task in time, and the code execution request can be allocated to the session at this time. If the maximum duration is greater than the second duration, it means that the load of the session remains high. At this time, you can refuse to assign the code execution request to the task, thereby avoiding the user's code caused by assigning the code execution request to the task. Issue of extension when executing request.
  • Specifying the session rule refers to selecting the session specified in the code execution request.
  • the session specified in the code execution request can be one or multiple.
  • Blacklist session rules refer to the selection of sessions other than those in the preset blacklist.
  • the sessions in the blacklist preset in the blacklist session rule can be carried in the code execution request by the user. Among them, the corresponding sessions in the blacklist corresponding to each user may be different or the same.
  • the priority conversation rule refers to arranging multiple conversations in the order of preset priority from high to low, and selecting the conversation with the highest priority. Among them, the way to set the preset priority of the session can refer to the content discussed above, and will not be repeated here.
  • priority session rules can be used to select the session with the highest priority from the multiple sessions to ensure that a session with higher reliability is selected for the user.
  • the engine service type rule refers to the selection of the session that matches the code type requested by the user.
  • the intermediate proxy server 12 can assign a matching engine service to the code execution request according to the code execution request without setting engine type rules. If the code execution request does not carry the engine service type, the intermediate proxy server 12 may add an engine service type rule, so as to screen out matching engine service sessions for the code execution request based on the engine service type rule.
  • the custom rule refers to the selection of the corresponding conversation according to the rule input by the user.
  • the user may carry some filtering rules defined by himself in the code execution request.
  • the intermediate proxy server 12 may determine the filtering rule in the code execution request as a rule for the user to screen the session.
  • the N rules include health status rules, concurrency rules, load rules, designated session rules, blacklist session rules, and priority session rules.
  • the sessions are filtered from the total session list according to the second method.
  • the preset priority of the N rules can be: health state rule>concurrency rule>load rule>specified session rule>blacklist session rule>priority session rule.
  • the intermediate proxy server 12 may first filter out the first session list whose health status is normal according to the health state rule, and then filter out the second session list whose current concurrent number is less than the maximum concurrent number from the first session list according to the concurrency rule. , And then filter from the second session list according to the load rule, and so on, until a session for executing the code execution request is filtered out.
  • step 310 the intermediate proxy server 12 sends the code requested by the user to be executed to the selected session.
  • the intermediate proxy server 12 may send the code requested by the user to be executed to the screened session, and the session executes the code sent by the user.
  • step 311 the intermediate proxy server 12 stores the correspondence between the screened session information and the task ID in a relational database.
  • the intermediate proxy server 12 may store the correspondence between the session information of the session and the task ID of the task in the relational database, and update the data in the relational database in time. It is convenient for the intermediate proxy server 12 to subsequently determine the number of tasks for each session.
  • step 312 the intermediate proxy server 12 obtains task status information from the session.
  • the session may send to the intermediate proxy server 12 the status information of each task performed by the session at a preset time interval, so that the intermediate proxy server 12 can obtain the status information of the task.
  • the intermediate proxy server 12 may also periodically inquire each session to obtain status information of the tasks performed by each session.
  • the status information of the task can refer to the content discussed in step 302 above, which will not be repeated here.
  • step 313 the intermediate proxy server 12 feeds back the status information of the task to the client 11.
  • the intermediate proxy server 12 can feed back the status information of the task to the client 11 in time.
  • the intermediate proxy server 12 may also store the status information of the task in a relational database, and periodically feedback the status information of each task to the client 11.
  • step 302 in FIG. 3 is an optional part
  • step 303-step 306 are optional part
  • step 307-step 308 are optional part
  • step 311-step 313 are optional part.
  • the embodiment of the application implements the above-mentioned method to realize timely processing of code execution requests in the financial industry such as banks. Users do not need to pay attention to information such as the number of sessions in the engine service, and do not need to specify sessions, thereby simplifying user operations , Improve user experience.
  • the intermediate proxy server filters out corresponding sessions from multiple sessions according to N rules, which can also improve the flexibility of session selection.
  • an embodiment of the present application also provides a device for processing code execution requests, which is equivalent to the intermediate proxy server 12 in FIG. 3 above.
  • FIG. 4 is a schematic structural diagram of an apparatus for processing code execution requests provided by an embodiment of the application. As shown in FIG. 4, the apparatus includes:
  • the receiving module 401 is used to receive a code execution request sent by the client 11, the code execution request includes the code requested to be executed by the user; the content of the code execution request can refer to the content discussed in step 301 above, and will not be repeated here.
  • the session screening module 402 is used to screen out the sessions used to execute the code execution request from the total session list corresponding to the user according to the preset N rules; wherein, the total session list includes all the sessions corresponding to the user in the engine service , N is a positive integer; the content of the total conversation list and the N rules can refer to the content discussed in step 309 above, which will not be repeated here.
  • the sending module 403 is used to send the code requested by the user to be executed to the session for executing the code execution request.
  • the session screening module 402 is specifically configured to:
  • the total conversation list corresponding to the user is sequentially passed through K rules to filter out the conversations used to execute the code execution request; among them, the K rules are the first K rules arranged from high to low among the N rules according to the preset priority.
  • K is a positive integer less than or equal to N.
  • the N rules include: one or more of health state rules, concurrency rules, load rules, specified session rules, blacklist session rules, and priority session rules;
  • the health status rule refers to the selection of sessions whose health status is normal
  • the concurrency rule refers to the selection of sessions whose current concurrency number is less than the maximum concurrency number
  • the load rule refers to the selection of which load is higher than the preset load in the preset first time period.
  • the maximum duration of the session is lower than the preset second duration.
  • the first duration is greater than the second duration.
  • the specified session rule refers to the session specified in the code execution request
  • the blacklist session rule refers to the selection except the preset blacklist
  • the priority conversation rule refers to arranging multiple conversations in order from high to low according to the preset priority, and selecting the conversation with the highest priority.
  • the device further includes a session management module 404;
  • the receiving module 401 is also used to encapsulate the code execution request as a task after receiving the code execution request from the client, assign the task identification code ID to the task, and store the task ID in the relational database;
  • the session management module 404 is used to update the correspondence between the session information corresponding to the session used to execute the code execution request and the task ID after the sending module 403 sends the code requested to be executed by the user to the session used to execute the code execution request to Relational database, and according to the session information corresponding to the session used to execute the code execution request, obtain the state information of the session execution task used to execute the code execution request from the engine service;
  • the sending module 403 is also used to feed back status information to the client 11.
  • the device further includes a session registration module 405;
  • the receiving module 401 is also used to receive the registration sent by each engine service in at least one engine service before filtering out the session for executing the code execution request from the total session list corresponding to the user according to the preset N rules Information; where the registration information includes the resource locator URL, service type and service metadata information of each engine service;
  • the sending module 403 is also used to send the first heartbeat to each engine service according to the registration information
  • the session registration module 405 is configured to obtain the session list corresponding to each engine service according to the information fed back by each engine service for the first heartbeat.
  • the device further includes a session health status determination module 406;
  • the sending module 403 is also used to filter out the sessions used to execute the code execution request from the total session list corresponding to the user according to preset N rules, and send each engine service the corresponding session list to each Each session in the session list corresponding to the engine service sends a second heartbeat;
  • the session health status determination module 406 is configured to determine the health status of each session in the session list corresponding to each engine service according to the information fed back to the second heartbeat for each session in the session list corresponding to each engine service.
  • an embodiment of the present application also provides a device for processing code execution requests, which is equivalent to the intermediate proxy server 12 discussed above.
  • FIG. 5 is a schematic structural diagram of a computing device provided by an embodiment of the application. As shown in FIG. 5, the device includes:
  • At least one processor 501 and
  • the memory 502 stores instructions that can be executed by at least one processor 501, and the at least one processor 501 implements the method described in FIG. 3 by executing the instructions stored in the memory 502.
  • the session management module 404, the session registration module 405, the session health status determination module 406, and the session screening module 402 in FIG. 4 may be implemented by the processor 501 in FIG.
  • the processor 501 is the control center of the intermediate proxy server 12, which can use various interfaces and lines to connect the various parts of the entire intermediate proxy server 12, by running or executing instructions stored in the memory 502 and calling
  • the data is implemented as a function of filtering sessions for code execution requests and managing sessions.
  • the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor.
  • the application processor mainly processes the operating system, user interface, and application programs.
  • the adjustment processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 501.
  • the processor 501 and the memory 502 may be implemented on the same chip, or may be implemented on separate chips.
  • the processor 501 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, Implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application.
  • the general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
  • the memory 502 can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules.
  • the memory 502 may include at least one type of storage medium, for example, may include flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM) ), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, magnetic disk, optical disk, etc.
  • the memory 502 is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
  • the memory 502 in the embodiment of the application may also be a circuit or any other device capable of realizing a storage function for storing program instructions and/or data.
  • an embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores computer instructions, when the computer instructions are on the computer When running, the computer is made to execute the method described in Figure 3.
  • the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

Abstract

The present application relates to the field of financial technology (fintech), and provides a method and a device for processing a code execution request, used to address the problem in the art of laborious user operations during code processing. The method comprises: receiving a code execution request sent by a client end, the code execution request comprising code requested by the user for execution; selecting, according to N pre-determined rules, a session from a total session list corresponding to the user for executing the code execution request, wherein the total session list comprises all corresponding sessions of the user in an engine service, and N is a positive integer; and sending the code requested by the user for execution to the session used to execute the code execution request. The invention selects, by means of the N pre-determined rules, a suitable session for a code execution request, and submits the code execution request to said session, such that users do not need to be concerned with information such as the number of sessions in an engine service, and do not need to specify a session, thereby simplifying user operations.

Description

一种处理代码执行请求的方法及装置Method and device for processing code execution request
相关申请的交叉引用Cross references to related applications
本申请要求在2019年05月20日提交中国专利局、申请号为201910419110.4、申请名称为“一种处理代码执行请求的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on May 20, 2019, the application number is 201910419110.4, and the application name is "a method and device for processing code execution requests", the entire contents of which are incorporated by reference In this application.
技术领域Technical field
本申请涉及金融科技(Fintech)技术领域,尤其涉及一种处理代码执行请求的方法及装置。This application relates to the technical field of Fintech, and in particular to a method and device for processing code execution requests.
背景技术Background technique
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融行业正在逐步向金融科技(Fintech)领域转变,但由于金融行业的安全性、实时性要求,也对技术提出了更高的要求。金融行业(比如银行、保险、证券)一般都会涉及到大数据平台脚本作业。大数据平台脚本作业一般是用户通过客户端将代码片段发送给引擎服务器,由引擎服务器上的会话来执行代码。With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to the financial technology (Fintech) field. However, due to the security and real-time requirements of the financial industry, more technology is also proposed. High demands. The financial industry (such as banking, insurance, and securities) generally involves scripting on big data platforms. The script job of the big data platform is generally that the user sends code fragments to the engine server through the client, and the code is executed by the session on the engine server.
现有的处理代码执行请求的方式大致为:用户在客户端上提交代码执行请求,由转发服务将代码执行请求提交到代码执行请求指定的会话中,进而由指定的会话执行用户提交的代码。The existing method of processing code execution requests is roughly as follows: a user submits a code execution request on the client, the forwarding service submits the code execution request to the session specified by the code execution request, and then the specified session executes the code submitted by the user.
但是在这种处理代码执行请求的方式中,用户需要先登录各种引擎服务器账号,获得自己在各种引擎服务中对应的会话,再根据需要代码执行请求确定选择哪种引擎服务,进而确定将该代码执行请求提交给该引擎服务中的哪一个会话,最后通过客户端将该代码执行请求提交给引擎服务,而引擎服务在接收代码执行请求之后,将该代码执行请求发送给用户代码执行请求中所指定的会话。可见,现有的处理代码执行请求的方式存在用户操作极为繁琐的技术问题。However, in this way of processing code execution requests, users need to log in to various engine server accounts to obtain their corresponding sessions in various engine services, and then determine which engine service to choose according to the required code execution request, and then determine the Which session in the engine service the code execution request is submitted to, and finally the code execution request is submitted to the engine service through the client, and the engine service sends the code execution request to the user code execution request after receiving the code execution request The session specified in. It can be seen that the existing method of processing code execution requests has a technical problem that user operations are extremely cumbersome.
发明内容Summary of the invention
本申请提供一种处理代码执行请求的方法及装置,用于在处理代码执行请求时简化用户的操作。This application provides a method and device for processing code execution requests, which are used to simplify user operations when processing code execution requests.
第一方面,提供一种处理代码执行请求的方法,应用于中间代理服务器中,所述中间代理服务器与客户端和引擎服务器中的引擎服务均通信连接, 所述方法包括:In a first aspect, a method for processing code execution requests is provided, which is applied to an intermediate proxy server, and the intermediate proxy server is in communication connection with the client and engine services in the engine server, and the method includes:
接收所述客户端发送的代码执行请求,所述代码执行请求包括用户请求执行的代码;Receiving a code execution request sent by the client, where the code execution request includes the code requested to be executed by the user;
根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话;其中,所述总会话列表包括所述用户在所述引擎服务中对应的所有会话,N为正整数;According to the preset N rules, from the total conversation list corresponding to the user, the conversations used to execute the code execution request are filtered out; wherein, the total conversation list includes the corresponding user in the engine service All conversations of, N is a positive integer;
将所述用户请求执行的代码发送给所述用于执行代码执行请求的会话。Send the code requested to be executed by the user to the session for executing the code execution request.
在本申请中,中间代理服务器在接收到代码执行请求之后,可以通过预设的N个规则为该代码执行请求筛选一个合适的会话,并将该代码执行请求提交给该会话,相较于现有技术由用户选择指定会话的方式来说,本申请实施例中无需用户关注引擎服务中的会话个数,也无需用户去指定会话,从而能够简化用户的操作,提升用户体验。且,本申请中,中间代理服务器能够根据N个规则从多个会话中筛选出相应会话,从而中间代理服务器选择会话的灵活性更高。In this application, after receiving the code execution request, the intermediate proxy server can screen a suitable session for the code execution request through preset N rules, and submit the code execution request to the session, compared to the current one. According to the technology, the user selects the way of specifying the session. In the embodiment of the present application, the user does not need to pay attention to the number of sessions in the engine service, and there is no need for the user to specify the session, thereby simplifying the user's operation and improving the user experience. Moreover, in this application, the intermediate proxy server can filter out corresponding sessions from multiple sessions according to N rules, so that the intermediate proxy server has higher flexibility in selecting sessions.
在一种可能的实现方式中,所述根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话,包括:将所述用户对应的总会话列表依次通过K个规则,筛选出用于执行所述代码执行请求的会话;其中,所述K个规则为N个规则中按照预设优先级从高到低排列后的前K个规则,K为小于或等于N的正整数。In a possible implementation manner, the filtering out the session for executing the code execution request from the total session list corresponding to the user according to preset N rules includes: corresponding to the user The total conversation list of is passed through K rules in order to filter out the conversations used to execute the code execution request; wherein, the K rules are the first K of the N rules arranged from high to low according to the preset priority Rule, K is a positive integer less than or equal to N.
在上述实现方式中,先将N个规则按照预设优先级进行排序,然后在中间代理服务器根据N个规则筛选会话时,使用优先级较高的前K个规则筛选出满足该前K个规则的唯一会话,作为执行代码执行请求的会话,一方面确保每一次都能够筛选出对应的会话,另一方面还可以保证筛选出的会话能够满足优先级较高的规则,从而在一定程度上保证了会话的可靠性。In the above implementation, the N rules are first sorted according to the preset priority, and then when the intermediate proxy server screens the sessions according to the N rules, the first K rules with higher priority are used to filter out the first K rules that satisfy the first K rules. As the only session for executing the code execution request, on the one hand, it ensures that the corresponding session can be screened out every time, and on the other hand, it can also ensure that the screened out session can meet the higher priority rules, thus guaranteeing to a certain extent The reliability of the conversation.
在一种可能的实现方式中,所述N个规则包括:健康状态规则、并发规则、负载规则、指定会话规则、黑名单会话规则和优先级会话规则中的一种或几种;其中,所述健康状态规则是指选取健康状态为正常的会话,所述并发规则是指选取当前并发数小于最大并发数的会话,所述负载规则是指选取在预设第一时长内负载量高于预设负载量的最大持续时长低于预设第二时长的会话,所述第一时长大于所述第二时长,所述指定会话规则是指选取所述代码执行请求中所指定的会话,所述黑名单会话规则是指选取除了预设的黑名单中会话之外的会话,所述优先级会话规则是指将多个会话按照预设优先级从高到低顺序排列,选取优先级最高的会话。In a possible implementation manner, the N rules include one or more of health state rules, concurrency rules, load rules, designated session rules, blacklist session rules, and priority session rules; among them, all The health status rule refers to the selection of sessions whose health status is normal, the concurrency rule refers to the selection of sessions whose current concurrency number is less than the maximum concurrency number, and the load rule refers to the selection of a load that is higher than the expected load within a preset first time period. It is assumed that the maximum duration of the load is lower than the preset second duration of the session, the first duration is greater than the second duration, and the specified session rule refers to selecting the session specified in the code execution request, the The blacklist session rule refers to the selection of sessions other than the sessions in the preset blacklist. The priority session rule refers to arranging multiple sessions in order of preset priority from high to low, and selecting the session with the highest priority .
在上述实现方式中,N个规则具体可以有多种可能,N个规则不同,则筛选出的会话也就相应不同,如此,能够进一步提高中间代理服务器选择会话的灵活性。In the foregoing implementation manner, there may be multiple possibilities for the N rules. If the N rules are different, the screened sessions will be different accordingly. In this way, the flexibility of the intermediate proxy server for selecting sessions can be further improved.
在一种可能的实现方式中,在接收所述客户端的代码执行请求之后,将所述代码执行请求封装为任务,并为所述任务分配任务身份识别码ID,将所述任务ID存储至关系型数据库中;相应地,在将所述用户请求执行的代码发送给所述用于执行代码执行请求的会话之后,将所述用于执行代码执行请求的会 话对应的会话信息与所述任务ID的对应关系更新至所述关系型数据库中,并根据所述用于执行代码执行请求的会话对应的会话信息,从所述引擎服务中获取所述用于执行代码执行请求的会话执行所述任务的状态信息,进而将所述状态信息反馈给所述客户端。In a possible implementation manner, after receiving the code execution request from the client, the code execution request is encapsulated as a task, and the task identification code ID is assigned to the task, and the task ID is stored in the relationship Correspondingly, after the code requested to be executed by the user is sent to the session for executing the code execution request, the session information corresponding to the session for executing the code execution request is combined with the task ID The corresponding relationship is updated to the relational database, and the session used to execute the code execution request is obtained from the engine service according to the session information corresponding to the session used to execute the code execution request to execute the task And then feed back the status information to the client.
在上述实现方式中,中间代理服务器为每个代码执行请求分配会话之后,可以将该会话以及该会话需要执行的任务ID的对应关系存储在关系型数据库中,如此,不仅便于中间代理服务器及时确定各个会话的任务量,还便于中间代理服务器及时跟进各个任务的执行进度;且,在中间代理服务器跟进各个任务的执行进度之后,通过向客户端及时反馈状态信息,使得用户可以及时获得代码运行的进度,进一步提升用户体验。In the above implementation, after the intermediate proxy server allocates a session for each code execution request, the corresponding relationship between the session and the task ID that the session needs to be executed can be stored in a relational database. This is not only convenient for the intermediate proxy server to determine in time The task volume of each session also facilitates the intermediate proxy server to follow up the execution progress of each task in time; and, after the intermediate proxy server follows up the execution progress of each task, it feeds back the status information to the client in time, so that the user can obtain the code in time The progress of the operation further enhances the user experience.
在一种可能的实现方式中,在根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话之前,还包括:接收至少一个引擎服务中每个引擎服务发送的注册信息;其中,所述注册信息包括所述每个引擎服务的资源定位符URL、服务类型以及服务元数据信息;进一步地,根据所述注册信息,向所述每个引擎服务发送第一心跳;根据所述每个引擎服务针对所述第一心跳反馈的信息,获取所述每个引擎服务对应的会话列表。In a possible implementation manner, before filtering out the session for executing the code execution request from the total session list corresponding to the user according to the preset N rules, the method further includes: receiving at least one engine The registration information sent by each engine service in the service; wherein the registration information includes the resource locator URL, service type, and service metadata information of each engine service; further, according to the registration information, the Each engine service sends a first heartbeat; according to the information fed back by each engine service for the first heartbeat, a session list corresponding to each engine service is obtained.
在上述实现方式中,中间代理服务器会提前接收各个引擎服务发送的注册信息,在获取各个引擎服务的注册信息之后,从各个引擎服务中获取各个引擎服务对应的会话列表,以便于中间代理服务器管理各个引擎服务下的会话。In the above implementation, the intermediate proxy server will receive the registration information sent by each engine service in advance, and after obtaining the registration information of each engine service, obtain the session list corresponding to each engine service from each engine service, so as to facilitate the management of the intermediate proxy server Sessions under each engine service.
在一种可能的实现方式中,在根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话之前,还包括:根据所述每个引擎服务对应的会话列表,向所述每个引擎服务对应的会话列表中的每个会话发送第二心跳,根据所述每个引擎服务对应的会话列表中的每个会话针对所述第二心跳反馈的信息,确定所述每个引擎服务对应的会话列表中的每个会话的健康状态。In a possible implementation manner, before filtering out the session for executing the code execution request from the total session list corresponding to the user according to preset N rules, the method further includes: A session list corresponding to each engine service, send a second heartbeat to each session in the session list corresponding to each engine service, and send a second heartbeat to each session in the session list corresponding to each engine service. The heartbeat feedback information determines the health status of each session in the session list corresponding to each engine service.
在上述实现方式中,通过向各个引擎服务对应的会话列表中的各个会话发送心跳,能够及时确定各个会话的健康状态,便于后续为代码执行请求筛选健康状态为正常的会话。且,由中间代理服务器管理各个会话,还可以相对减少引擎服务器的负担。In the foregoing implementation manner, by sending a heartbeat to each session in the session list corresponding to each engine service, the health status of each session can be determined in time, which facilitates subsequent screening of the sessions whose health status is normal for code execution requests. Moreover, the intermediate proxy server manages each session, which can also reduce the burden on the engine server.
第二方面,提供一种处理代码执行请求的装置,客户端通过所述装置与引擎服务器中的引擎服务通信,所述装置包括:In a second aspect, a device for processing code execution requests is provided. A client communicates with an engine service in an engine server through the device, and the device includes:
接收模块,用于接收客户端发送的代码执行请求,所述代码执行请求包括用户请求执行的代码;The receiving module is configured to receive a code execution request sent by the client, where the code execution request includes the code requested to be executed by the user;
会话筛选模块,用于根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话;其中,所述总会话列表包括所述用户在引擎服务中对应的所有会话,N为正整数;The session screening module is configured to screen out the sessions used to execute the code execution request from the total session list corresponding to the user according to preset N rules; wherein, the total session list includes the user's current For all the corresponding sessions in the engine service, N is a positive integer;
发送模块,用于将所述用户请求执行的代码发送给所述用于执行代码执行请求的会话。The sending module is configured to send the code requested to be executed by the user to the session for executing the code execution request.
在一种可能的实现方式中,会话筛选模块具体用于:将所述用户对应的总会话列表依次通过K个规则,筛选出用于执行所述代码执行请求的会话;其中,所述K个规则为N个规则中按照预设优先级从高到低排列后的前K个规则,K为小于或等于N的正整数。In a possible implementation, the session screening module is specifically configured to: sequentially pass the total session list corresponding to the user through K rules to filter out the sessions used to execute the code execution request; wherein, the K The rules are the first K rules arranged from high to low among the N rules according to the preset priority, and K is a positive integer less than or equal to N.
在一种可能的实现方式中,所述N个规则包括:健康状态规则、并发规则、负载规则、指定会话规则、黑名单会话规则和优先级会话规则中的一种或几种;其中,所述健康状态规则是指选取健康状态为正常的会话,所述并发规则是指选取当前并发数小于最大并发数的会话,所述负载规则是指选取在预设第一时长内负载量高于预设负载量的最大持续时长低于预设第二时长的会话,所述第一时长大于所述第二时长,所述指定会话规则是指选取与所述代码执行请求中所指定的会话,所述黑名单会话规则是指选取除了预设的黑名单中会话之外的会话,所述优先级会话规则是指将多个会话按照预设优先级从高到低顺序排列,选取优先级最高的会话。In a possible implementation manner, the N rules include one or more of health state rules, concurrency rules, load rules, designated session rules, blacklist session rules, and priority session rules; among them, all The health status rule refers to the selection of sessions whose health status is normal, the concurrency rule refers to the selection of sessions whose current concurrency number is less than the maximum concurrency number, and the load rule refers to the selection of a load that is higher than the expected load within a preset first time period. Assuming that the maximum duration of the load is lower than the preset second duration of the session, the first duration is greater than the second duration, and the specified session rule refers to selecting the session specified in the code execution request, so The blacklist session rule refers to the selection of sessions other than the sessions in the preset blacklist, and the priority session rule refers to arranging multiple sessions in order of preset priority from high to low, and selecting the one with the highest priority Conversation.
在一种可能的实现方式中,所述装置还包括会话管理模块;所述接收模块,还用于在接收所述客户端的代码执行请求之后,将所述代码执行请求封装为任务,并为所述任务分配任务身份识别码ID,将所述任务ID存储至关系型数据库中;相应地,所述会话管理模块,用于在所述发送模块将所述用户请求执行的代码发送给所述用于执行代码执行请求的会话之后,将所述用于执行代码执行请求的会话对应的会话信息与所述任务ID的对应关系更新至所述关系型数据库中,以及根据所述用于执行代码执行请求的会话对应的会话信息,从所述引擎服务中获取所述用于执行代码执行请求的会话执行所述任务的状态信息;所述发送模块,还用于将所述状态信息反馈给所述客户端。In a possible implementation manner, the device further includes a session management module; the receiving module is further configured to encapsulate the code execution request into a task after receiving the code execution request of the client, and perform the The task assignment task identification code ID is stored in a relational database; correspondingly, the session management module is configured to send the code requested by the user to be executed by the sending module to the user After the session for executing the code execution request is executed, the correspondence between the session information corresponding to the session for executing the code execution request and the task ID is updated to the relational database, and the code execution is executed according to the The session information corresponding to the requested session is used to obtain the status information of the task performed by the session used to execute the code execution request from the engine service; the sending module is also used to feed back the status information to the Client.
在一种可能的实现方式中,所述装置还包括会话注册模块;所述接收模块,在根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话之前,还用于接收至少一个引擎服务中每个引擎服务发送的注册信息;其中,所述注册信息包括所述每个引擎服务的资源定位符URL、服务类型以及服务元数据信息;相应地,所述发送模块,还用于根据所述注册信息,向所述每个引擎服务发送第一心跳;所述会话注册模块,用于根据所述每个引擎服务针对所述第一心跳反馈的信息,获取所述每个引擎服务对应的会话列表。In a possible implementation manner, the device further includes a session registration module; the receiving module filters out the total session list corresponding to the user according to the preset N rules for executing the Before the session of the code execution request, it is also used to receive registration information sent by each engine service in at least one engine service; wherein the registration information includes the resource locator URL, service type, and service metadata of each engine service Correspondingly, the sending module is also used to send a first heartbeat to each engine service according to the registration information; the session registration module is used to send a first heartbeat to the first engine service according to the each engine service Obtain the session list corresponding to each engine service based on the information fed back by the heartbeat.
在一种可能的实现方式中,所述装置还包括会话健康状态确定模块;所述发送模块,还用于在根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话之前,据所述每个引擎服务对应的会话列表,向所述每个引擎服务对应的会话列表中的每个会话发送第二心跳;相应地,所述会话健康状态确定模块,用于根据所述每个引擎服务对应的会话列表中的每个会话针对所述第二心跳反馈的信息,确定所述每个引擎服务对应的会话列表中的每个会话的健康状态。In a possible implementation manner, the device further includes a session health status determination module; the sending module is further configured to filter out from the total session list corresponding to the user according to preset N rules Before the session used to execute the code execution request, according to the session list corresponding to each engine service, send a second heartbeat to each session in the session list corresponding to each engine service; accordingly, the The session health status determination module is configured to determine each session in the session list corresponding to each engine service according to the information fed back to the second heartbeat for each session in the session list corresponding to each engine service Health status.
第三方面,提供一种计算设备,包括:In a third aspect, a computing device is provided, including:
至少一个处理器,以及At least one processor, and
与所述至少一个处理器通信连接的存储器;A memory connected in communication with the at least one processor;
其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述至少一个处理器通过执行所述存储器存储的指令实现如第一方面及任意一种可能的实现方式中任一项所述的方法。Wherein, the memory stores instructions that can be executed by the at least one processor, and the at least one processor implements any one of the first aspect and any possible implementation manner by executing the instructions stored in the memory The method described.
第四方面,提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如第一方面及任意一种可能的设计中任一项所述的方法。In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores computer instructions. When the computer instructions run on a computer, the computer executes the first aspect and any possible design The method of any one of.
附图说明Description of the drawings
图1为本申请实施例提供的一种适用的系统架构示意图;FIG. 1 is a schematic diagram of an applicable system architecture provided by an embodiment of the application;
图2为本申请实施例提供的处理代码执行请求的简要过程示意图;2 is a schematic diagram of a brief process of processing a code execution request provided by an embodiment of the application;
图3为本申请实施例提供的一种处理代码执行请求的方法对应的交互流程示意图;3 is a schematic diagram of an interaction flow corresponding to a method for processing code execution requests provided by an embodiment of the application;
图4为本申请实施例提供的一种处理代码执行请求的装置的结构示意图;4 is a schematic structural diagram of an apparatus for processing code execution requests provided by an embodiment of the application;
图5为本申请实施例提供的一种计算设备的结构示意图。FIG. 5 is a schematic structural diagram of a computing device provided by an embodiment of this application.
具体实施方式Detailed ways
为了更好的理解本申请实施例提供的技术方案,下面将结合说明书附图以及具体的实施方式进行详细的说明。In order to better understand the technical solutions provided by the embodiments of the present application, a detailed description will be given below in conjunction with the accompanying drawings of the specification and specific implementation manners.
金融行业(比如银行、保险、证券)一般都会涉及到大数据平台脚本作业。大数据平台脚本作业一般是用户通过客户端将代码片段发送给引擎服务器,由引擎服务器上的会话来执行代码。在现有的处理代码执行请求的方式中,用户操作极为繁琐,且很难满足银行等金融行业的实际业务需求。The financial industry (such as banking, insurance, and securities) generally involves scripting on big data platforms. The script job of the big data platform is generally that the user sends code fragments to the engine server through the client, and the code is executed by the session on the engine server. In the existing methods of processing code execution requests, user operations are extremely cumbersome, and it is difficult to meet the actual business needs of banks and other financial industries.
鉴于此,本申请实施例提出一种处理代码执行请求的方法。In view of this, an embodiment of the present application proposes a method for processing code execution requests.
下面对该方法涉及的应用场景进行说明。The application scenarios involved in this method are described below.
图1为本申请实施例提供的一种适用的系统架构示意图,如图1所示,该系统架构中包括客户端11、中间代理服务器12和引擎服务器13。其中,客户端11通过中间代理服务器12与引擎服务器13进行通信。应当说明的是,中间代理服务器12可以是单个服务器,也可以是服务器集群,引擎服务器13可以是单个服务器,也可以是服务器集群,不作限定。FIG. 1 is a schematic diagram of an applicable system architecture provided by an embodiment of the application. As shown in FIG. 1, the system architecture includes a client 11, an intermediate proxy server 12, and an engine server 13. Among them, the client 11 communicates with the engine server 13 through the intermediate proxy server 12. It should be noted that the intermediate proxy server 12 may be a single server or a server cluster, and the engine server 13 may be a single server or a server cluster, which is not limited.
下面基于图1所示意的系统架构,说明该系统架构下各个设备之间的交互过程。需要说明的是,在本申请的下列实施例中,引擎服务的类型等同于引擎服务器的种类,一种引擎服务器对应的引擎服务均属于同一类型。Based on the system architecture shown in Figure 1, the interaction process between the various devices under the system architecture is described below. It should be noted that, in the following embodiments of the present application, the type of engine service is equivalent to the type of engine server, and the engine services corresponding to a type of engine server all belong to the same type.
基于图1所示意的系统架构,图2为本申请实施例提供的处理代码执行请求的简要过程示意图。如图2所示,引擎服务器13中设置有多个引擎服务(即多个引擎服务器,比如Spark引擎服务器131和Python引擎服务器132),每个引擎服务对应有多个会话,一个会话可以理解为一个轻量级应用,一个会话可以单独运行代码。Based on the system architecture shown in FIG. 1, FIG. 2 is a schematic diagram of a brief process of processing a code execution request provided by an embodiment of the application. As shown in Figure 2, multiple engine services (ie multiple engine servers, such as Spark engine server 131 and Python engine server 132) are set in the engine server 13, and each engine service corresponds to multiple sessions. One session can be understood as A lightweight application, a session can run code alone.
需要说明的是,图2中是以引擎服务器13包括Spark引擎服务器131和 Python引擎服务器132两种为例,但是实际上不限制引擎服务器13的种类,同样也不限制引擎服务的类型。It should be noted that, in FIG. 2, the engine server 13 includes the Spark engine server 131 and the Python engine server 132 as an example, but in fact, the type of the engine server 13 is not limited, and the type of engine service is also not limited.
下面请继续参照图1和图2,对该应用场景下各个设备之间的交互过程进行简要说明。Please continue to refer to Figure 1 and Figure 2 below to briefly describe the interaction process between each device in this application scenario.
具体的,用户通过客户端11发送代码执行请求,客户端11接收代码执行请求之后,将该代码执行请求发送给中间代理服务器12,中间代理服务器12为代码执行请求筛选出相应的会话,并将该代码执行请求发送给引擎服务器中对应的会话,由对应的会话执行该用户相应的代码。Specifically, the user sends a code execution request through the client 11. After the client 11 receives the code execution request, it sends the code execution request to the intermediate proxy server 12. The intermediate proxy server 12 screens out the corresponding sessions for the code execution request, and then The code execution request is sent to the corresponding session in the engine server, and the corresponding code of the user is executed by the corresponding session.
基于图1所示意的系统架构,图3为本申请实施例提供的一种处理代码执行请求的方法对应的交互流程示意图。Based on the system architecture shown in FIG. 1, FIG. 3 is a schematic diagram of an interaction flow corresponding to a method for processing code execution requests provided by an embodiment of the application.
步骤301,中间代理服务器12从客户端11接收代码执行请求,代码执行请求包括用户请求执行的代码。In step 301, the intermediate proxy server 12 receives a code execution request from the client 11, and the code execution request includes the code requested to be executed by the user.
具体的,用户想要利用引擎服务器13执行代码时,用户可以通过客户端11提交代码执行请求,客户端11将代码执行请求发送给中间代理服务器12,中间代理服务器12接收该客户端11发送的代码执行请求。Specifically, when a user wants to use the engine server 13 to execute code, the user can submit a code execution request through the client 11, the client 11 sends the code execution request to the intermediate proxy server 12, and the intermediate proxy server 12 receives the code sent by the client 11. Code execution request.
在一种可能的实施方式中,中间代理服务器12中包括多个中间代理服务,为了避免某个代理服务的负载过高,中间代理服务器12以轮询的方式将不同用户的代码执行请求分配给各个中间代理服务处理,以尽量保证各个中间代理服务的负载均衡。In a possible implementation manner, the intermediate proxy server 12 includes multiple intermediate proxy services. In order to avoid excessive load of a certain proxy service, the intermediate proxy server 12 allocates code execution requests of different users to different users in a polling manner. Each intermediate agent service is processed to try to ensure the load balance of each intermediate agent service.
其中,代码执行请求包括用户请求执行的代码。代码执行请求中还可以包括引擎服务类型,引擎服务类型是指用户指定用于执行代码执行请求的引擎服务类型,例如用户指定将该代码执行请求发送给Python引擎服务来执行。代码执行请求中还可以包括用户指定的会话身份识别码(identification,ID)。The code execution request includes the code requested by the user to execute. The code execution request may also include the engine service type. The engine service type refers to the engine service type designated by the user to execute the code execution request. For example, the user specifies that the code execution request is sent to the Python engine service for execution. The code execution request may also include a session identification code (identification, ID) specified by the user.
例如,客户端可以利用表述性状态传递(Representational State Transfer,REST)方式将代码执行请求发送给中间代理服务器12。For example, the client may send the code execution request to the intermediate proxy server 12 in a Representational State Transfer (REST) manner.
步骤302,将代码执行请求封装为任务,并为该任务分配任务ID,将该任务的ID存储在关系型数据库中。Step 302: Encapsulate the code execution request as a task, assign a task ID to the task, and store the task ID in a relational database.
具体的,为了便于后期识别各个用户的代码执行请求,以及每个用户不同的代码执行请求,中间代理服务器12在接收各个代码执行请求之后,对每个代码执行请求进行封装处理,然后为每一个代码执行请求分配相应的任务ID。为了便于中间代理服务器12获取各个任务的任务ID,可以将各个任务的任务ID和该任务对应的状态信息存储在关系型数据库中。任务的状态信息包括任务的执行进度、代码的运行中间参数和任务处理的最终结果中的一种或几种,例如当前任务还未执行,那么该任务的执行进度可以标识为待处理。Specifically, in order to facilitate the later identification of the code execution request of each user and the different code execution request of each user, after receiving each code execution request, the intermediate proxy server 12 encapsulates each code execution request, and then performs a processing for each code execution request. The code execution request assigns the corresponding task ID. In order to facilitate the intermediate proxy server 12 to obtain the task ID of each task, the task ID of each task and the state information corresponding to the task may be stored in a relational database. The status information of the task includes one or more of the execution progress of the task, the running intermediate parameters of the code, and the final result of the task processing. For example, the current task has not been executed yet, then the execution progress of the task can be identified as pending.
其中,关系型数据库可以是中间代理服务器12中的数据库,也可以是单独存在于其他服务器中的数据库。当关系型数据库为单独存在于其他服务器中的数据库时,关系型数据库与中间代理服务器12之间可以相互通信。Among them, the relational database may be a database in the intermediate proxy server 12 or a database that exists separately in other servers. When the relational database is a database that exists separately in other servers, the relational database and the intermediate proxy server 12 can communicate with each other.
例如,中间代理服务器12接收3个用户发送的3个代码执行请求,并可以将3个代码执行请求封装为对应任务,分配相应ID,存储在关系型数据库中。如此,关系型数据库中的内容如下表1所示。For example, the intermediate proxy server 12 receives three code execution requests sent by three users, and can encapsulate the three code execution requests into corresponding tasks, assign corresponding IDs, and store them in a relational database. In this way, the contents of the relational database are shown in Table 1 below.
表1Table 1
任务IDTask ID 任务进度task progress
11 待处理Pending
22 待处理Pending
33 待处理Pending
步骤303,中间代理服务器12从引擎服务器13中的引擎服务上接收注册信息。In step 303, the intermediate proxy server 12 receives registration information from the engine service in the engine server 13.
具体的,引擎服务的类型有多种,每当有新的引擎服务需要接入中间代理服务器12时,可以向中间代理服务器12发送注册信息,中间代理服务器12在接收注册信息之后,就表示该新的引擎服务已经注册成功。Specifically, there are many types of engine services. Whenever a new engine service needs to access the intermediate proxy server 12, it can send registration information to the intermediate proxy server 12. After the intermediate proxy server 12 receives the registration information, it indicates that The new engine service has been successfully registered.
其中,注册信息包括引擎服务的资源定位符(Uniform Resource Locator,URL)、服务类型和服务元数据信息。服务元数据信息可以理解为该引擎服务的一些固定参数,例如该引擎服务中的会话能够运行哪些种类的代码、哪些用户拥有使用该引擎服务的权限等。Among them, the registration information includes the resource locator (Uniform Resource Locator, URL), service type and service metadata information of the engine service. Service metadata information can be understood as some fixed parameters of the engine service, for example, which types of code can be run in the session in the engine service, and which users have the authority to use the engine service, etc.
步骤304,中间代理服务器12接收注册信息之后,向引擎服务发送第一心跳。Step 304: After receiving the registration information, the intermediate proxy server 12 sends the first heartbeat to the engine service.
具体的,在新的引擎服务接入中间代理服务器12之后,中间代理服务12可以根据注册信息,向引擎服务发送第一心跳,第一心跳用于确认该引擎服务是否正常运行。Specifically, after the new engine service accesses the intermediate proxy server 12, the intermediate proxy service 12 may send a first heartbeat to the engine service according to the registration information, and the first heartbeat is used to confirm whether the engine service is running normally.
步骤305,中间代理服务器12接收引擎服务发送的针对第一心跳反馈的信息。Step 305: The intermediate proxy server 12 receives the information for the first heartbeat feedback sent by the engine service.
具体的,引擎服务在收到第一心跳之后,向中间代理服务器12发送针对第一心跳反馈的信息,该针对第一心跳反馈的信息包括该引擎服务至少包括的所有会话对应的会话信息。会话信息包括各个会话的会话ID,会话信息还可以包括各个会话的最大并发数。Specifically, after receiving the first heartbeat, the engine service sends information for the first heartbeat feedback to the intermediate proxy server 12, and the information for the first heartbeat feedback includes session information corresponding to at least all sessions included in the engine service. The session information includes the session ID of each session, and the session information may also include the maximum concurrent number of each session.
步骤306,中间代理服务器12根据针对第一心跳反馈的信息,获得引擎服务对应的会话列表。Step 306: The intermediate proxy server 12 obtains a session list corresponding to the engine service according to the information fed back for the first heartbeat.
中间代理服务器12在接收到针对第一心跳反馈的信息之后,就可以获得引擎服务的会话列表。会话列表包括该引擎服务包括的所有会话的会话ID。会话列表中还可以包括各个会话的最大并发数。After the intermediate proxy server 12 receives the information for the first heartbeat feedback, it can obtain the session list of the engine service. The session list includes session IDs of all sessions included in the engine service. The session list can also include the maximum number of concurrent sessions.
应当说明的是,步骤303-步骤306的实施例提供一种获取每个引擎服务的会话列表的方式。步骤303-步骤306在图3中是以在步骤302之后执行为例,但是实际上步骤303-步骤306还可以在步骤301之前执行,也可以在步骤302之前执行。It should be noted that the embodiment of step 303 to step 306 provides a way to obtain the session list of each engine service. Step 303 to step 306 are executed after step 302 as an example in FIG. 3, but in fact, step 303 to step 306 can also be executed before step 301 or before step 302.
中间代理服务器12在获得每个引擎服务的会话列表之后,就可以获得用户对应的总会话列表。用户的总会话列表可以理解为该用户拥有使用权限的所有引擎服务中的会话。用户的总会话列表中一般包括多个会话。After obtaining the session list of each engine service, the intermediate proxy server 12 can obtain the total session list corresponding to the user. The user's total conversation list can be understood as the conversations in all engine services for which the user has usage rights. The user's total conversation list generally includes multiple conversations.
其中,如前文步骤303论述的内容,每个引擎服务在创建时,服务元数据信息中包括哪些用户具有使用该引擎服务的权限,中间代理服务器12在获 得每个引擎服务的会话列表之后,就可以根据引擎服务的服务元数据信息确定该用户是否拥有使用该引擎服务中对应的会话的权限,进而确定出用户对应的总会话列表。Among them, as discussed in step 303 above, when each engine service is created, the service metadata information includes which users have the authority to use the engine service. After the intermediate proxy server 12 obtains the session list of each engine service, it It is possible to determine whether the user has the permission to use the corresponding session in the engine service according to the service metadata information of the engine service, and then determine the total session list corresponding to the user.
在一种可能的实施方式中,为了方便中间代理服务器12获取各个引擎服务的会话列表,中间代理服务器12可以将该会话列表存储在关系型数据库中。In a possible implementation manner, in order to facilitate the intermediate proxy server 12 to obtain the session list of each engine service, the intermediate proxy server 12 may store the session list in a relational database.
例如,中间代理服务器12获得Spark引擎服务的会话列表和Python引擎服务的会话列表后,将Spark引擎服务的会话列表和Python引擎服务的会话列表存储在关系型数据库中。如此,关系型数据库中的内容如下表2所示。For example, after obtaining the session list of the Spark engine service and the session list of the Python engine service, the intermediate proxy server 12 stores the session list of the Spark engine service and the session list of the Python engine service in a relational database. In this way, the contents of the relational database are shown in Table 2 below.
表2Table 2
Figure PCTCN2020079558-appb-000001
Figure PCTCN2020079558-appb-000001
步骤307,中间代理服务器12向每个引擎服务的会话列表中的会话发送第二心跳。Step 307: The intermediate proxy server 12 sends a second heartbeat to the sessions in the session list served by each engine.
具体的,中间代理服务器12在获得每个引擎服务的会话列表之后,向会话列表中的每个会话发送第二心跳。中间代理服务器12可以向所有引擎服务对应的会话列表中的会话周期性地发送第二心跳。为了减少中间代理服务器12的负担,中间代理服务器12也可以在接收到代码执行请求之后,再向所有引擎服务对应的会话列表中的会话发送第二心跳。Specifically, after obtaining the session list of each engine service, the intermediate proxy server 12 sends the second heartbeat to each session in the session list. The intermediate proxy server 12 may periodically send the second heartbeat to the sessions in the session list corresponding to all engine services. In order to reduce the burden of the intermediate proxy server 12, the intermediate proxy server 12 may also send a second heartbeat to the sessions in the session list corresponding to all engine services after receiving the code execution request.
其中,第二心跳用于确认会话的健康状态,健康状态可以理解为该会话是否能够正常运行。每个会话有一定的生存周期,可能某些会话因生存周期到期而停止、或者被人为停止、或者因为内存溢出异常退出等情况,导致某些会话的健康状态为异常。Among them, the second heartbeat is used to confirm the health status of the session, and the health status can be understood as whether the session can run normally. Each session has a certain life cycle. Some sessions may be stopped due to the expiration of the life cycle, or they may be stopped artificially, or they may exit abnormally due to a memory overflow, etc., resulting in abnormal health status of some sessions.
步骤308,中间代理服务器12接收引擎服务针对第二心跳反馈的信息,并根据该信息,确定每个会话的健康状态。In step 308, the intermediate proxy server 12 receives the information fed back by the engine service for the second heartbeat, and determines the health status of each session according to the information.
具体的,各个会话在接收到第二心跳之后,如果会话处于正常工作状态,各个会话就可以及时地向中间代理服务器12反馈信息,中间代理服务器12在预设时长内接收到会话的针对第二心跳反馈的信息,则确定该会话的健康状态为正常。如果会话异常,则可能无法及时反馈给中间代理服务器12,中间代理服务器12在预设时长内没有接收该会话的针对第二心跳反馈的信息,则确定该会话的健康状态为异常,从而中间代理服务器12可以获得各个会话的健康状态。Specifically, after each session receives the second heartbeat, if the session is in a normal working state, each session can feed back information to the intermediate proxy server 12 in a timely manner, and the intermediate proxy server 12 receives the second heartbeat of the session within a preset period of time. The heartbeat feedback information determines that the health status of the session is normal. If the session is abnormal, it may not be able to feed back to the intermediate proxy server 12 in time. The intermediate proxy server 12 does not receive the second heartbeat feedback information of the session within the preset time period, and then determines that the health status of the session is abnormal, so that the intermediate proxy server 12 The server 12 can obtain the health status of each session.
在一种可能的实施方式中,为了方便中间代理服务器12后期及时获取各个会话的健康状态,还可以将各个会话的健康状态更新至关系型数据库中。In a possible implementation manner, in order to facilitate the intermediate proxy server 12 to obtain the health status of each session in a timely manner, the health status of each session may also be updated to the relational database.
例如,继续以表2所示的会话为例,中间代理服务器12若确定会话1异常,会话2、会话3和会话4正常,则可以将当前获得的各个会话的健康状态及时更新到关系型数据库中。For example, continuing to take the session shown in Table 2 as an example, if the intermediate proxy server 12 determines that session 1 is abnormal, and session 2, session 3, and session 4 are normal, it can update the current health status of each session to the relational database in time in.
在步骤307-步骤308论述的实施例中,中间代理服务器12能够及时确定各个会话的健康状态,方便为后续的代码执行请求筛选相应的会话。In the embodiment discussed in step 307 to step 308, the intermediate proxy server 12 can determine the health status of each session in time, so as to facilitate the screening of corresponding sessions for subsequent code execution requests.
步骤309,中间代理服务器12根据N个规则,从总会话列表中筛选出用于执行代码执行请求的会话。In step 309, the intermediate proxy server 12 filters out the sessions used to execute the code execution request from the total session list according to the N rules.
具体的,用户的总会话列表中可能不止一个会话,因此,中间代理服务器12在接收客户端11发送的代码执行请求之后,根据N个规则,从总会话列表中筛选出一个会话,用来执行代码执行请求。Specifically, there may be more than one session in the user's total session list. Therefore, after receiving the code execution request sent by the client 11, the intermediate proxy server 12 selects one session from the total session list according to N rules for execution. Code execution request.
下面对中间代理服务器12根据N个规则,从总会话列表中筛选出用于执行代码执行请求的会话的方式进行示例说明。In the following, an example will be described for the manner in which the intermediate proxy server 12 filters out the sessions for executing the code execution request from the total session list according to N rules.
方式一:method one:
中间代理服务器12将用户对应的总会话列表依次通过K个规则,筛选出用于执行代码执行请求的会话,K个规则为N个规则中按照预设优先级从高到低排列后的前K个规则,K为小于或等于N的正整数。The intermediate proxy server 12 passes the total conversation list corresponding to the user through K rules in turn, and filters out the conversations used to execute the code execution request. The K rules are the top K of the N rules arranged from high to low according to the preset priority. A rule, K is a positive integer less than or equal to N.
具体的,中间代理服务器12可以根据预设优先级从高到低依次排列N个规则,如果总会话列表在通过前第K个规则进行筛选时,只剩唯一一个满足前K个规则的会话,那么该会话即为用于执行代码执行请求的会话,该会话可以不再经过后面的(N-K)个规则的筛选。Specifically, the intermediate proxy server 12 can arrange N rules in order from high to low according to the preset priority. If the total conversation list is filtered by the first K rules, there is only one session that meets the first K rules. Then the session is the session used to execute the code execution request, and the session can no longer be screened by the following (NK) rules.
其中,N个规则的预设优先级顺序可以是用户设定的,在这种情况下,不同的用户所对应的N个规则的优先级顺序可以不同。比如,用户可以将N个规则的预设优先级顺序携带在代码执行请求中。或者,N个规则的预设优先级顺序也可以是中间代理服务器12默认设置的。The preset priority order of the N rules may be set by the user. In this case, the priority order of the N rules corresponding to different users may be different. For example, the user can carry the preset priority order of N rules in the code execution request. Alternatively, the preset priority order of the N rules may also be set by the intermediate proxy server 12 by default.
本申请实施例中,通过对N个规则进行排序,并将满足优先级较高的前K个规则的一个会话作为用于执行代码执行请求的会话,一方面能确保每一次都可以筛选出对应的会话,另一方面还能保证筛选出的会话满足优先级较高的规则。In the embodiment of this application, by sorting the N rules, and taking a session that meets the first K rules with higher priority as the session for executing the code execution request, it can ensure that the corresponding one can be filtered out every time On the other hand, it can also ensure that the selected sessions meet the higher priority rules.
方式二:Way two:
中间代理服务器12从总会话列表中筛选出满足N个规则的会话作为执行代码执行请求的会话。The intermediate proxy server 12 filters out the sessions meeting the N rules from the total session list as the sessions for executing the code execution request.
具体的,中间代理服务器12若要从会话列表中筛选出同时满足N个规则的会话,可能会出现会话列表中的所有会话均不满足N个规则,在这种情况下,中间代理服务器12可以通知引擎服务为该代码执行请求创建一个新的会话,以该新创建的会话作为执行当前代码执行请求的会话。Specifically, if the intermediate proxy server 12 wants to filter out the sessions that satisfy N rules at the same time from the session list, it may appear that all the sessions in the session list do not meet the N rules. In this case, the intermediate proxy server 12 may The notification engine service creates a new session for the code execution request, and uses the newly created session as the session for executing the current code execution request.
本申请实施例中,筛选出的会话是严格满足N个规则的,以保证该会话的质量,提高会话后期执行代码执行请求的可靠性。In the embodiment of the present application, the selected session strictly meets the N rules, so as to ensure the quality of the session and improve the reliability of the code execution request in the later stage of the session.
在一种可能的实施方式中,在方式二或方式一中均可能会筛选出满足N或K个规则的多个会话,如此,中间代理服务器12可以从满足N或K个规则的多个会话中任意选择一个会话用于执行代码执行请求,也可以从满足N或K个规则的多个会话中选择优先级最高的会话用于执行代码执行请求,优先级最高是指在会话的优先级高低顺序中最高。In a possible implementation manner, in either the second mode or the first mode, multiple sessions satisfying N or K rules may be screened out. In this way, the intermediate proxy server 12 may select multiple sessions satisfying N or K rules. Any one of the sessions is selected to execute the code execution request, or the session with the highest priority can be selected from multiple sessions satisfying N or K rules to execute the code execution request. The highest priority refers to the priority of the session The highest in the order.
其中,会话的优先级高低顺序可以是中间代理服务器12默认设置的,或 者中间代理服务器12按照各个会话执行代码的平均时长决定的,比如,根据过去设定时长内的各个会话执行每个任务的平均时长决定。其中,会话执行代码的平均时长越短,该会话对应的优先级越高。Among them, the priority order of the sessions may be set by the intermediate proxy server 12 by default, or the intermediate proxy server 12 may be determined according to the average length of code execution of each session, for example, according to the execution of each task in each session within the set time period in the past. The average duration is determined. Among them, the shorter the average duration of the session execution code, the higher the priority corresponding to the session.
本申请实施例中,N个规则可以理解为预先设定的用于从总会话列表中筛选出会话的规则的集合,N个规则包括以下(1)至(8)中的一种或几种。下面对该8种规则进行简要说明。In the embodiment of this application, the N rules can be understood as a set of preset rules for filtering out conversations from the total conversation list. The N rules include one or more of the following (1) to (8) . The eight rules are briefly described below.
(1)健康状态规则,是指选取健康状态为正常的会话。(1) The health status rule refers to the selection of sessions whose health status is normal.
具体的,当中间代理服务器12从总会话列表中筛选满足健康状态规则的会话时,需要确定总会话列表中各个会话的健康状态。如前文步骤307-步骤308论述的内容,中间代理服务器12可以通过关系型数据库获取各个会话最新的健康状态,以确定各个会话的健康状态。Specifically, when the intermediate proxy server 12 filters the sessions that meet the health state rules from the total session list, it needs to determine the health status of each session in the total session list. As discussed above in step 307 to step 308, the intermediate proxy server 12 can obtain the latest health status of each session through a relational database to determine the health status of each session.
本申请实施例中,选取健康状态为正常的会话,相较于现有技术中由用户指定会话的方式来说,不仅可以简化用户的操作,还可以保证用于执行代码执行请求的会话是正常的,保证后续该会话的可靠性。In the embodiment of this application, the selection of the session whose health status is normal is compared with the way in which the user specifies the session in the prior art, which not only simplifies the user's operation, but also ensures that the session used to execute the code execution request is normal , To ensure the reliability of the subsequent session.
(2)并发规则,是指选取当前并发数小于最大并发数的会话。(2) Concurrency rules refer to the selection of sessions whose current concurrent number is less than the maximum concurrent number.
当中间代理服务器12从总会话列表中筛选满足并发规则的会话时,需要确定各个会话当前的并发数。When the intermediate proxy server 12 filters the sessions meeting the concurrency rule from the total session list, it needs to determine the current number of concurrent sessions for each session.
示例性地,中间代理服务器12可以实时向各个会话发送确认信息,该确认信息用于确认各个会话的当前并发数,当中间代理服务器12获取到各个会话针对于该确认信息反馈的信息后,根据各个会话反馈的信息确定各个会话的当前并发数。Exemplarily, the intermediate proxy server 12 may send confirmation information to each session in real time. The confirmation information is used to confirm the current number of concurrent sessions of each session. After the intermediate proxy server 12 obtains the feedback information of each session for the confirmation information, The feedback information of each session determines the current concurrent number of each session.
或者,如前文步骤302论述的内容,中间代理服务器12在为各个代码执行请求分配会话之后,将会话以及会话对应的任务数量存储在关系型数据库中。如此,当需要确定各个会话当前的并发数时,中间代理服务器12可以先根据关系型数据库获取各个会话对应的任务数量,在获得会话对应的任务数量之后,就可以获得会话的当前并发数。一般来说,若会话只处理一个任务,则该会话的并发数为一。Or, as discussed in step 302 above, the intermediate proxy server 12 stores the session and the number of tasks corresponding to the session in the relational database after allocating the session for each code execution request. In this way, when the current concurrency number of each session needs to be determined, the intermediate proxy server 12 may first obtain the number of tasks corresponding to each session according to the relational database, and after obtaining the number of tasks corresponding to the session, the current number of concurrent sessions can be obtained. Generally speaking, if a session only processes one task, the number of concurrent sessions for that session is one.
中间代理服务器12在获取各个会话的当前并发数之后,可以根据会话列表中各个会话的最大并发数,确定出各个会话的当前并发数是否小于最大并发数。After obtaining the current concurrency number of each session, the intermediate proxy server 12 can determine whether the current concurrency number of each session is less than the maximum concurrency number according to the maximum concurrency number of each session in the session list.
本申请实施例中,通过选取当前并发数小于最大并发数的会话,可以保证将代码执行请求发送给该会话之后,该会话能够及时响应该代码执行请求,从而能够提高处理代码执行请求的及时性,提升用户的体验。In the embodiment of this application, by selecting the session whose current concurrent number is less than the maximum concurrent number, it can be ensured that after the code execution request is sent to the session, the session can respond to the code execution request in a timely manner, thereby improving the timeliness of processing the code execution request , To enhance the user experience.
(3)负载规则,是指选取在预设第一时长内负载量高于预设负载量的最大持续时长低于预设第二时长的会话,第一时长大于第二时长。(3) The load rule refers to the selection of sessions in which the maximum duration in which the load amount is higher than the preset load amount in the preset first duration is lower than the preset second duration, and the first duration is greater than the second duration.
当中间代理服务器12从总会话列表中筛选满足负载规则的会话时,需要确定各个会话在第一时长内的负载量,负载量可以用任务数量来表征。如前文步骤302论述的内容,中间代理服务器12在为各个代码执行请求分配会话之后,将会话以及会话对应的任务数量存储在关系型数据库中,当各个会话完成相应的任务之后,还可以反馈完成信息给中间代理服务器12。如此,中 间代理服务器12还可以根据该反馈完成信息,及时更新关系型数据库中各个会话的任务数量。当需要确定各个会话在第一时长内的负载量时,中间代理服务器12根据关系型数据库就可以实时获知各个会话的负载量,进而确定在第一预设时长内负载量高于预设负载量的最大持续时长。如果该最大持续时长小于第二时长,则表示该会话的负载能够及时处理相应任务,此时可以将代码执行请求分配给该会话。如果该最大持续时长大于第二时长,则表示该会话的负载持续居高不下,此时可以拒绝将代码执行请求分配给该任务,从而避免将代码执行请求分配给该任务所造成的用户的代码执行请求时延长的问题。When the intermediate proxy server 12 filters the sessions that meet the load rule from the total session list, it needs to determine the load of each session in the first time period, and the load can be characterized by the number of tasks. As discussed in step 302 above, after the intermediate proxy server 12 allocates sessions for each code execution request, the session and the number of tasks corresponding to the session are stored in the relational database. After each session completes the corresponding task, it can also report completion. Information to the intermediate proxy server 12. In this way, the intermediate proxy server 12 can also update the task quantity of each session in the relational database in a timely manner based on the feedback completion information. When it is necessary to determine the load of each session in the first time period, the intermediate proxy server 12 can obtain the load of each session in real time according to the relational database, and then determine that the load in the first preset time period is higher than the preset load. The maximum duration of. If the maximum duration is less than the second duration, it means that the load of the session can process the corresponding task in time, and the code execution request can be allocated to the session at this time. If the maximum duration is greater than the second duration, it means that the load of the session remains high. At this time, you can refuse to assign the code execution request to the task, thereby avoiding the user's code caused by assigning the code execution request to the task. Issue of extension when executing request.
本申请实施例中,通过筛选出满足负载规则的会话,不仅能够让用户的代码执行请求及时被处理,还能尽量保证各个会话的负载均衡。In the embodiments of the present application, by screening out the sessions that meet the load rules, not only the user's code execution request can be processed in time, but also the load balance of each session can be ensured as much as possible.
(4)指定会话规则,是指选取代码执行请求中所指定的会话。代码执行请求中所指定的会话可以是一个,也可以是多个。(4) Specifying the session rule refers to selecting the session specified in the code execution request. The session specified in the code execution request can be one or multiple.
(5)黑名单会话规则,是指选取除了预设的黑名单中会话之外的会话。黑名单会话规则中预设的黑名单中的会话可以由用户携带在代码执行请求中。其中,每个用户对应的黑名单中对应的会话可以不相同,也可以相同。(5) Blacklist session rules refer to the selection of sessions other than those in the preset blacklist. The sessions in the blacklist preset in the blacklist session rule can be carried in the code execution request by the user. Among them, the corresponding sessions in the blacklist corresponding to each user may be different or the same.
(6)优先级会话规则,是指将多个会话按照预设优先级从高到低的顺序排列,并选取优先级最高的会话。其中,会话的预设优先级的高低设置方式可以参照前文论述的内容,此处不再赘述。(6) The priority conversation rule refers to arranging multiple conversations in the order of preset priority from high to low, and selecting the conversation with the highest priority. Among them, the way to set the preset priority of the session can refer to the content discussed above, and will not be repeated here.
本申请实施例中,当有多个会话并列满足某些规则时,可以利用优先级会话规则从多个会话中选择出优先级最高的会话,以确保为用户选择可靠性较高的会话。In the embodiment of the present application, when multiple sessions meet certain rules in parallel, priority session rules can be used to select the session with the highest priority from the multiple sessions to ensure that a session with higher reliability is selected for the user.
(7)引擎服务类型规则,是指选取与用户请求执行的代码类型相匹配的会话。(7) The engine service type rule refers to the selection of the session that matches the code type requested by the user.
作为一种实施例,如果代码执行请求中携带有引擎服务类型,则中间代理服务器12可以根据代码执行请求为该代码执行请求分配相匹配的引擎服务,而无需设置引擎类型规则。如果代码执行请求中没有携带引擎服务类型,则中间代理服务器12可以增设引擎服务类型规则,以便于基于该引擎服务类型规则为该代码执行请求筛选出匹配的引擎服务中的会话。As an embodiment, if the code execution request carries the engine service type, the intermediate proxy server 12 can assign a matching engine service to the code execution request according to the code execution request without setting engine type rules. If the code execution request does not carry the engine service type, the intermediate proxy server 12 may add an engine service type rule, so as to screen out matching engine service sessions for the code execution request based on the engine service type rule.
(8)自定义规则,是指根据用户输入的规则来选取相应的会话。(8) The custom rule refers to the selection of the corresponding conversation according to the rule input by the user.
具体的,用户可以在代码执行请求中携带自己定义的一些筛选规则,如此,中间代理服务器12接收到代码执行请求之后,可以将代码执行请求中的筛选规则确定为该用户筛选会话的规则。Specifically, the user may carry some filtering rules defined by himself in the code execution request. In this way, after receiving the code execution request, the intermediate proxy server 12 may determine the filtering rule in the code execution request as a rule for the user to screen the session.
下面对上述(8)种规则组合的情况进行示例说明。The following is an example of the combination of the above (8) rules.
N个规则包括健康状态规则、并发规则、负载规则、指定会话规则、黑名单会话规则和优先级会话规则,在这种情况下,按照方式二从总会话列表中筛选会话。其中,N个规则的预设优先级可以为:健康状态规则>并发规则>负载规则>指定会话规则>黑名单会话规则>优先级会话规则。The N rules include health status rules, concurrency rules, load rules, designated session rules, blacklist session rules, and priority session rules. In this case, the sessions are filtered from the total session list according to the second method. Among them, the preset priority of the N rules can be: health state rule>concurrency rule>load rule>specified session rule>blacklist session rule>priority session rule.
具体的,中间代理服务器12可以先根据健康状态规则筛选出健康状态为正常的第一会话列表,再根据并发规则,从第一会话列表中筛选出当前并发 数小于最大并发数的第二会话列表,再根据负载规则从第二会话列表中进行筛选,依次类推,直到筛选出一个用于执行代码执行请求的会话为止。Specifically, the intermediate proxy server 12 may first filter out the first session list whose health status is normal according to the health state rule, and then filter out the second session list whose current concurrent number is less than the maximum concurrent number from the first session list according to the concurrency rule. , And then filter from the second session list according to the load rule, and so on, until a session for executing the code execution request is filtered out.
应当说明的是,上述(8)种规则可以有很多种组合,本文不再进行一一列举。It should be noted that the above-mentioned (8) rules can have many combinations, and this article will not list them all.
步骤310,中间代理服务器12将用户请求执行的代码发送给筛选出的会话。In step 310, the intermediate proxy server 12 sends the code requested by the user to be executed to the selected session.
具体的,中间代理服务器12根据N个规则筛选出对应的会话之后,可以将用户请求执行的代码发送给筛选出的会话,由该会话执行该用户发送的代码。Specifically, after the intermediate proxy server 12 screens out corresponding sessions according to N rules, it may send the code requested by the user to be executed to the screened session, and the session executes the code sent by the user.
步骤311,中间代理服务器12将筛选出的会话的会话信息与任务ID的对应关系存储在关系型数据库中。In step 311, the intermediate proxy server 12 stores the correspondence between the screened session information and the task ID in a relational database.
具体的,当确定某个任务对应的会话之后,中间代理服务器12可以将该会话的会话信息与该任务的任务ID的对应关系存储在关系型数据库中,以及时更新关系型数据库中的数据,方便中间代理服务器12后续确定各个会话的任务数量。Specifically, after determining the session corresponding to a certain task, the intermediate proxy server 12 may store the correspondence between the session information of the session and the task ID of the task in the relational database, and update the data in the relational database in time. It is convenient for the intermediate proxy server 12 to subsequently determine the number of tasks for each session.
步骤312,中间代理服务器12从会话中获取任务的状态信息。In step 312, the intermediate proxy server 12 obtains task status information from the session.
具体的,中间代理服务器12在将任务提交给会话之后,会话可以间隔预设时长向中间代理服务器12发送该会话执行各个任务的状态信息,以便于中间代理服务器12获取得到任务的状态信息。中间代理服务器12也可以周期性地问询各个会话,以获得各个会话执行任务的状态信息。任务的状态信息可以参照前文步骤302论述的内容,此处不再赘述。Specifically, after the intermediate proxy server 12 submits the task to the session, the session may send to the intermediate proxy server 12 the status information of each task performed by the session at a preset time interval, so that the intermediate proxy server 12 can obtain the status information of the task. The intermediate proxy server 12 may also periodically inquire each session to obtain status information of the tasks performed by each session. The status information of the task can refer to the content discussed in step 302 above, which will not be repeated here.
步骤313,中间代理服务器12将任务的状态信息反馈给客户端11。In step 313, the intermediate proxy server 12 feeds back the status information of the task to the client 11.
在获取该任务的状态信息之后,中间代理服务器12可以及时向客户端11反馈任务的状态信息。或者,为了节省开销,以及及时更新任务的进度,中间代理服务器12也可以将该任务的状态信息存储在关系型数据库中,并周期性地向客户端11反馈各个任务的状态信息。After acquiring the status information of the task, the intermediate proxy server 12 can feed back the status information of the task to the client 11 in time. Alternatively, in order to save costs and update the progress of the task in time, the intermediate proxy server 12 may also store the status information of the task in a relational database, and periodically feedback the status information of each task to the client 11.
作为一种实施例,图3中的步骤302属于可选的部分,步骤303-步骤306属于可选的部分,步骤307-步骤308属于可选的部分,步骤311-步骤313属于可选的部分。As an example, step 302 in FIG. 3 is an optional part, step 303-step 306 are optional part, step 307-step 308 are optional part, and step 311-step 313 are optional part. .
本申请实施例通过执行上述方法,实现了对银行等金融行业中的代码执行请求的及时处理,用户无需关注引擎服务中的会话个数等信息,也无需去指定会话,从而能够简化用户的操作,提升用户体验。且,中间代理服务器根据N个规则从多个会话中筛选出相应会话,还能提高选择会话的灵活性。The embodiment of the application implements the above-mentioned method to realize timely processing of code execution requests in the financial industry such as banks. Users do not need to pay attention to information such as the number of sessions in the engine service, and do not need to specify sessions, thereby simplifying user operations , Improve user experience. In addition, the intermediate proxy server filters out corresponding sessions from multiple sessions according to N rules, which can also improve the flexibility of session selection.
在前文论述的一种处理代码执行请求的方法的基础上,本申请实施例还提供一种处理代码执行请求的装置,该装置相当于前文图3中的中间代理服务器12。On the basis of the method for processing code execution requests discussed above, an embodiment of the present application also provides a device for processing code execution requests, which is equivalent to the intermediate proxy server 12 in FIG. 3 above.
图4为本申请实施例提供的处理代码执行请求的装置的结构示意图,如图4所示,该装置包括:FIG. 4 is a schematic structural diagram of an apparatus for processing code execution requests provided by an embodiment of the application. As shown in FIG. 4, the apparatus includes:
接收模块401,用于接收客户端11发送的代码执行请求,代码执行请求包括用户请求执行的代码;代码执行请求的内容可以参照前文步骤301论述 的内容,此处不再赘述。The receiving module 401 is used to receive a code execution request sent by the client 11, the code execution request includes the code requested to be executed by the user; the content of the code execution request can refer to the content discussed in step 301 above, and will not be repeated here.
会话筛选模块402,用于根据预设的N个规则,从用户对应的总会话列表中,筛选出用于执行代码执行请求的会话;其中,总会话列表包括用户在引擎服务中对应的所有会话,N为正整数;总会话列表、N个规则的内容可以参照前文步骤309论述的内容,此处不再赘述。The session screening module 402 is used to screen out the sessions used to execute the code execution request from the total session list corresponding to the user according to the preset N rules; wherein, the total session list includes all the sessions corresponding to the user in the engine service , N is a positive integer; the content of the total conversation list and the N rules can refer to the content discussed in step 309 above, which will not be repeated here.
发送模块403,用于将用户请求执行的代码发送给用于执行代码执行请求的会话。The sending module 403 is used to send the code requested by the user to be executed to the session for executing the code execution request.
在一种可能的实现方式中,会话筛选模块402具体用于:In a possible implementation manner, the session screening module 402 is specifically configured to:
将用户对应的总会话列表依次通过K个规则,筛选出用于执行代码执行请求的会话;其中,K个规则为N个规则中按照预设优先级从高到低排列后的前K个规则,K为小于或等于N的正整数。The total conversation list corresponding to the user is sequentially passed through K rules to filter out the conversations used to execute the code execution request; among them, the K rules are the first K rules arranged from high to low among the N rules according to the preset priority. , K is a positive integer less than or equal to N.
在一种可能的实现方式中,N个规则包括:健康状态规则、并发规则、负载规则、指定会话规则、黑名单会话规则和优先级会话规则中的一种或几种;In a possible implementation, the N rules include: one or more of health state rules, concurrency rules, load rules, specified session rules, blacklist session rules, and priority session rules;
其中,健康状态规则是指选取健康状态为正常的会话,并发规则是指选取当前并发数小于最大并发数的会话,负载规则是指选取在预设第一时长内负载量高于预设负载量的最大持续时长低于预设第二时长的会话,第一时长大于第二时长,指定会话规则是指选取代码执行请求中所指定的会话,黑名单会话规则是指选取除了预设的黑名单中会话之外的会话,优先级会话规则是指将多个会话按照预设优先级从高到低顺序排列,选取优先级最高的会话。Among them, the health status rule refers to the selection of sessions whose health status is normal, the concurrency rule refers to the selection of sessions whose current concurrency number is less than the maximum concurrency number, and the load rule refers to the selection of which load is higher than the preset load in the preset first time period. The maximum duration of the session is lower than the preset second duration. The first duration is greater than the second duration. The specified session rule refers to the session specified in the code execution request, and the blacklist session rule refers to the selection except the preset blacklist For conversations other than medium conversations, the priority conversation rule refers to arranging multiple conversations in order from high to low according to the preset priority, and selecting the conversation with the highest priority.
在一种可能的实现方式中,该装置还包括会话管理模块404;In a possible implementation, the device further includes a session management module 404;
接收模块401,还用于在接收客户端的代码执行请求之后,将代码执行请求封装为任务,并为任务分配任务身份识别码ID,将任务ID存储在关系型数据库中;The receiving module 401 is also used to encapsulate the code execution request as a task after receiving the code execution request from the client, assign the task identification code ID to the task, and store the task ID in the relational database;
会话管理模块404,用于在发送模块403将用户请求执行的代码发送给用于执行代码执行请求的会话之后,将用于执行代码执行请求的会话对应的会话信息与任务ID的对应关系更新至关系型数据库,以及根据用于执行代码执行请求的会话对应的会话信息,从引擎服务中获取用于执行代码执行请求的会话执行任务的状态信息;The session management module 404 is used to update the correspondence between the session information corresponding to the session used to execute the code execution request and the task ID after the sending module 403 sends the code requested to be executed by the user to the session used to execute the code execution request to Relational database, and according to the session information corresponding to the session used to execute the code execution request, obtain the state information of the session execution task used to execute the code execution request from the engine service;
发送模块403,还用于将状态信息反馈给客户端11。The sending module 403 is also used to feed back status information to the client 11.
在一种可能的实现方式中,该装置还包括会话注册模块405;In a possible implementation manner, the device further includes a session registration module 405;
接收模块401,在根据预设的N个规则,从用户对应的总会话列表中,筛选出用于执行代码执行请求的会话之前,还用于接收至少一个引擎服务中每个引擎服务发送的注册信息;其中,注册信息包括每个引擎服务的资源定位符URL、服务类型以及服务元数据信息;The receiving module 401 is also used to receive the registration sent by each engine service in at least one engine service before filtering out the session for executing the code execution request from the total session list corresponding to the user according to the preset N rules Information; where the registration information includes the resource locator URL, service type and service metadata information of each engine service;
发送模块403,还用于根据注册信息,向每个引擎服务发送第一心跳;The sending module 403 is also used to send the first heartbeat to each engine service according to the registration information;
会话注册模块405,用于根据每个引擎服务针对第一心跳反馈的信息,获取每个引擎服务对应的会话列表。The session registration module 405 is configured to obtain the session list corresponding to each engine service according to the information fed back by each engine service for the first heartbeat.
在一种可能的实现方式中,该装置还包括会话健康状态确定模块406;In a possible implementation, the device further includes a session health status determination module 406;
发送模块403,还用于在根据预设的N个规则,从用户对应的总会话列 表中,筛选出用于执行代码执行请求的会话之前,根据每个引擎服务对应的会话列表,向每个引擎服务对应的会话列表中的每个会话发送第二心跳;The sending module 403 is also used to filter out the sessions used to execute the code execution request from the total session list corresponding to the user according to preset N rules, and send each engine service the corresponding session list to each Each session in the session list corresponding to the engine service sends a second heartbeat;
会话健康状态确定模块406,用于根据每个引擎服务对应的会话列表中的每个会话针对第二心跳反馈的信息,确定每个引擎服务对应的会话列表中的每个会话的健康状态。The session health status determination module 406 is configured to determine the health status of each session in the session list corresponding to each engine service according to the information fed back to the second heartbeat for each session in the session list corresponding to each engine service.
在前文论述的一种处理代码执行请求的方法的基础上,本申请实施例还提供一种处理代码执行请求的装置,该装置相当于前文论述的中间代理服务器12。On the basis of the method for processing code execution requests discussed above, an embodiment of the present application also provides a device for processing code execution requests, which is equivalent to the intermediate proxy server 12 discussed above.
图5为本申请实施例提供的一种计算设备的结构示意图,如图5所示,该装置包括:FIG. 5 is a schematic structural diagram of a computing device provided by an embodiment of the application. As shown in FIG. 5, the device includes:
至少一个处理器501,以及At least one processor 501, and
与至少一个处理器501通信连接的存储器502;A memory 502 communicatively connected with at least one processor 501;
其中,存储器502存储有可被至少一个处理器501执行的指令,至少一个处理器501通过执行存储器502存储的指令实现如图3所述的方法。Wherein, the memory 502 stores instructions that can be executed by at least one processor 501, and the at least one processor 501 implements the method described in FIG. 3 by executing the instructions stored in the memory 502.
作为一种实施例,图4中的会话管理模块404、会话注册模块405、会话健康状态确定模块406以及会话筛选模块402可以通过图5中的处理器501实现。As an embodiment, the session management module 404, the session registration module 405, the session health status determination module 406, and the session screening module 402 in FIG. 4 may be implemented by the processor 501 in FIG.
其中,处理器501是中间代理服务器12的控制中心,可以利用各种接口和线路连接整个中间代理服务器12的各个部分,通过运行或执行存储在存储器502内的指令以及调用存储在存储器502内的数据,实现为代码执行请求筛选会话,以及管理会话的功能。Among them, the processor 501 is the control center of the intermediate proxy server 12, which can use various interfaces and lines to connect the various parts of the entire intermediate proxy server 12, by running or executing instructions stored in the memory 502 and calling The data is implemented as a function of filtering sessions for code execution requests and managing sessions.
可选的,处理器501可包括一个或多个处理单元,处理器501可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器可以不集成到处理器501中。在一些实施例中,处理器501和存储器502可以在同一芯片上实现,也可以在独立的芯片上分别实现。Optionally, the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor. The application processor mainly processes the operating system, user interface, and application programs. The adjustment processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 501. In some embodiments, the processor 501 and the memory 502 may be implemented on the same chip, or may be implemented on separate chips.
处理器501可以是通用处理器,例如中央处理器(CPU)、数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。The processor 501 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, Implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
存储器502作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器502可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机存取存储器(random access memory,RAM)、静态随机存取器(static random access memory,SRAM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、只读存储器(read only memory,ROM)、磁性存储器、磁盘、光盘等等。存储器502是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本申 请实施例中的存储器502还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。As a non-volatile computer-readable storage medium, the memory 502 can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The memory 502 may include at least one type of storage medium, for example, may include flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM) ), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, magnetic disk, optical disk, etc. The memory 502 is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory 502 in the embodiment of the application may also be a circuit or any other device capable of realizing a storage function for storing program instructions and/or data.
在前文论述的一种处理代码执行请求的方法的基础上,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如图3所述的方法。On the basis of the method for processing code execution requests discussed above, an embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores computer instructions, when the computer instructions are on the computer When running, the computer is made to execute the method described in Figure 3.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。This application is described with reference to flowcharts and/or block diagrams of methods, equipment (systems), and computer program products according to the embodiments of this application. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment are generated It is a device that realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. The device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment. The instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the application without departing from the spirit and scope of the application. In this way, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application also intends to include these modifications and variations.

Claims (14)

  1. 一种处理代码执行请求的方法,其特征在于,应用于中间代理服务器中,所述中间代理服务器与客户端和引擎服务器中的引擎服务均通信连接,所述方法包括:A method for processing code execution requests, characterized in that it is applied to an intermediate proxy server, the intermediate proxy server is in communication connection with the client and engine services in the engine server, and the method includes:
    接收所述客户端发送的代码执行请求,所述代码执行请求包括用户请求执行的代码;Receiving a code execution request sent by the client, where the code execution request includes the code requested to be executed by the user;
    根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话;其中,所述总会话列表包括所述用户在所述引擎服务中对应的所有会话,N为正整数;According to the preset N rules, from the total conversation list corresponding to the user, the conversations used to execute the code execution request are filtered out; wherein, the total conversation list includes the corresponding user in the engine service All conversations of, N is a positive integer;
    将所述用户请求执行的代码发送给所述用于执行代码执行请求的会话。Send the code requested to be executed by the user to the session for executing the code execution request.
  2. 如权利要求1所述的方法,其特征在于,所述根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话,包括:The method according to claim 1, wherein the filtering out a session for executing the code execution request from a total session list corresponding to the user according to preset N rules, comprises:
    将所述用户对应的总会话列表依次通过K个规则,筛选出用于执行所述代码执行请求的会话;其中,所述K个规则为所述N个规则中按照预设优先级从高到低排列后的前K个规则,K为小于或等于N的正整数。The total conversation list corresponding to the user is sequentially passed through K rules to filter out the conversations used to execute the code execution request; wherein, the K rules are the N rules from high to preset priority For the first K rules after the low ranking, K is a positive integer less than or equal to N.
  3. 如权利要求1或2所述的方法,其特征在于,所述N个规则包括:健康状态规则、并发规则、负载规则、指定会话规则、黑名单会话规则和优先级会话规则中的一种或几种;The method according to claim 1 or 2, wherein the N rules include: one of health state rules, concurrency rules, load rules, designated session rules, blacklist session rules, and priority session rules, or Several
    其中,所述健康状态规则是指选取健康状态为正常的会话,所述并发规则是指选取当前并发数小于最大并发数的会话,所述负载规则是指选取在预设第一时长内负载量高于预设负载量的最大持续时长低于预设第二时长的会话,所述第一时长大于所述第二时长,所述指定会话规则是指选取所述代码执行请求中所指定的会话,所述黑名单会话规则是指选取除了预设的黑名单中会话之外的会话,所述优先级会话规则是指将多个会话按照预设优先级从高到低顺序排列,选取优先级最高的会话。Wherein, the health state rule refers to the selection of sessions whose health state is normal, the concurrency rule refers to the selection of sessions whose current concurrency number is less than the maximum concurrency number, and the load rule refers to the selection of a load within a preset first time period A session with a maximum duration that is higher than the preset load and lower than the preset second duration, and the first duration is greater than the second duration, and the specified session rule refers to selecting the session specified in the code execution request The blacklist session rule refers to selecting sessions other than the sessions in the preset blacklist, and the priority session rule refers to arranging multiple sessions in order of preset priority from high to low, and selecting the priority The highest conversation.
  4. 如权利要求1所述的方法,其特征在于,The method of claim 1, wherein:
    在接收所述客户端的代码执行请求之后,将所述代码执行请求封装为任务,并为所述任务分配任务身份识别码ID,将所述任务ID存储至关系型数据库中;After receiving the code execution request from the client, encapsulate the code execution request as a task, assign a task identification code ID to the task, and store the task ID in a relational database;
    在将所述用户请求执行的代码发送给所述用于执行代码执行请求的会话之后,将所述用于执行代码执行请求的会话对应的会话信息与所述任务ID的对应关系更新至所述关系型数据库中;After the code requested to be executed by the user is sent to the session for executing the code execution request, the correspondence between the session information corresponding to the session for executing the code execution request and the task ID is updated to the Relational database;
    根据所述用于执行代码执行请求的会话对应的会话信息,从所述引擎服务中获取所述用于执行代码执行请求的会话执行所述任务的状态信息;According to the session information corresponding to the session used to execute the code execution request, obtain the state information of the task executed by the session used to execute the code execution request from the engine service;
    将所述状态信息反馈给所述客户端。Feed back the status information to the client.
  5. 如权利要求1、2或4所述的方法,其特征在于,在根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求 的会话之前,还包括:The method according to claim 1, 2 or 4, characterized in that, according to the preset N rules, from the total conversation list corresponding to the user, the conversation used to execute the code execution request is filtered out. ,Also includes:
    接收至少一个引擎服务中每个引擎服务发送的注册信息;其中,所述注册信息包括所述每个引擎服务的资源定位符URL、服务类型以及服务元数据信息;Receiving registration information sent by each engine service in at least one engine service; wherein the registration information includes the resource locator URL, service type, and service metadata information of each engine service;
    根据所述注册信息,向所述每个引擎服务发送第一心跳;Sending a first heartbeat to each engine service according to the registration information;
    根据所述每个引擎服务针对所述第一心跳反馈的信息,获取所述每个引擎服务对应的会话列表。Acquire the session list corresponding to each engine service according to the information fed back by each engine service for the first heartbeat.
  6. 如权利要求5所述的方法,其特征在于,在根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话之前,还包括:The method according to claim 5, characterized in that, before filtering out the session for executing the code execution request from the total session list corresponding to the user according to preset N rules, the method further comprises:
    根据所述每个引擎服务对应的会话列表,向所述每个引擎服务对应的会话列表中的每个会话发送第二心跳;Sending a second heartbeat to each session in the session list corresponding to each engine service according to the session list corresponding to each engine service;
    根据所述每个引擎服务对应的会话列表中的每个会话针对所述第二心跳反馈的信息,确定所述每个引擎服务对应的会话列表中的每个会话的健康状态。Determine the health status of each session in the session list corresponding to each engine service according to the information fed back to the second heartbeat for each session in the session list corresponding to each engine service.
  7. 一种处理代码执行请求的装置,其特征在于,客户端通过所述装置与引擎服务器中的引擎服务通信,所述装置包括:A device for processing code execution requests, characterized in that a client communicates with an engine service in an engine server through the device, and the device includes:
    接收模块,用于接收客户端发送的代码执行请求,所述代码执行请求包括用户请求执行的代码;The receiving module is configured to receive a code execution request sent by the client, where the code execution request includes the code requested to be executed by the user;
    会话筛选模块,用于根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话;其中,所述总会话列表包括所述用户在引擎服务中对应的所有会话,N为正整数;The session screening module is configured to screen out the sessions used to execute the code execution request from the total session list corresponding to the user according to preset N rules; wherein, the total session list includes the user's current For all the corresponding sessions in the engine service, N is a positive integer;
    发送模块,用于将所述用户请求执行的代码发送给所述用于执行代码执行请求的会话。The sending module is configured to send the code requested to be executed by the user to the session for executing the code execution request.
  8. 如权利要求7所述的装置,其特征在于,会话筛选模块具体用于:The device according to claim 7, wherein the session screening module is specifically configured to:
    将所述用户对应的总会话列表依次通过K个规则,筛选出用于执行所述代码执行请求的会话;其中,所述K个规则为所述N个规则中按照预设优先级从高到低排列后的前K个规则,K为小于或等于N的正整数。The total conversation list corresponding to the user is sequentially passed through K rules to filter out the conversations used to execute the code execution request; wherein, the K rules are the N rules from high to preset priority For the first K rules after the low ranking, K is a positive integer less than or equal to N.
  9. 如权利要求7或8所述的装置,其特征在于,所述N个规则包括:健康状态规则、并发规则、负载规则、指定会话规则、黑名单会话规则和优先级会话规则中的一种或几种;The device according to claim 7 or 8, wherein the N rules comprise: one of health state rules, concurrency rules, load rules, designated session rules, blacklist session rules, and priority session rules, or Several
    其中,所述健康状态规则是指选取健康状态为正常的会话,所述并发规则是指选取当前并发数小于最大并发数的会话,所述负载规则是指选取在预设第一时长内负载量高于预设负载量的最大持续时长低于预设第二时长的会话,所述第一时长大于所述第二时长,所述指定会话规则是指选取所述代码执行请求中所指定的会话,所述黑名单会话规则是指选取除了预设的黑名单中会话之外的会话,所述优先级会话规则是指将多个会话按照预设优先级从高到低顺序排列,选取优先级最高的会话。Wherein, the health state rule refers to the selection of sessions whose health state is normal, the concurrency rule refers to the selection of sessions whose current concurrency number is less than the maximum concurrency number, and the load rule refers to the selection of a load within a preset first time period A session with a maximum duration that is higher than the preset load and lower than the preset second duration, and the first duration is greater than the second duration, and the specified session rule refers to selecting the session specified in the code execution request The blacklist session rule refers to selecting sessions other than the sessions in the preset blacklist, and the priority session rule refers to arranging multiple sessions in order of preset priority from high to low, and selecting the priority The highest conversation.
  10. 如权利要求7所述的装置,其特征在于,所述装置还包括会话管理模块;8. The device of claim 7, wherein the device further comprises a session management module;
    所述接收模块,还用于在接收所述客户端的代码执行请求之后,将所述代码执行请求封装为任务,并为所述任务分配任务身份识别码ID,将所述任务ID存储至关系型数据库中;The receiving module is further configured to encapsulate the code execution request as a task after receiving the code execution request from the client, assign a task identification code ID to the task, and store the task ID in a relational type In the database
    所述会话管理模块,用于在所述发送模块将所述用户请求执行的代码发送给所述用于执行代码执行请求的会话之后,将所述用于执行代码执行请求的会话对应的会话信息与所述任务ID的对应关系更新至所述关系型数据库中,以及根据所述用于执行代码执行请求的会话对应的会话信息,从所述引擎服务中获取所述用于执行代码执行请求的会话执行所述任务的状态信息;The session management module is configured to send the session information corresponding to the session used to execute the code execution request after the sending module sends the code requested to be executed by the user to the session used to execute the code execution request The corresponding relationship with the task ID is updated to the relational database, and the session information corresponding to the session used to execute the code execution request is obtained from the engine service. The status information of the session executing the task;
    所述发送模块,还用于将所述状态信息反馈给所述客户端。The sending module is also used to feed back the status information to the client.
  11. 如权利要求7、8或10所述的装置,其特征在于,所述装置还包括会话注册模块;The device according to claim 7, 8 or 10, wherein the device further comprises a session registration module;
    所述接收模块,在根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话之前,还用于接收至少一个引擎服务中每个引擎服务发送的注册信息;其中,所述注册信息包括所述每个引擎服务的资源定位符URL、服务类型以及服务元数据信息;The receiving module is further configured to receive each of at least one engine service before filtering out the session for executing the code execution request from the total session list corresponding to the user according to preset N rules. Registration information sent by the engine service; wherein the registration information includes the resource locator URL, service type, and service metadata information of each engine service;
    所述发送模块,还用于根据所述注册信息,向所述每个引擎服务发送第一心跳;The sending module is further configured to send a first heartbeat to each engine service according to the registration information;
    所述会话注册模块,用于根据所述每个引擎服务针对所述第一心跳反馈的信息,获取所述每个引擎服务对应的会话列表。The session registration module is configured to obtain the session list corresponding to each engine service according to the information fed back by each engine service for the first heartbeat.
  12. 如权利要求11所述的装置,其特征在于,所述装置还包括会话健康状态确定模块;The device of claim 11, wherein the device further comprises a session health status determination module;
    所述发送模块,还用于在根据预设的N个规则,从所述用户对应的总会话列表中,筛选出用于执行所述代码执行请求的会话之前,据所述每个引擎服务对应的会话列表,向所述每个引擎服务对应的会话列表中的每个会话发送第二心跳;The sending module is further configured to filter out the session for executing the code execution request from the total session list corresponding to the user according to the preset N rules, according to the corresponding engine service To send a second heartbeat to each session in the session list corresponding to each engine service;
    所述会话健康状态确定模块,用于根据所述每个引擎服务对应的会话列表中的每个会话针对所述第二心跳反馈的信息,确定所述每个引擎服务对应的会话列表中的每个会话的健康状态。The session health status determination module is configured to determine each session in the session list corresponding to each engine service according to the information feedback for the second heartbeat for each session in the session list corresponding to each engine service. The health status of each session.
  13. 一种计算设备,其特征在于,包括:A computing device, characterized by comprising:
    至少一个处理器,以及At least one processor, and
    与所述至少一个处理器通信连接的存储器;A memory connected in communication with the at least one processor;
    其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述至少一个处理器通过执行所述存储器存储的指令实现如权利要求1-6中任一项所述的方法。Wherein, the memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the method according to any one of claims 1-6 by executing the instructions stored in the memory.
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如权利要1-6中任一项所述的方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions, when the computer instructions run on a computer, the computer executes any one of claims 1-6 Methods.
PCT/CN2020/079558 2019-05-20 2020-03-17 Method and device for processing code execution request WO2020233206A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910419110.4A CN110191165B (en) 2019-05-20 2019-05-20 Method and device for processing code execution request
CN201910419110.4 2019-05-20

Publications (1)

Publication Number Publication Date
WO2020233206A1 true WO2020233206A1 (en) 2020-11-26

Family

ID=67716929

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/079558 WO2020233206A1 (en) 2019-05-20 2020-03-17 Method and device for processing code execution request

Country Status (2)

Country Link
CN (1) CN110191165B (en)
WO (1) WO2020233206A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328302A (en) * 2020-11-30 2021-02-05 中国航空工业集团公司西安航空计算技术研究所 Configuration service assembly adaptable to various storage systems
CN112732456A (en) * 2020-12-15 2021-04-30 京东数字科技控股股份有限公司 Micro-service calling method and device, electronic equipment and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110191165B (en) * 2019-05-20 2023-05-12 深圳前海微众银行股份有限公司 Method and device for processing code execution request
CN111341163A (en) * 2020-04-16 2020-06-26 湖南翰坤实业有限公司 VR technology-based construction safety education multi-person online training system and method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1937608A (en) * 2005-09-22 2007-03-28 国际商业机器公司 Method for managing client machine-server communication and computer system
EP2355444A1 (en) * 2010-01-29 2011-08-10 Citrix Systems, Inc. Systems and methods of using SSL pools for WAN acceleration
CN103782574A (en) * 2011-09-09 2014-05-07 甲骨文国际公司 Idempotence for database transactions
CN105306442A (en) * 2015-09-17 2016-02-03 物联智慧科技(深圳)有限公司 Proxy server and command transmission methods
US10069928B1 (en) * 2015-01-21 2018-09-04 Amazon Technologies, Inc. Translating requests/responses between communication channels having different protocols
CN110191165A (en) * 2019-05-20 2019-08-30 深圳前海微众银行股份有限公司 A kind of processing code executes the method and device of request

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1415236B1 (en) * 2001-07-16 2018-04-18 Oracle International Corporation Method and apparatus for session replication and failover
MY164885A (en) * 2011-09-06 2018-01-30 Mimos Berhad System and method for rich internet application session transfer
CN107819593B (en) * 2016-09-14 2021-09-03 北京京东尚科信息技术有限公司 Intelligent equipment group communication method and system and terminal equipment
CN109729139A (en) * 2018-06-15 2019-05-07 平安普惠企业管理有限公司 Access request retransmission method, device, equipment and readable storage medium storing program for executing
CN109413037B (en) * 2018-09-12 2021-11-16 奇安信科技集团股份有限公司 Modbus service processing method and device
CN109739663B (en) * 2018-12-29 2023-07-14 深圳前海微众银行股份有限公司 Job processing method, apparatus, device and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1937608A (en) * 2005-09-22 2007-03-28 国际商业机器公司 Method for managing client machine-server communication and computer system
EP2355444A1 (en) * 2010-01-29 2011-08-10 Citrix Systems, Inc. Systems and methods of using SSL pools for WAN acceleration
CN103782574A (en) * 2011-09-09 2014-05-07 甲骨文国际公司 Idempotence for database transactions
US10069928B1 (en) * 2015-01-21 2018-09-04 Amazon Technologies, Inc. Translating requests/responses between communication channels having different protocols
CN105306442A (en) * 2015-09-17 2016-02-03 物联智慧科技(深圳)有限公司 Proxy server and command transmission methods
CN110191165A (en) * 2019-05-20 2019-08-30 深圳前海微众银行股份有限公司 A kind of processing code executes the method and device of request

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328302A (en) * 2020-11-30 2021-02-05 中国航空工业集团公司西安航空计算技术研究所 Configuration service assembly adaptable to various storage systems
CN112328302B (en) * 2020-11-30 2023-05-23 中国航空工业集团公司西安航空计算技术研究所 Configuration service assembly capable of adapting to various storage systems
CN112732456A (en) * 2020-12-15 2021-04-30 京东数字科技控股股份有限公司 Micro-service calling method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN110191165B (en) 2023-05-12
CN110191165A (en) 2019-08-30

Similar Documents

Publication Publication Date Title
WO2020233206A1 (en) Method and device for processing code execution request
US11272059B2 (en) Exclusive agent pool allocation method, electronic device, and computer readable storage medium
WO2018149221A1 (en) Device management method and network management system
US10515326B2 (en) Database systems and related queue management methods
US8639792B2 (en) Job processing system, method and program
US9921957B2 (en) Methods and systems for managing memory allocation
US8176037B2 (en) System and method for SQL query load balancing
CN110557284B (en) Data aggregation method and device based on client gateway
WO2018210005A1 (en) Method and apparatus for managing menu options of system, processing device, and medium
TWI546679B (en) System, method and computer readable media storing program therein for allocating cloud resource
DE112013002544T5 (en) Cloud-based sharing of data points and collaboration among user groups
WO2020078044A1 (en) Data processing method and apparatus, and computing device
WO2019024508A1 (en) Resource allocation method, master device, slave device, and distributed computing system
CN111858055B (en) Task processing method, server and storage medium
DE202020005693U1 (en) External credential-free tiers for database integrations
WO2022001376A1 (en) Resource distribution method for cloud service and related device
CN110830604B (en) DNS scheduling method and device
WO2017088393A1 (en) Bandwidth allocation method and system
CN110728491B (en) Work order processing method and device, computer equipment and storage medium
US11102145B2 (en) Resource sharing method, computer device, and storage medium
WO2017096842A1 (en) Content delivery task submission method and system
US9875140B2 (en) System, method, and apparatus for coordinating distributed electronic discovery processing
CN110633900A (en) Virtual resource allocation method and device and electronic equipment
EP3739449A1 (en) Prescriptive cloud computing resource sizing based on multi-stream data sources
CN113204747A (en) Account management method, account management device, server and storage medium

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: 20810576

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: 20810576

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 18/03/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20810576

Country of ref document: EP

Kind code of ref document: A1