

技术领域technical field
本申请涉及计算机技术领域,尤其涉及一种脚本预热方法和装置。The present application relates to the field of computer technology, and in particular, to a script preheating method and apparatus.
背景技术Background technique
随着互联网时代的到来,互联网技术和业务发展突飞猛进,互联网业务有以下特点:上线快、周期短、敏捷开发、灵活配置;基于以上业务需求特点,脚本技术在互联网业务的风险控制体系中被大量使用,通过配置脚本以灵活、快速地控制风险。With the advent of the Internet era, Internet technology and business have developed by leaps and bounds. Internet business has the following characteristics: fast launch, short cycle, agile development, and flexible configuration; based on the above characteristics of business requirements, scripting technology has been widely used in the risk control system of Internet business. Use, configure scripts to control risks flexibly and quickly.
脚本是使用一种特定的描述性语言,是依据一定的格式编写的可执行文件。脚本是动态翻译执行的,在执行时需要解释器将其一条条翻译成机器可识别的指令,并按照程序顺序执行。A script is an executable file written in a certain format using a specific descriptive language. Scripts are dynamically translated and executed, and the interpreter needs to translate them into machine-recognized instructions one by one during execution, and execute them in program order.
在大多数的风险控制体系中,对系统性能和稳定性要求极高,然而,由于脚本在执行的时候需要先翻译,导致第一次执行时(系统启动第一次调用执行或者系统发布后第一次调用执行),系统间的调用超时率大大提高,在超时的时候,上游系统无法拿到分析结果,也就无法输出风险分析,影响风控系统中风险分析结果的输出,进而影响用户体验。In most risk control systems, the system performance and stability are extremely demanding. However, since the script needs to be translated first when it is executed, the first execution (the first call to execute when the system starts or the first call after the system is released) One call execution), the call timeout rate between systems is greatly improved. When the timeout is exceeded, the upstream system cannot get the analysis results, so it cannot output the risk analysis, which affects the output of the risk analysis results in the risk control system, which in turn affects the user experience. .
发明内容SUMMARY OF THE INVENTION
有鉴于此,本申请提供一种脚本预热方法和装置,既解决了脚本第一次执行耗时长问题,又可以保证系统间调用性能,减少系统间调用的超时比例。In view of this, the present application provides a script preheating method and device, which not only solves the problem that the script takes a long time to execute for the first time, but also ensures the performance of inter-system calls and reduces the timeout ratio of inter-system calls.
具体地,本申请是通过如下技术方案实现的:Specifically, the application is achieved through the following technical solutions:
一种脚本预热方法,所述方法包括:A script preheating method, the method includes:
在系统启动或模型更新时,获取本地保存的模型相关的历史数据,作为所述模型对应的变量类脚本的入参数据;When the system is started or the model is updated, the historical data related to the model saved locally is obtained as the input parameter data of the variable class script corresponding to the model;
根据所述入参数据,对所述变量类脚本进行脚本预热。According to the input parameter data, script preheating is performed on the variable class script.
一种脚本预热装置,所述装置包括:A script preheating device, the device includes:
获取单元,在系统启动或模型更新时,获取本地保存的模型相关的历史数据,作为所述模型对应的变量类脚本的入参数据;The acquisition unit, when the system is started or the model is updated, acquires the model-related historical data saved locally, as the input parameter data of the variable class script corresponding to the model;
预热单元,根据所述入参数据,对所述变量类脚本进行脚本预热。The preheating unit performs script preheating for the variable script according to the input parameter data.
由以上描述可以看出,本申请系统可以在系统启动或模型更新时,获取本地保存的模型相关的历史数据作为所述模型对应的变量类脚本的入参数据,然后根据所述入参数据进行脚本预热,以便能够在变量类脚本被真实的业务数据调用前完成预热,缩短变量类脚本第一次的执行耗时,减少系统间调用的超时比例,提升用户体验。As can be seen from the above description, the system of the present application can obtain the locally saved model-related historical data as the input parameter data of the variable class script corresponding to the model when the system is started or the model is updated, and then perform the input parameter data according to the input parameter data. Script preheating can complete the preheating before variable scripts are called by real business data, shorten the time required for the first execution of variable scripts, reduce the timeout ratio of calls between systems, and improve user experience.
附图说明Description of drawings
图1是本申请一示例性实施例示出的一种脚本预热方法的流程示意图。FIG. 1 is a schematic flowchart of a script preheating method according to an exemplary embodiment of the present application.
图2是本申请一示例性实施例示出的另一种脚本预热方法的流程示意图。FIG. 2 is a schematic flowchart of another script preheating method according to an exemplary embodiment of the present application.
图3是根据一示例性实施例示出的一种用于脚本预热装置的一结构示意图。FIG. 3 is a schematic structural diagram of an apparatus for script preheating according to an exemplary embodiment.
图4是本申请一示例性实施例示出的一种脚本预热装置的结构示意图。FIG. 4 is a schematic structural diagram of a script preheating apparatus according to an exemplary embodiment of the present application.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. Where the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as recited in the appended claims.
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this application and the appended claims, the singular forms "a," "the," and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It will also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本申请可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本申请范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited by these terms. These terms are only used to distinguish the same type of information from each other. For example, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information without departing from the scope of the present application. Depending on the context, the word "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determining."
图1是本申请一示例性实施例示出的一种脚本预热方法的流程示意图。FIG. 1 is a schematic flowchart of a script preheating method according to an exemplary embodiment of the present application.
请参考图1,所述脚本预热方法可以应用在服务器中,也可以应用在终端中,包括有以下步骤:Please refer to FIG. 1, the script preheating method can be applied in the server or in the terminal, including the following steps:
步骤101,在系统启动或模型更新时,获取本地保存的模型相关的历史数据,作为所述模型对应的变量类脚本的入参数据。In step 101, when the system is started or the model is updated, the historical data related to the model saved locally is acquired as input parameter data of the variable class script corresponding to the model.
在本实施例中,为解决脚本第一次执行耗时较长的问题,可以在系统启动或模型更新时,获取所述历史数据。比如:当系统重新启动后,可以获取本地保存的模型相关的历史数据,当某模型更新后,可以获取本地保存的该模型相关的历史数据。In this embodiment, in order to solve the problem that the script takes a long time to execute for the first time, the historical data can be acquired when the system is started or the model is updated. For example, when the system is restarted, the historical data related to the model saved locally can be obtained, and when a model is updated, the historical data related to the model saved locally can be obtained.
在本实施例中,所述模型可以理解为应用场景,某一模型可以对应有一个或者多个变量类脚本。所述历史数据是变量类脚本曾经执行时所使用过的真实的业务数据。比如:在变量类脚本发布后,如果接收到真实的业务数据需要调用所述变量类脚本,则系统可以在所述变量类脚本执行完毕后,将所述真实的业务数据作为所述变量类脚本对应模型的历史数据进行存储。此外,根据变量类脚本执行的情况系统还可以对本地保存的历史数据进行更新。In this embodiment, the model may be understood as an application scenario, and a certain model may correspond to one or more variable class scripts. The historical data is the real business data used when the variable script was executed. For example: after the variable script is released, if the variable script needs to be called after receiving real business data, the system can use the real business data as the variable script after the variable script is executed. The historical data of the corresponding model is stored. In addition, the system can also update the locally saved historical data according to the execution of the variable class script.
步骤102,根据所述入参数据,对所述变量类脚本进行脚本预热。Step 102: Perform script preheating on the variable class script according to the input parameter data.
基于前述步骤101,系统在获取到所述入参数据后,可以根据所述入参数据对变量类脚本进行预热。比如:系统可以启动异步线程根据所述入参数据对变量类脚本进行预热,并在预热完毕或者是到达预设的预热时长时,允许业务数据对变量类脚本进行调用。Based on the foregoing step 101, after the system obtains the input parameter data, the system may preheat the variable class script according to the input parameter data. For example, the system can start an asynchronous thread to warm up the variable script according to the input parameter data, and allow the business data to call the variable script when the warm-up is completed or when the preset warm-up duration is reached.
由以上描述可以看出,本申请系统可以在系统启动或模型更新时,获取本地保存的模型相关的历史数据作为所述模型对应的变量类脚本的入参数据,然后根据所述入参数据进行脚本预热,以便能够在变量类脚本被真实的业务数据调用前完成预热,缩短变量类脚本第一次的执行耗时,减少系统间调用的超时比例,提升用户体验。As can be seen from the above description, the system of the present application can obtain the locally saved model-related historical data as the input parameter data of the variable class script corresponding to the model when the system is started or the model is updated, and then perform the input parameter data according to the input parameter data. Script preheating can complete the preheating before variable scripts are called by real business data, shorten the time required for the first execution of variable scripts, reduce the timeout ratio of calls between systems, and improve user experience.
下面结合具体的实施例来描述本申请的实现过程。The implementation process of the present application is described below with reference to specific embodiments.
图2是本申请一示例性实施例示出的另一种脚本预热方法的流程示意图。FIG. 2 is a schematic flowchart of another script preheating method according to an exemplary embodiment of the present application.
请参考图2,所述脚本预热方法可以应用在服务器中,也可以应用在终端中,包括有以下步骤:Please refer to FIG. 2 , the script preheating method can be applied in the server or in the terminal, including the following steps:
步骤201,在系统启动或模型更新时,获取本地保存的模型相关的历史数据,作为所述模型对应的变量类脚本的入参数据。In step 201, when the system is started or the model is updated, the historical data related to the model saved locally is acquired as input parameter data of the variable class script corresponding to the model.
在本实施例中,系统启动后,系统之前缓存的变量类脚本翻译后的机器可识别的指令将被清空,所以在系统启动后,变量类脚本第一次执行时的耗时较长,此时,可以获取本地保存的模型相关的历史数据。此外,在模型更新时,比如:更新旧版本的模型时,模型对应的变量类脚本在第一次执行时的耗时也会较长,此时,也可以获取本地保存的模型相关的历史数据。In this embodiment, after the system is started, the machine-identifiable instructions translated by the variable-type script previously cached in the system will be cleared. Therefore, after the system is started, the variable-type script will take a long time to execute for the first time. , you can obtain the historical data related to the model saved locally. In addition, when the model is updated, for example, when updating an old version of the model, the variable script corresponding to the model will take a long time to execute for the first time. At this time, the historical data related to the model saved locally can also be obtained. .
在本实施例中,所述历史数据是曾经执行变量类脚本时使用过的真实的业务数据,系统可以保存变量类脚本及其使用过的历史数据的对应关系,比如:系统可以将所述变量类脚本及其使用过的历史数据的对应关系存储在硬盘等非易失性存储器中。系统也可以以模型为单位,保存所述变量类脚本所属模型及其使用过的历史数据的对应关系,比如:系统可以保存模型名称与历史数据的对应关系,本申请对此不作特殊限制。下面以保持模型名称与历史数据的对应关系为例进行描述。In this embodiment, the historical data is the real business data used when the variable script was executed, and the system can save the corresponding relationship between the variable script and the historical data used, for example, the system can store the variable The correspondence between the class script and its used historical data is stored in a non-volatile memory such as a hard disk. The system may also use the model as a unit to store the corresponding relationship between the model to which the variable type script belongs and the historical data used, for example, the system may store the corresponding relationship between the model name and the historical data, which is not specifically limited in this application. The following description takes maintaining the corresponding relationship between model names and historical data as an example.
表1Table 1
请参考表1的示例,本申请一种本地保存的模型与其相关历史数据的对应关系的示意图。以表1为例,模型A对应的变量类脚本在执行时曾经使用过历史数据1、历史数据2以及历史数据3,则系统保存模型A与历史数据1、历史数据2以及历史数据3的对应关系。具体地,模型A可以对应有一个或者多个变量类脚本,每个变量类脚本曾经使用过其中一个或者多个历史数据,在实际实现中,系统还会保存模型A相关的各个历史数据与模型A对应的变量类脚本的对应关系,比如:保存历史数据的键值或标识与模型A对应的变量类脚本的对应关系。而模型B对应的变量类脚本在执行时曾经使用过历史数据4,则系统保存模型B与历史数据4的对应关系。值得注意的是,表1只是一种对于结果以及原理的形象描述,在实际开发过程中,并不一定要组织这样的表项。本申请对此不作特殊限制。Please refer to the example in Table 1, which is a schematic diagram of the correspondence between a locally saved model and its related historical data in the present application. Taking Table 1 as an example, the variable script corresponding to model A has used historical data 1, historical data 2 and historical data 3 during execution, and the system saves the correspondence between model A and historical data 1, historical data 2 and historical data 3. relation. Specifically, model A may correspond to one or more variable-type scripts, and each variable-type script has used one or more of the historical data. In actual implementation, the system will also save various historical data and model related to model A. The corresponding relationship of the variable class script corresponding to A, for example: the key value of saving historical data or the corresponding relationship of the variable class script that identifies the corresponding model A. While the variable class script corresponding to model B has used historical data 4 during execution, the system saves the correspondence between model B and historical data 4 . It is worth noting that Table 1 is only an image description of the results and principles. In the actual development process, it is not necessary to organize such table items. This application does not make any special restrictions on this.
在本步骤中,系统可以根据模型名称获取本地保存的与所述模型相关的历史数据。In this step, the system can obtain the locally saved historical data related to the model according to the model name.
步骤202,启动异步线程,根据所述入参数据对所述变量类脚本进行脚本预热。Step 202: Start an asynchronous thread, and perform script preheating on the variable script according to the input parameter data.
基于前述步骤201,系统在获取到所述入参数据后,可以启动异步线程根据所述入参数据对模型对应的变量类脚本进行脚本预热。在本实施例中,采用异步线程进行预热,在预热未完成时,也不会影响变量类脚本的正常调用。Based on the foregoing step 201, after acquiring the input parameter data, the system may start an asynchronous thread to preheat the script of the variable class corresponding to the model according to the input parameter data. In this embodiment, an asynchronous thread is used for preheating, and the normal invocation of the variable script will not be affected when the preheating is not completed.
在本步骤中,系统会在变量类脚本预热的过程中,将解释器翻译好的机器可识别的指令存储在缓存中,比如:内存,以便后续该变量类脚本第一次执行时,可以从缓存中读取翻译好的机器可识别的指令,节省翻译时间,进而缩短调用耗时。In this step, the system will store the machine-identifiable instructions translated by the interpreter in the cache during the warm-up process of the variable script, such as memory, so that when the variable script is executed for the first time, it can be Read the translated machine-identifiable instructions from the cache, saving translation time, and thus shortening the call time.
步骤203,在预热完毕或到达预设的预热时长时,允许执行所述变量类脚本。Step 203: When the preheating is completed or a preset preheating time period is reached, the variable class script is allowed to be executed.
在本实施例中,系统可以在变量类脚本预热完毕后,允许执行所述变量类脚本,比如:系统可以在变量类脚本预热完毕后,与外围系统建立连接,并开始接收外围系统发送的需要执行变量类脚本的业务数据。In this embodiment, the system can allow the variable script to be executed after the variable script is warmed up. For example, the system can establish a connection with the peripheral system after the variable script is warmed up, and start to receive the transmission from the peripheral system. The business data that needs to execute variable class scripts.
在本实施例中,系统在到达所述预设时长后,允许执行变量类脚本。举例来说,系统在重新启动后,可以获取本地保存的模型相关的历史数据以作为入参数据,然后根据所述入参数据对变量类脚本进行脚本预热,当到达所述预热时长时,开始允许执行所述变量类脚本。其中,所述预热的时长可以由开发人员或者管理人员进行设置,比如:开发人员或者管理人员可以将所述预热的时长设置为所有变量类脚本中预热速度最慢的变量类脚本的预热耗时,以使得在到达所述预热的时长时,所有变量类脚本都能够预热完毕。In this embodiment, the system allows the execution of the variable script after the preset time period is reached. For example, after the system is restarted, it can obtain the locally saved model-related historical data as input parameter data, and then preheat the script of the variable class according to the input parameter data. When the warm-up time is reached , start allowing execution of the variable class script. The warm-up duration can be set by developers or managers, for example, developers or managers can set the warm-up duration to the variable script with the slowest warm-up speed among all variable scripts. The preheating takes time, so that when the preheating time period is reached, all the variable class scripts can be preheated.
由此可以看出,本实施例系统根据真实的历史数据进行变量类脚本的预热,并在变量类脚本预热完毕以后,允许执行所述变量类脚本,以便能够在使用真实的业务数据第一次执行变量类脚本前,缓存变量类脚本的机器可识别的指令,进而缩短脚本在第一次执行时的执行耗时,降低系统间调用的超时比例。It can be seen from this that the system in this embodiment preheats the variable script according to the real historical data, and allows the variable script to be executed after the preheating of the variable script is completed, so that the real business data can be used for the first time. Before executing the variable script once, the machine-identifiable instructions of the variable script are cached, thereby shortening the execution time of the script when it is executed for the first time, and reducing the timeout ratio of calls between systems.
步骤204,在接收到业务数据时,主线程执行所述业务数据所属模型的变量类脚本。Step 204, when receiving the business data, the main thread executes the variable class script of the model to which the business data belongs.
基于前述步骤203,系统在允许业务数据对变量类脚本进行调用后,就可以开始接收真实的业务数据。当接收到业务数据时,主线程执行与所述业务数据所属模型对应的变量类脚本。Based on the foregoing step 203, the system can start to receive real business data after allowing the business data to call the variable class script. When receiving business data, the main thread executes the variable class script corresponding to the model to which the business data belongs.
步骤205,在执行完毕后,获取执行耗时,判断所述执行耗时是否大于预设的阈值,若是,则执行步骤206。Step 205: After the execution is completed, the execution time is obtained, and it is judged whether the execution time is greater than a preset threshold, and if so, step 206 is executed.
基于前述步骤204,当变量类脚本执行完毕后,可以开始进行历史数据的更新的过程。具体地,在本步骤中,在变量类脚本执行完毕后,判断执行所述变量类脚本的执行耗时是否大于预设的阈值。其中,所述预设的阈值可以由开发人员或者管理人员根据能够接受的执行时长进行设置,比如:可以将所述预设的阈值设置为100ms。当执行所述变量类脚本的执行耗时小于或者等于所述预设的阈值时,说明变量类脚本预热的效果较好,结束当前流程。当所述变量类脚本的执行耗时大于所述预设的阈值时,执行步骤206。Based on the foregoing step 204, after the variable class script is executed, the process of updating the historical data can be started. Specifically, in this step, after the execution of the variable script is completed, it is determined whether the execution time of executing the variable script is greater than a preset threshold. Wherein, the preset threshold may be set by developers or managers according to an acceptable execution duration, for example, the preset threshold may be set as 100ms. When the execution time of executing the variable type script is less than or equal to the preset threshold, it means that the effect of preheating the variable type script is better, and the current process ends. When the execution time of the variable script is greater than the preset threshold, step 206 is performed.
步骤206,开启异步线程,将所述业务数据作为所属模型的历史数据保存在本地,以更新所属模型相关的历史数据。In step 206, an asynchronous thread is started, and the business data is saved locally as the historical data of the belonging model, so as to update the historical data related to the belonging model.
基于前述步骤205的判断结果,当所述变量类脚本的执行耗时大于所述预设的阈值时,说明变量类脚本的预热效果较差,可能存在所述变量类脚本的某些分支没有被预热到的问题,所以在本步骤中,系统将所述业务数据作为所述变量类脚本所属模型相关的历史数据保存在本地,以更新所述模型相关的历史数据,这样,在下次系统重启的时候能够预热到更多的变量类脚本分支。同时,为节省存储空间,还可以将所述模型相关的历史数据中保存时间最早的历史数据删除。Based on the judgment result of the foregoing step 205, when the execution time of the variable script is greater than the preset threshold, it indicates that the warm-up effect of the variable script is poor, and there may be some branches of the variable script that do not is preheated to the problem, so in this step, the system saves the business data locally as the historical data related to the model to which the variable class script belongs to update the historical data related to the model. In this way, the next time the system When restarting, it can warm up to more variable class script branches. At the same time, in order to save storage space, the historical data with the earliest storage time among the historical data related to the model may also be deleted.
可选的,在一个例子中,当新的模型发布时,由于该模型对应的变量类脚本没有被调用过,所以本地尚未保存该模型相关的历史数据。此时,可以保存该模型相关的历史数据。具体地,在接收到针对新模型的业务数据后,主线程执行所述新模型对应的变量类脚本,并在执行完毕后,将所述业务数据作为该新模型的历史数据保存在本地,直到本地保存的该新模型相关的历史数据到达预设的数量,比如:10条等。Optionally, in an example, when a new model is released, since the variable class script corresponding to the model has not been called, historical data related to the model has not been saved locally. At this point, historical data related to the model can be saved. Specifically, after receiving the business data for the new model, the main thread executes the variable class script corresponding to the new model, and after the execution, saves the business data locally as the historical data of the new model, until The locally saved historical data related to the new model reaches a preset number, such as 10 pieces, etc.
下面举例来描述前述模型相关历史数据的保存以及更新的实现过程。The implementation process of saving and updating the above-mentioned model-related historical data is described below with an example.
当新模型发布时,由于系统未执行过该新模型对应的变量类脚本,所以本地没有保存过该新模型相关的历史数据。在该新模型对应的变量类脚本第一次执行完毕后,系统确认本地保存的所述新模型相关的历史数据的数量为0,所以系统可以将第一次执行该变量类脚本时的使用业务数据作为历史数据保存在本地,同时保存所述历史数据和所述模型名称的对应关系。When a new model is released, since the system has not executed the variable class script corresponding to the new model, the historical data related to the new model has not been saved locally. After the variable script corresponding to the new model is executed for the first time, the system confirms that the number of historical data related to the new model saved locally is 0, so the system can use the business when the variable script is executed for the first time. The data is saved locally as historical data, and the corresponding relationship between the historical data and the model name is also saved.
假设,预设的数量为10,则在该模型对应的变量类脚本前十次执行完毕后,系统会将每次使用的业务数据都保存在本地。在该脚本第十一次执行完毕后,系统判断本次执行耗时是否大于预设的阈值,如果本次执行耗时大于所述阈值,则系统将第十一次执行该脚本时的使用业务数据作为该新模型相关的历史数据保存在本地,并删除本地保存的第一次使用的业务数据。Assuming that the preset number is 10, after the first ten executions of the variable class script corresponding to the model are completed, the system will save the business data used each time locally. After the script is executed for the eleventh time, the system determines whether the execution time is greater than the preset threshold. The data is saved locally as the historical data related to the new model, and the first-used business data saved locally is deleted.
与前述脚本预热方法的实施例相对应,本申请还提供了脚本预热装置的实施例。Corresponding to the foregoing embodiments of the script preheating method, the present application further provides an embodiment of a script preheating apparatus.
本申请脚本预热装置的实施例可以应用在服务器或者终端上。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在服务器或者终端的处理器将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,如图3所示,为本申请脚本预热装置所在服务器或者终端的一种硬件结构图,除了图3所示的处理器、内存、网络接口、以及非易失性存储器之外,实施例中装置所在的服务器或者终端通常根据该服务器或者终端的实际功能,还可以包括其他硬件,对此不再赘述。The embodiment of the script preheating apparatus of the present application may be applied to a server or a terminal. The apparatus embodiment may be implemented by software, or may be implemented by hardware or a combination of software and hardware. Taking software implementation as an example, a device in a logical sense is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory through the processor of the server or terminal where the device is located. From the perspective of hardware, as shown in FIG. 3 , it is a hardware structure diagram of the server or terminal where the script preheating device of the present application is located, except for the processor, memory, network interface, and non-volatile memory shown in FIG. 3 In addition, the server or terminal where the apparatus is located in the embodiment generally may also include other hardware according to the actual function of the server or terminal, which will not be repeated here.
图4是本申请一示例性实施例示出的一种脚本预热装置的结构示意图。FIG. 4 is a schematic structural diagram of a script preheating apparatus according to an exemplary embodiment of the present application.
请参考图4,所述脚本预热装置300可以包括:获取单元301、预热单元302、允许单元303、执行单元304、更新单元305以及保存单元306。Referring to FIG. 4 , the script preheating apparatus 300 may include: an acquiring
其中,所述获取单元301,在系统启动或模型更新时,获取本地保存的模型相关的历史数据,作为所述模型对应的变量类脚本的入参数据;Wherein, the obtaining
所述预热单元302,根据所述入参数据,对所述变量类脚本进行脚本预热。The preheating
可选的,所述获取单元301,具体根据模型名称获取本地保存的与所述模型相关的历史数据。Optionally, the acquiring
可选的,所述预热单元302,具体启动异步线程,对所述变量类脚本进行脚本预热。Optionally, the preheating
所述允许单元303,在预热完毕或是到达预设的预热时长时,允许执行所述变量类脚本;The allowing
所述执行单元304,在接收到业务数据时,主线程执行所述业务数据所属模型的变量类脚本;The
所述更新单元305,在执行完毕后,获取执行耗时,判断所述执行耗时是否大于预设阈值,若是,则开启异步线程,将所述业务数据作为所属模型的历史数据保存在本地,以更新模型相关的历史数据。The updating
所述保存单元306,用于保存模型相关的历史数据;The saving
所述保存单元306,具体在接收到业务数据时,主线程执行所述业务数据所属模型的变量类脚本;在执行完毕后,将所述业务数据作为所属模型的历史数据保存在本地,直到本地保存的所属模型相关的历史数据到达预设的数量。The saving
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。For details of the implementation process of the functions and functions of each unit in the above device, please refer to the implementation process of the corresponding steps in the above method, which will not be repeated here.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本申请方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。For the apparatus embodiments, since they basically correspond to the method embodiments, reference may be made to the partial descriptions of the method embodiments for related parts. The device embodiments described above are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed over multiple network elements. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the present application. Those of ordinary skill in the art can understand and implement it without creative effort.
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the present application. within the scope of protection.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510680703.8ACN106598687B (en) | 2015-10-19 | 2015-10-19 | Script preheating method and device |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510680703.8ACN106598687B (en) | 2015-10-19 | 2015-10-19 | Script preheating method and device |
| Publication Number | Publication Date |
|---|---|
| CN106598687A CN106598687A (en) | 2017-04-26 |
| CN106598687Btrue CN106598687B (en) | 2020-01-21 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510680703.8AExpired - Fee RelatedCN106598687B (en) | 2015-10-19 | 2015-10-19 | Script preheating method and device |
| Country | Link |
|---|---|
| CN (1) | CN106598687B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110413395A (en)* | 2019-07-30 | 2019-11-05 | 中国工商银行股份有限公司 | Service call pre-heating mean, device, equipment and storage medium |
| CN114138357B (en)* | 2021-10-29 | 2024-09-20 | 北京达佳互联信息技术有限公司 | Request processing method and device, electronic equipment, storage medium and product |
| CN114782179A (en)* | 2022-04-02 | 2022-07-22 | 中国建设银行股份有限公司 | Server preheating method, system, electronic equipment and storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101257538A (en)* | 2008-03-25 | 2008-09-03 | 华为技术有限公司 | A method and device for processing requests in a browser |
| CN104820610A (en)* | 2015-05-14 | 2015-08-05 | 华中科技大学 | Method for updating virtual machine image in cloud environment |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8065684B2 (en)* | 2008-04-10 | 2011-11-22 | Dell Products L.P. | Automated scripting methods and media |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101257538A (en)* | 2008-03-25 | 2008-09-03 | 华为技术有限公司 | A method and device for processing requests in a browser |
| CN104820610A (en)* | 2015-05-14 | 2015-08-05 | 华中科技大学 | Method for updating virtual machine image in cloud environment |
| Publication number | Publication date |
|---|---|
| CN106598687A (en) | 2017-04-26 |
| Publication | Publication Date | Title |
|---|---|---|
| US8065659B1 (en) | Method and apparatus for executing scripts within a web browser | |
| CN105872016B (en) | Operation method of virtual machine in desktop cloud | |
| WO2020024408A1 (en) | Test device, test method and storage medium | |
| CN103617057B (en) | Application program installation method and device | |
| CN106055388A (en) | A cloud platform application automatic deployment framework | |
| CN107145359A (en) | A kind of BMC changes the optimization method of BIOS option | |
| CN110321253A (en) | Method and apparatus for Backup Data | |
| CN106598687B (en) | Script preheating method and device | |
| CN113961520B (en) | Dynamic file mounting method, system, computer equipment and readable storage medium | |
| CN103631869B (en) | A kind of method and apparatus for alleviating server-side database access pressure | |
| CN105159703B (en) | The method and system of factory reset | |
| CN113986361B (en) | Out-of-band setting method, system and related device for BIOS options | |
| CN110109628B (en) | Data reconstruction method, device, equipment and storage medium of distributed storage system | |
| WO2021169639A1 (en) | Method, system and device for bmc customization, and readable storage medium | |
| CN115951949A (en) | Method, device and computing device for recovering configuration parameters of BIOS | |
| WO2021143398A1 (en) | Software management method and apparatus, and management device and storage medium | |
| WO2017020460A1 (en) | Method and apparatus for integrating plugin | |
| WO2023060893A1 (en) | Storage space management method and apparatus, and device and storage medium | |
| CN106293790B (en) | Application program upgrading method and device based on Firefox operating system | |
| WO2022083190A1 (en) | Data downloading method and apparatus, computer device, and storage medium | |
| WO2019136843A1 (en) | Method, storage medium, device and system for starting page in android system | |
| CN110442493B (en) | Automatic service management system and method | |
| WO2017096889A1 (en) | Method and device for upgrading and downgrading system | |
| CN118113368A (en) | TCP socket extension option setting method, system, equipment and storage medium | |
| CN111241553A (en) | BIOS (basic input output System) permission setting method, device, equipment and storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| TR01 | Transfer of patent right | ||
| TR01 | Transfer of patent right | Effective date of registration:20200922 Address after:Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands Patentee after:Innovative advanced technology Co.,Ltd. Address before:Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands Patentee before:Advanced innovation technology Co.,Ltd. Effective date of registration:20200922 Address after:Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands Patentee after:Advanced innovation technology Co.,Ltd. Address before:A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands Patentee before:Alibaba Group Holding Ltd. | |
| CF01 | Termination of patent right due to non-payment of annual fee | Granted publication date:20200121 |