[go: up one dir, main page]

CN114443250A - Method and terminal for optimizing application starting speed - Google Patents

Method and terminal for optimizing application starting speed Download PDF

Info

Publication number
CN114443250A
CN114443250A CN202210076802.5A CN202210076802A CN114443250A CN 114443250 A CN114443250 A CN 114443250A CN 202210076802 A CN202210076802 A CN 202210076802A CN 114443250 A CN114443250 A CN 114443250A
Authority
CN
China
Prior art keywords
instance
initial data
version number
restarted
application version
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210076802.5A
Other languages
Chinese (zh)
Inventor
刘德建
张海祥
陈宏�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Tianquan Educational Technology Ltd
Original Assignee
Fujian Tianquan Educational Technology Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Tianquan Educational Technology Ltd filed Critical Fujian Tianquan Educational Technology Ltd
Priority to CN202210076802.5A priority Critical patent/CN114443250A/en
Publication of CN114443250A publication Critical patent/CN114443250A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1417Boot up procedures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1433Saving, restoring, recovering or retrying at system level during software upgrading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/481Exception handling

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a method and a terminal for optimizing application starting speed, wherein the method comprises the following steps: when the distributed system is restarted, acquiring a first instance needing to be restarted, and storing first initial data of the first instance into a preset cache; the first initial data includes an application version number; acquiring a second instance to be restarted, judging whether the type and the application version number of the second instance are the same as those of the first instance, and if so, inquiring whether the corresponding first initial data exists in the preset cache through the application version number; if yes, directly obtaining the first initial data, and restarting the second instance according to the first initial data; in the upgrading and restarting process of the distributed application deployment system, the second instance can directly acquire the initialized first initial data of the first instance, and the time for loading the related data from the database one by other instances is reduced, so that the starting time of a large number of instances is reduced, and the operation and maintenance efficiency of the whole system is improved.

Description

Method and terminal for optimizing application starting speed
Technical Field
The invention relates to the field of computers, in particular to a method and a terminal for optimizing application starting speed.
Background
At present, in many business systems or software, there are various data, such as some configuration information, some frequently used data information, or some commonly used important data. There is a place to store in the face of these frequently used data. Under normal conditions, a general system stores the data in a uniform place, such as a database, however, a new software dependency is introduced, and many systems or software directly place the important information in a local memory; at each system start, the relevant information is generally queried from the database and loaded into the local memory.
In the foregoing scenario, when a program is started, restarted or reloaded to the local memory due to a downtime or other abnormal conditions, the program needs to load relevant data from the database one by one, and then write the relevant data into the local memory again. When the data volume is small, the above method has little influence on the restart speed, but when the data volume is large or the database table needs to be queried for many times, the program is started very slowly, the overall use function is affected, and currently, most application deployments of the server side are distributed, so that each application in the server side needs to be started for one round of database data query, which consumes more time.
For example, a distributed system adopts a deployment mode that Nginx (a high-performance HTTP and reverse proxy Web server, Engine X) is matched with 6 Tomcat (a free Web application server with open source codes) instances to carry out graceful restart or upgrade, only one instance is restarted or upgraded at each time of the graceful restart or upgrade, and when all the instances are restarted or upgraded completely, the restart or upgrade is finished in the current round; each instance in the system is restarted, related data is loaded from the database one by one and written into a local memory for data initialization, 5 minutes is expected to be consumed when each instance is restarted or upgraded, and 30 minutes is expected to be consumed when the restart or upgrade is finished in the current round.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the method and the terminal for optimizing the application starting speed are provided, the application starting time is shortened, and the operation and maintenance efficiency is improved.
In order to solve the technical problems, the invention adopts the technical scheme that:
a method of optimizing application launch speed, comprising the steps of:
when the distributed system is restarted, acquiring a first instance needing to be restarted, and storing first initial data of the first instance into a preset cache;
the first initial data includes an application version number;
acquiring a second instance to be restarted, judging whether the type and the application version number of the second instance are the same as those of the first instance, and if so, inquiring whether the corresponding first initial data exists in the preset cache through the application version number;
and if so, directly acquiring the first initial data, and restarting the second instance according to the first initial data.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a terminal for optimizing application launch speed, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
when the distributed system is restarted, acquiring a first instance needing to be restarted, and storing first initial data of the first instance into a preset cache;
the first initial data includes an application version number;
acquiring a second instance to be restarted, judging whether the type and the application version number of the second instance are the same as those of the first instance, and if so, inquiring whether the corresponding first initial data exists in the preset cache through the application version number;
and if so, directly acquiring the first initial data, and restarting the second instance according to the first initial data.
The invention has the beneficial effects that: the method provides a new mode for loading data when an application is started, and initialization data is stored and inquired through the application version number; when the system is started or upgraded for the first time, the first instance is started or upgraded for the first time, and the mode of the old logic is still adopted: loading relevant data one by one from a database, generating first initial data, writing the first initial data into a preset cache, and directly acquiring the initialized first initial data from the preset cache through the application version number when a subsequent second instance with the same type and the same application version number is started or upgraded without repeating the step of loading the relevant data one by one from the database when each instance is restarted; in the upgrading and restarting process of the distributed application deployment system, the second instance needing to be restarted directly obtains the first initial data of the initialized first instance, and the time for loading relevant data from the database one by other instances needing to be restarted is reduced, so that the starting time of a large number of instances is reduced, and the operation and maintenance efficiency of the whole system is improved.
Drawings
FIG. 1 is a flowchart illustrating a method for optimizing application start-up speed according to the present invention;
fig. 2 is a schematic structural diagram of a terminal for optimizing application start speed according to the present invention.
Description of reference numerals:
1. a memory; 2. a processor; 3. a terminal for optimizing application start-up speed.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
Referring to fig. 1, a method for optimizing application start-up speed includes the steps of:
when the distributed system is restarted, acquiring a first instance needing to be restarted, and storing first initial data of the first instance into a preset cache;
the first initial data includes an application version number;
acquiring a second instance to be restarted, judging whether the type and the application version number of the second instance are the same as those of the first instance, and if so, inquiring whether the corresponding first initial data exists in the preset cache through the application version number;
and if so, directly acquiring the first initial data, and restarting the second instance according to the first initial data.
From the above description, the beneficial effects of the present invention are: the method provides a new mode for loading data when an application is started, and initialization data is stored and inquired through the application version number; when the system is started or upgraded for the first time, the first instance is started or upgraded for the first time, and the mode of the old logic is still adopted: loading relevant data one by one from a database, generating first initial data, writing the first initial data into a preset cache, and directly acquiring the initialized first initial data from the preset cache through the application version number when a subsequent second instance with the same type and the same application version number is started or upgraded without repeating the step of loading the relevant data one by one from the database when each instance is restarted; in the upgrading and restarting process of the distributed application deployment system, the second instance needing to be restarted directly obtains the first initial data of the initialized first instance, and the time for loading relevant data from the database one by other instances needing to be restarted is reduced, so that the starting time of a large number of instances is reduced, and the operation and maintenance efficiency of the whole system is improved.
Further, determining whether the type and the application version number of the second instance are the same as those of the first instance, and if so, querying whether the corresponding first initial data exists in the preset cache according to the application version number includes:
if the second instance is different from the first instance in type or application version number, second initial data of the second instance is obtained and stored in a preset cache, and the second instance is restarted according to the second initial data.
As can be seen from the above description, the application version number can distinguish when different types of applications are released or upgraded, and each release or upgrade of an application represents an update of the initial data; therefore, the initial data is stored by the application version number, the data can be directly and effectively distinguished, even the application belonging to the gray release can directly inquire the application version number for distinguishing, and the accuracy of obtaining the initial data is greatly improved; under the condition that corresponding initial data is not inquired, the restart instance can be used as a first restart instance of the application type and the application version number, second initial data is obtained and stored in a preset cache, and if other instances of the same application type and the same application version number need to be restarted subsequently, the initial data can be directly obtained, so that the time for loading relevant data from a database by other instances needing to be restarted is reduced, and the restart speed of the application version number instance is accelerated; the gray scale distribution refers to a distribution mode capable of smoothly transiting between black and white, and the distribution of the application gradually expands the application group range.
Further, when the first instance or the second instance is restarted, the application version number is updated.
As can be seen from the above description, the direct restart and the graceful restart are different application scenarios: the graceful restart is different from direct restart, and the graceful restart can restart service under the condition that a user is not influenced so as to reload an application program and complete updating of a system service code; under the condition of smooth restart, only one example is restarted each time, and when all the examples are restarted, the restart is finished; therefore, in the restarting process, new and old initial data are stored in a preset cache: at this time, the restarted first instance needs to obtain updated initial data, the second instance to be restarted needs to obtain the initial data before updating, and the updated initial data needs to be obtained when the second instance is restarted; and updating the application version number according to the restarting condition of the example, so that the smoothly restarted application scene can inquire and store data through the application version number.
Further, storing the first initial data of the first application into a preset cache includes: assembling the first initial data according to a preset rule and then storing the first initial data into the preset cache; the preset rule includes setting an expiration time of the application version number.
As can be seen from the above description, the amount of data stored in the preset cache is large and the data type is complex, so that the data stored in the preset cache needs to be managed in a unified manner and in a unified storage manner and format, so that the first initial data or the second initial data can be correctly and orderly stored in the preset cache, and the process of querying the data is ensured to be orderly, stable and rapid; and setting expiration time for the application version number, periodically clearing invalid data in the preset cache, releasing the cache memory, and avoiding the situation that the data in the cache is still quoted as dirty data after the data in the database is updated.
Further, after storing the second initial data of the second instance in a preset buffer, the method further includes: and judging whether the information that the restart of the first instance is completed is acquired, and if so, deleting the first initial data in the preset cache.
As can be seen from the above description, the method for clearing invalid data further includes storing the initial data in the preset cache until the latest data is released and the old data is uniformly invalidated; after the first instance is restarted, other instances needing to be restarted can acquire data through the restarted first instance, therefore, the information of the first instance which is finished restarting is obtained as the identification, the preset cache is kept, and as long as the application version number is unchanged, the other instances read corresponding data from the preset cache every time until the first instance finishes restarting to acquire the latest initial data and store the latest initial data into the preset cache, the old data is unified and invalid, and the latest data can be acquired from the database when the first instance is restarted next time.
Referring to fig. 2, a terminal for optimizing application start-up speed includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the following steps:
when the distributed system is restarted, acquiring a first instance needing to be restarted, and storing first initial data of the first instance into a preset cache;
the first initial data includes an application version number;
acquiring a second instance to be restarted, judging whether the type and the application version number of the second instance are the same as those of the first instance, and if so, inquiring whether the corresponding first initial data exists in the preset cache through the application version number;
and if so, directly acquiring the first initial data, and restarting the second instance according to the first initial data.
From the above description, the beneficial effects of the present invention are: the method provides a new mode for loading data when an application is started, and initialization data is stored and inquired through the application version number; when the system is started or upgraded for the first time, the first instance is started or upgraded for the first time, and the mode of the old logic is still adopted: loading related data from a database one by one, generating first initial data, writing the first initial data into a preset cache, and directly acquiring the initialized first initial data from the preset cache through the application version number when a subsequent second instance of the same type and application version number is started or upgraded, without repeating the step of loading the related data from the database one by one when each instance is restarted; in the upgrading and restarting process of the distributed application deployment system, the second instance needing to be restarted directly obtains the first initial data of the initialized first instance, and the time for loading relevant data from the database one by other instances needing to be restarted is reduced, so that the starting time of a large number of instances is reduced, and the operation and maintenance efficiency of the whole system is improved.
Further, determining whether the type and the application version number of the second instance are the same as those of the first instance, and if so, querying whether the corresponding first initial data exists in the preset cache according to the application version number includes:
if the second instance is different from the first instance in type or application version number, second initial data of the second instance is obtained and stored in a preset cache, and the second instance is restarted according to the second initial data.
As can be seen from the above description, the application version number can distinguish when different types of applications are released or upgraded, and each release or upgrade of an application represents an update of the initial data; therefore, the initial data is stored by the application version number, the data can be directly and effectively distinguished, even the application belonging to the gray release can directly inquire the application version number for distinguishing, and the accuracy of obtaining the initial data is greatly improved; under the condition that corresponding initial data is not inquired, the restart instance can be used as a first restart instance of the application type and the application version number, second initial data is obtained and stored in a preset cache, and if other instances of the same application type and the same application version number need to be restarted subsequently, the initial data can be directly obtained, so that the time for loading relevant data from a database by other instances needing to be restarted is reduced, and the restart speed of the application version number instance is accelerated; the gray release refers to a release mode capable of smoothly transiting between black and white, and the release of the application gradually expands the application group range.
Further, when the first instance or the second instance is restarted, the application version number is updated.
As can be seen from the above description, the direct restart and the graceful restart are different application scenarios: the graceful restart is different from direct restart, and the graceful restart can restart service under the condition that a user is not influenced so as to reload an application program and complete updating of a system service code; under the condition of smooth restart, only one example is restarted each time, and when all the examples are restarted, the restart is finished; therefore, in the restarting process, new and old initial data are stored in a preset cache: at this time, the restarted first instance needs to obtain updated initial data, the second instance to be restarted needs to obtain the initial data before updating, and the updated initial data needs to be obtained when the second instance is restarted; and updating the application version number according to the restarting condition of the example, so that the smoothly restarted application scene can inquire and store data through the application version number.
Further, storing the first initial data of the first application into a preset cache includes: assembling the first initial data according to a preset rule and then storing the first initial data into the preset cache; the preset rule includes setting an expiration time of the application version number.
As can be seen from the above description, the amount of data stored in the preset cache is large and the data type is complex, so that the data stored in the preset cache needs to be managed in a unified manner and in a unified storage manner and format, so that the first initial data or the second initial data can be correctly and orderly stored in the preset cache, and the process of querying the data is ensured to be orderly, stable and rapid; and setting an expiration time for the application version number, regularly clearing invalid data in the preset cache, releasing the cache memory, and avoiding the situation that the data in the cache is still referred as dirty data after the data in the database is updated.
Further, after storing the second initial data of the second instance in a preset buffer, the method further includes: and judging whether the information that the restart of the first instance is completed is acquired, and if so, deleting the first initial data in the preset cache.
As can be seen from the above description, the method for clearing invalid data further includes storing the initial data in the preset cache until the latest data is released and the old data is uniformly invalidated; after the first instance is restarted, other instances needing to be restarted can acquire data through the restarted first instance, therefore, the information of the first instance which is finished restarting is obtained as the identification, the preset cache is kept, and as long as the application version number is unchanged, the other instances read corresponding data from the preset cache every time until the first instance finishes restarting to acquire the latest initial data and store the latest initial data into the preset cache, the old data is unified and invalid, and the latest data can be acquired from the database when the first instance is restarted next time.
The method for optimizing the application starting speed provided by the invention can be applied to a scene of direct restart or upgrade of a distributed system, the application starting time is reduced, and the operation and maintenance efficiency is improved, and is described in combination with specific embodiments as follows:
referring to fig. 1, a first embodiment of the present invention is:
s11, when the distributed system is restarted, namely when a distributed system restart signal is received, acquiring a first instance to be restarted, and storing first initial data of the first instance into a preset cache; wherein the first initial data includes an application version number;
in S11, storing the first initial data of the first application into a preset buffer includes:
s111, assembling the first initial data according to a preset rule and then storing the first initial data into a preset cache, and setting the expiration time of the application version number of the first initial data;
s12, acquiring a second instance to be restarted, judging whether the type and the application version number of the second instance are the same as those of the first instance, if so, executing S121, and if not, executing S122;
in an alternative embodiment, after receiving the signal that the restart of the first instance is completed, S12 is executed;
s121, inquiring whether the preset cache has the corresponding first initial data or not through the application version number; if so, directly acquiring the first initial data, and restarting the second instance according to the first initial data, otherwise, executing S122;
s122, acquiring second initial data of a second instance, assembling the second initial data according to a preset rule, storing the second initial data into a preset cache, and restarting the second instance according to the second initial data;
s13, if the application version number of the first initial data reaches the expiration time or the information of the completion of the restart of the first instance is received, deleting the data corresponding to the corresponding application version number in the preset cache, wherein the corresponding application version number is the application version number reaching the expiration time or the application version number corresponding to the restart of the first instance;
s14, repeatedly executing S12 until a signal that the distributed system is restarted is received;
the first instance represents a first instance for restarting the application version number in the system, and the second instance represents other instances to be restarted in the system;
in an optional implementation manner, the distributed system adopts a smooth restart or upgrade manner, and updates the application version number when the first instance or the second instance is restarted.
The second embodiment of the invention is as follows:
the method for optimizing the application starting speed is applied to specific scenes:
setting a distributed system, adopting a deployment mode that Nginx is matched with 6 Tomcat instances, and carrying out graceful restart or upgrade to optimize the restart speed of the system;
s21, when the distributed system is restarted, a distributed system restart signal is received, a first instance needing to be restarted is obtained, and first initial data of the first instance are stored in a preset cache, wherein the first initial data comprise an application version number;
in S21, storing the first initial data of the first instance in a preset buffer includes:
s211, assembling the first initial data according to a preset rule, storing the first initial data into a preset cache, and setting the expiration time of the application version number of the first initial data;
in S11, the assembling the first initial data according to a preset rule and then storing the first initial data in the preset cache specifically includes: assembling initial data loaded one by one from a database according to a preset rule and then storing the initial data in the preset cache; the preset rule comprises the steps of storing initial data in an MAP format, storing an application version number of the initial data by using a Key, storing a specific data type of the initial data by using a Field, storing a Json string of the initial data by using a Value, and setting the expiration time of the application version number Key of the initial data;
in this embodiment, the expiration time of the application version number Key of the first initial data is set to 30 minutes;
in an optional implementation mode, the expiration time of the application version number Key is set according to the total time of the distributed system for completing system restart or upgrade by adopting the method in the prior art;
s22, receiving a signal that a first instance is restarted, acquiring a second instance to be restarted, judging whether the type and the application version number of the second instance and the first instance are the same, if so, executing S221, and if the type or the application version number of the second instance is different from those of the first instance, executing S222;
s221, inquiring whether the preset cache has the corresponding first initial data or not through the application version number; if yes, directly obtaining the first initial data, and restarting the second instance according to the first initial data; if not, executing S222;
s222, obtaining second initial data of a second instance, assembling the second initial data according to a preset rule, storing the second initial data into a preset cache, and restarting the second instance according to the second initial data;
s23, if the application version number of the first initial data reaches the expiration time or the information of the completion of the restart of the first instance is received, deleting the data corresponding to the corresponding application version number in the preset cache, wherein the corresponding application version number is the application version number reaching the expiration time or the application version number corresponding to the restart of the first instance;
s24, repeatedly executing S22 until a signal that the distributed system is restarted is received;
the beneficial effects of the second embodiment:
in the embodiment, the 6 instances all acquire the initial data of the same application version number, only the first instance needs to take 5 minutes, and the rest of the second instances to be restarted can directly acquire the first initial data according to the restarted first instance, so that the restarting time of the second instances is necessarily less than 5 minutes; in the embodiment, 2 instances exist in 6 instances, which belong to gray scale issue, and the restart time of the two instances is inevitably less than 10 minutes; therefore, the whole system is restarted for less than 30 minutes, the starting time of the whole system is reduced accumulatively, and the operation and maintenance efficiency of the system is improved.
The third embodiment of the invention is as follows:
a method for optimizing application start-up speed, which is different from the first embodiment in that: the distributed system adopts a smooth restart or upgrade mode, and updates the application version number when the first instance or the second instance is restarted, specifically including:
s31, receiving a graceful restart signal of the distributed system, acquiring a first instance needing to be restarted, and storing first initial data of the first instance into a preset cache, wherein the first initial data comprises an application version number;
in S31, acquiring the first instance to be restarted includes:
s311, setting an application version number of a first example to be restarted to be 1, wherein the application version number is a combination of a normal application version number and an example restarting batch number, and the application version number set to be 1 in the present situation refers to the example restarting batch number set to be 1;
s312, assembling the first initial data according to a preset rule, storing the first initial data into a preset cache, and setting the expiration time of the application version number of the first initial data;
s32, when a signal that the first instance is restarted is received, acquiring a second instance to be restarted;
s33, determining whether the type and the normal application version number of the second instance are the same as those of the first instance, if so, executing S331, and if not, executing S332;
s331, querying the corresponding first initial data in the preset cache through the normal application version number, acquiring the first initial data with the maximum restart batch number, restarting the second instance according to the first initial data, and increasing the restart batch number of the restarted second instance;
s332, acquiring second initial data of a second instance, storing the second initial data into a preset cache, restarting the second instance according to the second initial data, and increasing the restart batch number of the restarted second instance;
in an alternative embodiment, the instance restart batch number is incremented according to the number of restarts of the instance;
s34, if the application version number of the first initial data reaches the expiration time or the information of the completion of the restart of the first instance is received, deleting the data corresponding to the corresponding application version number in the preset cache, wherein the corresponding application version number is the application version number reaching the expiration time or the application version number corresponding to the restart of the first instance;
s35, repeatedly executing S32 and S33 until a signal that the graceful restart of the distributed system is completed is received;
referring to fig. 2, a fourth embodiment of the present invention is:
a terminal 3 for optimizing application starting speed comprises a memory 1, a processor 2 and a computer program which is stored on the memory 1 and can run on the processor 2, wherein the steps in the first embodiment, the second embodiment or the third embodiment are realized when the processor 2 executes the computer program.
In summary, the method and the terminal for optimizing the application start speed provided by the invention provide a new way for loading data during application start, the initial data of the first instance to be started is loaded from the database and then stored in the preset cache, and then the instances to be started can directly acquire data from the preset cache according to the application version number, so that the time for loading relevant data from the database one by other is reduced, the start time of a large number of instances is reduced, and the operation and maintenance efficiency of the whole system is improved; the application version number used for storing and inquiring the initial data can be updated in time according to the number of times of restarting the instance, the data of restarting the instance each time is clearly distinguished, and the method can be applied to the scenes of directly restarting and upgrading the distributed system and is also suitable for the scenes of smoothly restarting and upgrading the distributed system; after the first instance is restarted, the first initial data in the preset cache can be deleted synchronously, the storage space in the preset cache is released, and the condition that the query and the acquisition of the latest data are influenced while old data occupy a cache memory is avoided.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method for optimizing application launch speed, comprising the steps of:
when the distributed system is restarted, acquiring a first instance needing to be restarted, and storing first initial data of the first instance into a preset cache;
the first initial data includes an application version number;
acquiring a second instance to be restarted, judging whether the type and the application version number of the second instance are the same as those of the first instance, and if so, inquiring whether the corresponding first initial data exists in the preset cache through the application version number;
and if so, directly acquiring the first initial data, and restarting the second instance according to the first initial data.
2. The method according to claim 1, wherein determining whether the type and the application version number of the second instance are the same as those of the first instance, and if so, querying whether the first initial data corresponding to the second instance exists in the preset cache according to the application version number comprises:
if the second instance is different from the first instance in type or application version number, second initial data of the second instance is obtained and stored in a preset cache, and the second instance is restarted according to the second initial data.
3. The method for optimizing application launch speed according to claim 1, further comprising: and updating the application version number when the first instance or the second instance is restarted.
4. The method of claim 1, wherein storing the first initial data of the first application into a predetermined buffer comprises: assembling the first initial data according to a preset rule and then storing the first initial data into the preset cache; the preset rule includes setting an expiration time of the application version number.
5. The method for optimizing application start-up speed according to claim 1, wherein after storing the second initial data of the second instance in a preset buffer, the method further comprises: and judging whether the information that the restart of the first instance is completed is acquired, and if so, deleting the first initial data in the preset cache.
6. A terminal for optimizing application launch speed, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
when the distributed system is restarted, acquiring a first instance needing to be restarted, and storing first initial data of the first instance into a preset cache;
the first initial data includes an application version number;
acquiring a second instance to be restarted, judging whether the type and the application version number of the second instance are the same as those of the first instance, and if so, inquiring whether the corresponding first initial data exists in the preset cache through the application version number;
and if so, directly acquiring the first initial data, and restarting the second instance according to the first initial data.
7. A terminal for optimizing application launch speed according to claim 6 wherein the processor when executing the computer program performs the steps of:
if the second instance is different from the first instance in type or application version number, second initial data of the second instance is obtained and stored in a preset cache, and the second instance is restarted according to the second initial data.
8. The terminal for optimizing application launching speed according to claim 6, wherein the processor, when executing the computer program, performs the following steps:
and updating the application version number when the first instance or the second instance is restarted.
9. A terminal for optimizing application launch speed according to claim 6 wherein the processor when executing the computer program performs the steps of:
assembling the first initial data according to a preset rule and then storing the first initial data into the preset cache;
the preset rule includes setting an expiration time of the application version number.
10. A terminal for optimizing application launch speed according to claim 6 wherein the processor when executing the computer program performs the steps of:
and judging whether the information that the restart of the first instance is completed is acquired, and if so, deleting the first initial data in the preset cache.
CN202210076802.5A 2022-01-24 2022-01-24 Method and terminal for optimizing application starting speed Pending CN114443250A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210076802.5A CN114443250A (en) 2022-01-24 2022-01-24 Method and terminal for optimizing application starting speed

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210076802.5A CN114443250A (en) 2022-01-24 2022-01-24 Method and terminal for optimizing application starting speed

Publications (1)

Publication Number Publication Date
CN114443250A true CN114443250A (en) 2022-05-06

Family

ID=81369483

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210076802.5A Pending CN114443250A (en) 2022-01-24 2022-01-24 Method and terminal for optimizing application starting speed

Country Status (1)

Country Link
CN (1) CN114443250A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103067484A (en) * 2012-12-25 2013-04-24 深圳市天维尔通讯技术有限公司 Method and system upgrading application program automatically
US20150149736A1 (en) * 2013-11-22 2015-05-28 Yong Sik Kwon Fast restart of applications using shared memory
CN106341402A (en) * 2016-08-30 2017-01-18 中国民生银行股份有限公司 Processing method based on multi-architecture distributed caching and processing device
US9563385B1 (en) * 2013-09-16 2017-02-07 Amazon Technologies, Inc. Profile-guided data preloading for virtualized resources
CN108572845A (en) * 2018-03-15 2018-09-25 华为技术有限公司 Upgrade method and related system of distributed microservice cluster

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103067484A (en) * 2012-12-25 2013-04-24 深圳市天维尔通讯技术有限公司 Method and system upgrading application program automatically
US9563385B1 (en) * 2013-09-16 2017-02-07 Amazon Technologies, Inc. Profile-guided data preloading for virtualized resources
US20150149736A1 (en) * 2013-11-22 2015-05-28 Yong Sik Kwon Fast restart of applications using shared memory
CN106341402A (en) * 2016-08-30 2017-01-18 中国民生银行股份有限公司 Processing method based on multi-architecture distributed caching and processing device
CN108572845A (en) * 2018-03-15 2018-09-25 华为技术有限公司 Upgrade method and related system of distributed microservice cluster

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
屠雪真;陈小强;: "分布式系统高效升级方法研究", 微型电脑应用, no. 06, 14 June 2019 (2019-06-14) *

Similar Documents

Publication Publication Date Title
CN107133234B (en) Method, device and system for updating cache data
CN110109958B (en) Cache processing method, device, equipment and computer readable storage medium
CN111353773B (en) Identification processing method and device, storage medium and electronic device
CN110704335A (en) Data reading and writing method and device based on asynchronous ring buffer
CN106874281B (en) Method and device for realizing database read-write separation
CN103559065B (en) Method and system for OTA (Over-the-Air Technology) upgrade
CN112306993B (en) Redis-based data reading method, device, equipment and readable storage medium
CN111654532B (en) Centralized management system, method and device for configuration files
CN112783866B (en) Data reading method, device, computer equipment and storage medium
CN113438275A (en) Data migration method and device, storage medium and data migration equipment
US10120791B2 (en) Data read apparatus, data read method, and storage medium storing data read program
CN104881454A (en) Updating method and system of parameter
CN113312412A (en) Statistical data acquisition method and device, electronic equipment and storage medium
US20240378043A1 (en) Operating System Upgrading Method, Electronic Device, Storage Medium, and Chip System
CN114020211B (en) Storage space management method, device, equipment and storage medium
CN114443250A (en) Method and terminal for optimizing application starting speed
CN112000850B (en) Method, device, system and equipment for processing data
CN114385171A (en) Execution method, device, computer device and storage medium of page development instruction
CN116048609A (en) Configuration file updating method, device, computer equipment and storage medium
CN110297673B (en) Method and storage medium for optimizing loading of memory data
CN113407209B (en) Configuration data updating method and device
CN109299035B (en) A kind of CHR file management method, system and computer readable storage medium
CN113064611A (en) Method for realizing data analysis software upgrading aiming at wireless equipment and updating method thereof
CN111796845A (en) Database upgrading method, state data query method, device and storage medium
WO2020219033A1 (en) Critical data storage

Legal Events

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