CN108667916B - Data access method and system for Web application - Google Patents

Data access method and system for Web application Download PDF

Info

Publication number
CN108667916B
CN108667916B CN201810371436.XA CN201810371436A CN108667916B CN 108667916 B CN108667916 B CN 108667916B CN 201810371436 A CN201810371436 A CN 201810371436A CN 108667916 B CN108667916 B CN 108667916B
Authority
CN
China
Prior art keywords
access
data
interface
access interface
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810371436.XA
Other languages
Chinese (zh)
Other versions
CN108667916A (en
Inventor
刘鹏
李冰冰
侯文�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201810371436.XA priority Critical patent/CN108667916B/en
Publication of CN108667916A publication Critical patent/CN108667916A/en
Application granted granted Critical
Publication of CN108667916B publication Critical patent/CN108667916B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/29Flow control; Congestion control using a combination of thresholds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/625Queue scheduling characterised by scheduling criteria for service slots or service orders
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • 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
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • 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
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • H04L67/5682Policies or rules for updating, deleting or replacing the stored data

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a data access method and a data access system for Web application. The data access method comprises the following steps of accessing corresponding target data through a plurality of access interfaces: acquiring state parameters of the plurality of access interfaces; determining a data access strategy and a data cache strategy according to the state parameters of the plurality of access interfaces; caching the target data according to the data caching strategy; and accessing the target data according to the data access strategy. Therefore, the caching strategy can be adaptively adjusted according to the flow fluctuation and the system performance. The method can provide more effective cache for frequently accessed data, improve access response time by setting the data cache when the system performance is poor, and ensure timeliness of the cached data. Meanwhile, the Web service can be better balanced in overall performance and data real-time performance.

Description

Data access method and system for Web application
Technical Field
The invention relates to the technical field of internet, in particular to a data access method and a data access system for Web application.
Background
With the development of internet technology and the improvement of internet service capability, the amount of data access faced by many large-scale Web applications has also increased dramatically. In order to improve the access speed, data caching technology is adopted in many Web applications. Data caching mainly relates to two aspects of caching which data are cached and the caching period of the data.
In the related art, caching strategies for data of different properties are generally preset based on classification of the properties of the data. For example, for a shopping platform website, the target data can be divided into three types, namely high-frequency change (such as account balance), medium-frequency change (such as commodity information) and low-frequency change (such as user name) according to the expected change frequency. Then, the low-frequency change data is cached for a longer time, the medium-frequency change data is cached for a shorter time or is not cached, and the high-frequency change data is not cached. And once the caching scheme is established, the caching strategy for each type of data is fixed and is not changed in the subsequent application.
This fixed mode caching strategy may lead to problems in that at peak traffic periods, some data may not perform well because no cache is used; in the low peak period of the flow, the real-time performance of the data is lost due to the longer expiration time of the buffer. In case of a traffic surge, it may even lead to a system crash.
Disclosure of Invention
The invention aims to solve at least one of technical problems in the related technology to a certain extent, and provides a dynamic cache Web application data access method and a dynamic cache Web application data access device, so that a self-adaptive cache strategy is provided when the Web application access amount and the data flow fluctuate, and the system performance and the data real-time performance are ensured.
To achieve the above object, an embodiment of a first aspect of the present invention provides a data access method for a Web application, where corresponding target data is accessed through multiple access interfaces, and the data access method includes: acquiring state parameters of the plurality of access interfaces; determining a data access strategy and a data cache strategy according to the state parameters of the plurality of access interfaces; caching the target data according to the data caching strategy; and accessing the target data according to the data access strategy.
In some embodiments, the determining a data caching policy comprises: grouping the target data according to the corresponding access interfaces, and determining whether each group of data is cached or not and the cache validity period of each group of cached data; the determining the data access policy comprises: and determining the access mode of each interface to the corresponding target data through cache memory access or direct access to the target database.
In some embodiments, the state parameters of the access interface include: the traffic of the access interface comprises the accumulated average traffic and/or real-time access traffic of the access interface in a predefined time period; and/or a response elapsed time of the access interface, the response elapsed time comprising an average response elapsed time and/or a real-time response elapsed time of the access interface within a predefined time period.
In some embodiments, determining the data access policy from the state parameters of the plurality of access interfaces comprises: when the real-time flow of the access interface is smaller than a first predefined threshold value, the access interface directly accesses the target database; and/or when the real-time response time consumption of the access interface is less than a second predefined threshold, the access interface directly accesses the target database.
In some embodiments, determining the data caching policy from the state parameters of the plurality of access interfaces comprises: setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the flow of the access interface; and/or setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the response time consumption of the access interface.
In some embodiments, the determining a data caching policy according to the interface traffic and the interface response time consumption of each access interface includes: and determining the cache validity period of the target data corresponding to each access interface through weighting calculation according to the average flow and the average interface response time consumption accumulated in the predefined time period of each access interface, and the real-time access flow and the real-time response time consumption at the current time.
The data access method of the Web application can adaptively adjust the caching strategy according to the flow fluctuation and the system performance. Therefore, more effective cache can be provided for frequently accessed data, and the problem of access speed bottleneck caused by low-frequency data in a peak period in the prior art is solved; when the system performance is not good, the access response time is improved by setting the data cache; and the timeliness of the cache data is ensured through a dynamic cache updating strategy. Meanwhile, the Web service can be better balanced in overall performance and data real-time performance.
To achieve the above object, a second embodiment of the present invention provides a data access system for a Web application, which includes: the target database is used for storing target data to be accessed; the cache memory is used for caching the target data; the access interface modules are used for accessing corresponding target data according to the access request; the interface monitoring module is used for monitoring the flow and response time consumption of the plurality of access interfaces to generate a monitoring result; the strategy determining module is used for determining a data access strategy and a data caching strategy according to the monitoring result of the interface monitoring module; the cache control module is used for caching the target data according to the data caching strategy; and the access control module is used for controlling the plurality of access interfaces to access the target data according to the data access strategy.
In some embodiments, the policy determination module determining the data caching policy comprises: grouping the target data according to the corresponding access interfaces, and determining whether each group of data is cached or not and the cache validity period of each group of cached data; the policy determination module determining the data access policy comprises: and determining the access mode of each interface to the corresponding target data through cache memory access or direct access to the target database.
In some embodiments, the policy determination module comprises: the interface performance acquisition unit is used for acquiring the state parameters of the access interface according to the monitoring result; the data caching strategy determining unit is used for determining a data caching strategy according to the state parameters of the access interface; and the data access policy determining unit is used for determining the data access policy according to the state parameters of the access interface.
In some embodiments, the state parameters of the access interface include: the traffic of the access interface comprises the accumulated average traffic and/or real-time access traffic of the access interface in a predefined time period; and/or a response elapsed time of the access interface, the response elapsed time comprising an average response elapsed time and/or a real-time response elapsed time of the access interface within a predefined time period.
In some embodiments, the determining of the data access policy by the data access policy determination unit according to the state parameter of the access interface comprises: when the flow of the access interface is smaller than a first predefined threshold value, the access interface directly accesses the target database; and/or when the response time of the access interface is less than a second predefined threshold, the access interface directly accesses the target database.
In some embodiments, the determining the data caching policy according to the state parameter of the access interface by the data caching policy determining unit includes: setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the flow of the access interface; and/or setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the response time consumption of the access interface.
In some embodiments, the determining the data caching policy according to the state parameter of the access interface by the data caching policy determining unit includes: and determining the cache validity period of the target data corresponding to each access interface through weighting calculation according to the average flow and the average interface response time consumption accumulated in the predefined time period of each access interface, and the real-time access flow and the real-time response time consumption at the current time.
The data access system of the Web application can adaptively adjust the caching strategy according to the flow fluctuation and the system performance. Therefore, more effective cache can be provided for frequently accessed data, and the problem of access speed bottleneck caused by low-frequency data in a peak period in the prior art is solved; when the system performance is not good, the access response time is improved by setting the data cache; and the timeliness of the cache data is ensured through a dynamic cache updating strategy. Meanwhile, the Web service can be better balanced in overall performance and data real-time performance.
In order to achieve the above object, an embodiment of a third aspect of the present invention provides a non-transitory computer-readable storage medium on which a computer program is stored, which when executed by a processor implements a data access method for a Web application according to the first aspect of the present invention.
In order to achieve the above object, a fourth aspect of the present invention provides a computer program product, wherein instructions of the computer program product, when executed by a processor, implement the data access method for the Web application according to the first aspect of the present invention.
In order to achieve the above object, an embodiment of a fifth aspect of the present invention provides a computer device, including 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 data access method for the Web application according to the first aspect of the present invention.
The non-transitory computer-readable storage medium, the computer program product and the computer device according to the third to fifth aspects of the present invention have similar advantageous effects to the data access method and system of the Web application according to the first and second aspects of the present invention, and will not be described in detail herein.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow diagram illustrating a data access method for a Web application according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a target data packet according to an embodiment of the present invention;
FIG. 3 is a block diagram of a data access system for a Web application according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of data access and cache update according to an embodiment of the present invention; and
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
The main reasons for poor performance of the existing data caching mode in Web access are that the caching strategy is rigid and fixed, and cannot timely react to access flow changes and follow changes of a target database. The specific reason is as follows: in the peak period, the access speed is too slow due to partial low-frequency data not being cached or the cache validity period being short, so that the overall performance of the system is influenced. In the low peak period, the data cache validity period is too long to update, so that the data in the target database may be changed and the data in the cache is not changed, thereby losing the real-time property of the data. The caching strategy cannot be automatically adjusted for abnormal traffic fluctuations, such as a steep increase in interface traffic.
The main technical idea of the invention is that the data access interface is monitored in real time, and the data caching strategy and the access strategy are dynamically set according to the working state of the access interface, so that the caching strategy can be adaptively adjusted and updated in due time along with the flow and response time, and the data access efficiency and the real-time property of the access data are ensured.
The following detailed description of embodiments of the invention refers to the accompanying drawings.
Fig. 1 is a flowchart illustrating a data access method for a Web application according to an embodiment of the present invention. Wherein the corresponding target data is accessed through a plurality of access interfaces. Particularly, for the situation that the Web application has a large access amount or the access path is complex, the target data can be accessed through different interfaces, and each interface can correspondingly access different parts of the target data. And the division of the interface can be realized according to different application purposes. For example, for a Web application website, different interfaces may be set to handle different access requests according to the source of the access request (from a browser or a mobile terminal on the PC side), the purpose of the access request (for example, accessing data for different storage areas in a target database, data of different permission levels, data of different user groups, and the like).
Specifically, the data access method of the Web application may include steps S110 to S140.
In step S110, state parameters of the multiple access interfaces are acquired. The state of the access interface can be described by access traffic and response time. Thus, the state parameters of the access interface may include traffic and/or response time. Wherein the traffic of the access interface comprises accumulated average traffic and/or real-time access traffic of the access interface within a predefined time period. And the response elapsed time of the access interface may include an average response elapsed time and/or a real-time response elapsed time of the access interface within a predefined time period.
The predefined time period may be a predefined time period that has a typical distinguishing meaning for the Web application. The predefined time period may be a longer time interval, for example within one day (one week, one month year), or within several days (several weeks, several months, etc.). Or the predefined time period may be a specified time period within each time period, such as a specified time period (of some hour or hours) in each day, a legal work day or a holiday in each year, and the like. By real-time access traffic and real-time response elapsed time is understood short-time average access traffic and average response elapsed time within a relatively short time window (e.g. within seconds or minutes) before the current time.
In step S120, a data access policy and a data caching policy are determined according to the state parameters of the multiple access interfaces.
Wherein, determining the data caching policy may include: and grouping the target data according to the corresponding access interfaces, and determining whether each group of data is cached or not and the cache validity period of each group of cached data. The essence of the method is that the access requirement and the corresponding state of each part of target data (each group) are determined through the state parameters of the access interface, and therefore the corresponding caching strategy of the part of data is determined. The determining the data access policy may include determining whether each interface accesses the corresponding target data through a cache memory access or directly accesses the target database.
Fig. 2 is a schematic diagram of a target data packet according to an embodiment of the present invention. The grouping may be performed according to the target data corresponding to each access interface, for example, the access target data corresponding to each access interface is taken as one group. The data packets and access interfaces do not necessarily need to be in a one-to-one correspondence. In some embodiments, access requests from different access sources for the same destination data may invoke different interfaces to achieve access. For example, for a shopping website, when the same account is accessed through a mobile APP end or a webpage, the interfaces used may be different. But these different interfaces may access the same target data. That is, in some embodiments, different access interfaces may correspond to partially identical data packets. At this time, when determining the data access policy and the data cache policy according to the state parameters of the multiple access interfaces, for each data packet, the state parameters of all the access interfaces accessing the data packet may be comprehensively considered, and the determination may be performed according to the comprehensive traffic and the access response time.
In other embodiments, the access interfaces and the destination data may be in an intersecting relationship, e.g., the destination data to be accessed by two different access interfaces is not identical, but partially intersecting. At this time, the intersection of the destination data of the two different access interfaces may be regarded as one packet, and the remaining portion without intersection may be regarded as one packet. Thereby facilitating the computation of the aggregate access amount and response time of the destination data of each packet.
Generally, when the target data corresponding to the access interface is in a cached state, the corresponding target data can be obtained by accessing the data in the cache memory, so as to obtain a faster access speed. And when the target data corresponding to the access interface is in a non-cache state, the access interface directly accesses the target database.
In some special cases, in order to further balance the load of the Web server or reduce the cache burden, the cached data can be directly accessed without reading the cache. For example, for a case that the real-time traffic of some access interfaces is small (for example, smaller than the first predefined threshold), it indicates that the user needs less, and does not need too fast response speed, all the user accesses can be completed in a short time, and the access interfaces can directly access the target database. Or when the response speed of the access interface is fast enough (for example, the response speed of the access interface is better corresponding to hardware facilities or the network state is ideal, and the real-time response time consumption is less than a second predefined threshold value), the response speed is further accelerated without using a cache, and the access interface directly accesses the target database. Then, when the load of the cache memory is large, the access interfaces reduce the use of the cache, so that the cache load can be reduced.
The specific caching policy for each data packet may then be set and adjusted according to the monitored interface state parameters. The general principle is that the cache validity period of the target data corresponding to each access interface can be set to be positively correlated with the flow of the access interface; and/or setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the response time consumption of the access interface. That is, the larger the traffic, the longer the cache validity period, the smaller the traffic, the shorter the cache validity period, and even no cache (it can be understood that the cache validity period is 0); the worse the interface performance, e.g. the longer the response time, the larger the cache validity, the better the performance, e.g. the shorter the response time, the shorter the cache validity, or even no cache (which may be understood as cache validity 0).
Determining the data caching policy according to the state parameters of the access interface may be performed at a plurality of predefined time nodes. In some embodiments, a predefined time node may be set according to a user access rule of the Web application, and different caching policies are dynamically set in different busy/idle time periods of a day; or adjusted once at regular intervals. It is also possible to set a specific trigger condition and to make adjustments in specific situations. For example, the real-time traffic exceeding a predetermined value may be used as a trigger condition, and when a large fluctuation occurs in the traffic and an access peak suddenly occurs, the caching policy may be adjusted in time.
Specifically, the cache validity period of the target data corresponding to each access interface may be determined through weighting calculation according to the average traffic and the average response consumed time of each access interface accumulated in the predefined time period, and the real-time access traffic and the real-time response consumed time at the current time. The weighted parameters can be selected and set according to the needs of the Web application.
In step S130, the target data is cached according to the data caching policy. And after the cache strategy is determined or updated, loading the data content in the target database into a cache memory according to the cache strategy, and providing the data content for each interface for quick access.
In step S140, the target data is accessed according to the data access policy. And each access interface accesses corresponding target data through a cache memory or a target database according to the specified data access strategy.
The data access method of the Web application can adaptively adjust the caching strategy according to the flow fluctuation and the system performance. Therefore, more effective cache can be provided for frequently accessed data, and the problem of access speed bottleneck caused by low-frequency data in a peak period in the prior art is solved; when the system performance is not good, the access response time is improved by setting the data cache; and the timeliness of the cache data is ensured through a dynamic cache updating strategy. Meanwhile, the Web service can be better balanced in overall performance and data real-time performance.
In order to implement the method in the foregoing first aspect embodiment, an embodiment of a second aspect of the present invention provides a data access system for a Web application. Fig. 3 is a block diagram of a data access system of a Web application according to an embodiment of the present invention. The data access system 100 for Web applications according to the present invention may include a target database 110, a cache memory 120, a plurality of access interface modules 130, an interface monitoring module 140, a policy determination module 150, a cache control module 160, and an access control module 170, among others.
The target database 110 is used to store target data to be accessed. The target database 110 may be implemented based on various database technologies in the related art, and the present invention has no particular requirement.
The cache memory 120 is used for caching the target data. The cache memory 120 is used to provide fast access to data, and may be implemented based on various data caching technologies in the related art, and the present invention has no special requirement for this.
The plurality of access interface modules 130 are used for accessing the corresponding target data according to the access request. The access interface module can be realized by a WebService (Web service) database access interface for calling Web application, and can also be a separately set data access interface. As long as the specified target data access function can be achieved.
The interface monitoring module 140 is configured to monitor traffic and response time consumption of the multiple access interfaces, and generate a monitoring result. The monitoring by the interface monitoring module 140 may be real-time and the monitoring results are sent to the measurement determination module for processing by the measurement determination module for formulating and updating the data access policy and the data caching policy.
The policy determining module 150 is configured to determine a data access policy and a data caching policy according to the monitoring result of the interface monitoring module.
Determining the data caching policy may include: grouping the target data according to the corresponding access interfaces, and determining whether each group of data is cached or not and the cache validity period of each group of cached data; determining the data access policy comprises: and determining the access mode of each interface to the corresponding target data through cache memory access or direct access to the target database.
Specifically, the policy determination module may include an interface performance acquisition unit, a data caching policy determination unit, and a data access policy determination unit.
The interface performance acquisition unit is used for acquiring the state parameters of the access interface according to the monitoring result. The state parameters of the access interface may include: traffic to access the interface and/or response to access the interface is time consuming. The traffic comprises accumulated average traffic and/or real-time access traffic of the access interface over a predefined time period. The response time consumption comprises an average response time consumption and/or a real-time response time consumption of the access interface in a predefined time period.
The data caching strategy determining unit is used for determining a data caching strategy according to the state parameter of the access interface. The cache validity period of the target data corresponding to each access interface can be set to be positively correlated with the flow of the access interface; and/or setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the response time consumption of the access interface. For example, the cache validity period of the target data corresponding to each access interface is determined through weighting calculation according to the average flow and the average response time consumption of the interface accumulated in the predefined time period of each access interface, and the real-time access flow and the real-time response time consumption at the current time.
The data access policy determining unit is used for determining a data access policy according to the state parameter of the access interface. When the target data corresponding to the access interface is in a cached state, the corresponding target data can be acquired by accessing the data in the cache memory, so as to acquire a faster access speed. And when the target data corresponding to the access interface is in a non-cache state, the access interface directly accesses the target database. In some embodiments, it may be further configured that the access interface directly accesses the target database when the flow rate of the access interface is less than the first predefined threshold. Or when the response time of the access interface is less than a second predefined threshold, the access interface directly accesses the target database.
The cache control module 160 is configured to cache the target data according to the data caching policy, and refresh the cache memory. And after the cache strategy is determined or updated, loading the data content in the target database into a cache memory according to the cache strategy, thereby providing each interface with quick access and deleting the data which does not need to be cached any more.
The access control module 170 is configured to control the multiple access interfaces to implement access to the target data according to the data access policy. And controlling each access interface to access corresponding target data through a cache memory or a target database according to the specified data access strategy.
It should be noted that the above explanations of the method embodiments of the invention also apply to the device embodiments of the invention, in which all details are not repeated in order to avoid redundancy. The person skilled in the art will refer to the above-mentioned description of an embodiment of the method according to the invention in connection with figures 1 to 2, where this is not the case.
Referring to fig. 4, fig. 4 is a schematic diagram of data access and cache update according to an embodiment of the present invention. The user 200 can access the web application server through the browser 300 or installed in the mobile terminal application program (APP)400, and the web application server can call the corresponding access interface module 130 according to different access routes and access purposes to realize the user's access to the corresponding target data. During operation of the web application server, the interface monitoring module 140 maintains monitoring of the status parameters of the various access interface modules and sends the monitoring results to the policy determination module 150. The policy determination module 150 adjusts the caching policy according to the monitoring result of the interface monitoring module 140 according to a predefined update time node or time interval. Alternatively, the caching policy may be proactively modified by system administrator 600. After the cache policy is modified, the cache memory 120 is controlled to load the corresponding target data to be cached from the target database according to the new cache policy and set the validity period of the cache data.
The data access system of the Web application can adaptively adjust the caching strategy according to the flow fluctuation and the system performance. Therefore, more effective cache can be provided for frequently accessed data, and the problem of access speed bottleneck caused by low-frequency data in a peak period in the prior art is solved; when the system performance is not good, the access response time is improved by setting the data cache; and the timeliness of the cache data is ensured through a dynamic cache updating strategy. Meanwhile, the Web service can be better balanced in overall performance and data real-time performance.
An embodiment of the third aspect of the present invention proposes a non-transitory computer-readable storage medium on which is stored a computer program that, when executed by a processor, implements a data access method for a Web application according to an embodiment of the first aspect of the present invention.
Generally, computer instructions for carrying out the methods of the present invention may be carried using any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. By non-transitory computer readable medium can be included any computer readable medium except for the signal itself, which is temporarily propagating.
A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
An embodiment of a fourth aspect of the present invention provides a computer program product, wherein when the instructions in the computer program product are executed by a processor, the data access method of the Web application according to the embodiment of the first aspect of the present invention is implemented.
According to a fifth aspect of the present invention, there is provided a computer device, including 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 data access method for the Web application according to the first aspect of the present invention.
The non-transitory computer-readable storage medium, the computer program product, and the computer device according to the third to fifth aspects of the present invention may be implemented with reference to the contents specifically described in the embodiment according to the first aspect of the present invention, and have similar beneficial effects to the data access method for the Web application according to the first aspect of the present invention, and are not described herein again.
FIG. 5 illustrates a block diagram of an exemplary computer device suitable for use in implementing embodiments of the present application. The computer device 12 shown in fig. 5 is only an example and should not bring any limitation to the function and scope of use of the embodiments of the present application.
As shown in FIG. 5, computer device 12 may be implemented in the form of a general purpose computing device. The components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. These architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus, to name a few.
Computer device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 28 may include computer system readable media in the form of volatile Memory, such as Random Access Memory (RAM) 30 and/or cache Memory 32. Computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer-readable storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown, but commonly referred to as a "hard drive"). Although not shown in FIG. 5, a disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a Compact disk Read Only Memory (CD-ROM), a Digital versatile disk Read Only Memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the application.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally perform the functions and/or methodologies of the embodiments described herein.
The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with the computer system/server 12, and/or with any devices (e.g., network card, modem, etc.) that enable the computer system/server 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Moreover, computer device 12 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public Network such as the Internet) via Network adapter 20. As shown, network adapter 20 communicates with the other modules of computer device 12 via bus 18. It is noted that although not shown, other hardware and/or software modules may be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing, for example, implementing the methods mentioned in the foregoing embodiments, by executing programs stored in the system memory 28.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention. The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
Although embodiments of the present invention have been shown and described above, it should be understood that the above embodiments are illustrative and not to be construed as limiting the present invention, and that changes, modifications, substitutions and alterations can be made in the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (13)

1. A data access method of Web application is characterized in that corresponding target data are accessed through a plurality of access interfaces, and the data access method comprises the following steps:
acquiring state parameters of the plurality of access interfaces, wherein the state parameters of the access interfaces comprise: the flow and response of the access interface are time-consuming;
determining a data access strategy and a data cache strategy according to the state parameters of the plurality of access interfaces; wherein the determining the data caching policy comprises: grouping the target data according to the corresponding access interfaces, and determining whether each group of data is cached or not and the cache validity period of each group of cached data; the determining the data access policy comprises: determining whether the access mode of each interface to the corresponding target data is through cache memory access or direct access to a target database;
caching the target data according to the data caching strategy; and
and accessing the target data according to the data access strategy.
2. The data access method for the Web application according to claim 1, wherein said traffic comprises accumulated average traffic and/or real-time access traffic of the access interface within a predefined time period; the response time consumption comprises an average response time consumption and/or a real-time response time consumption of the access interface in a predefined time period.
3. The method of claim 2, wherein determining the data access policy based on the state parameters of the plurality of access interfaces comprises:
when the real-time flow of the access interface is smaller than a first predefined threshold value, the access interface directly accesses the target database; and/or
And when the real-time response time consumption of the access interface is less than a second predefined threshold, the access interface directly accesses the target database.
4. The method of claim 2, wherein determining the data caching policy based on the state parameters of the plurality of access interfaces comprises:
setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the flow of the access interface; and/or
And setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the response time consumption of the access interface.
5. The method of claim 4, wherein the determining the data caching policy according to the interface traffic and the interface response time consumption of each access interface comprises:
and determining the cache validity period of the target data corresponding to each access interface through weighting calculation according to the average flow and the average interface response time consumption accumulated in the predefined time period of each access interface, and the real-time access flow and the real-time response time consumption at the current time.
6. A data access system for a Web application, comprising:
the target database is used for storing target data to be accessed;
the cache memory is used for caching the target data;
the access interface modules are used for accessing corresponding target data according to the access request;
the interface monitoring module is used for monitoring the flow and response time consumption of the plurality of access interfaces to generate a monitoring result;
the strategy determining module is used for determining a data access strategy and a data caching strategy according to the monitoring result of the interface monitoring module; wherein the determining of the data caching policy by the policy determination module comprises: grouping the target data according to the corresponding access interfaces, and determining whether each group of data is cached or not and the cache validity period of each group of cached data; the policy determination module determining the data access policy comprises: determining whether the access mode of each interface to the corresponding target data is through cache memory access or direct access to a target database;
the cache control module is used for caching the target data according to the data caching strategy; and
and the access control module is used for controlling the plurality of access interfaces to access the target data according to the data access strategy.
7. The data access system for a Web application of claim 6, wherein the policy determination module comprises:
an interface performance obtaining unit, configured to obtain a status parameter of an access interface according to a monitoring result, where the status parameter of the access interface includes: the flow and response of the access interface are time-consuming;
the data caching strategy determining unit is used for determining a data caching strategy according to the state parameter of the access interface; and
and the data access policy determining unit is used for determining a data access policy according to the state parameter of the access interface.
8. The data access system for Web applications of claim 7, wherein the state parameters of the access interface comprise:
the traffic of the access interface comprises the accumulated average traffic and/or real-time access traffic of the access interface in a predefined time period; and/or
And responding time consumption of the access interface, wherein the responding time consumption comprises average responding time consumption and/or real-time responding time consumption of the access interface in a predefined time period.
9. The data access system of the Web application according to claim 8, wherein the data access policy determination unit determining the data access policy according to the state parameter of the access interface includes:
when the flow of the access interface is smaller than a first predefined threshold value, the access interface directly accesses the target database; and/or
And when the response time consumption of the access interface is less than a second predefined threshold value, the access interface directly accesses the target database.
10. The data access system of the Web application according to claim 8, wherein the data caching policy determining unit determining the data caching policy according to the state parameter of the access interface includes:
setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the flow of the access interface; and/or
And setting the cache validity period of the target data corresponding to each access interface to be positively correlated with the response time consumption of the access interface.
11. The data access system of the Web application according to claim 10, wherein the data caching policy determining unit determining the data caching policy according to the state parameter of the access interface includes:
and determining the cache validity period of the target data corresponding to each access interface through weighting calculation according to the average flow and the average interface response time consumption accumulated in the predefined time period of each access interface, and the real-time access flow and the real-time response time consumption at the current time.
12. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements a data access method for a Web application according to any one of claims 1 to 5.
13. Computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing a data access method for a Web application according to any of claims 1-5 when executing the program.
CN201810371436.XA 2018-04-24 2018-04-24 Data access method and system for Web application Active CN108667916B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810371436.XA CN108667916B (en) 2018-04-24 2018-04-24 Data access method and system for Web application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810371436.XA CN108667916B (en) 2018-04-24 2018-04-24 Data access method and system for Web application

Publications (2)

Publication Number Publication Date
CN108667916A CN108667916A (en) 2018-10-16
CN108667916B true CN108667916B (en) 2021-08-13

Family

ID=63780035

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810371436.XA Active CN108667916B (en) 2018-04-24 2018-04-24 Data access method and system for Web application

Country Status (1)

Country Link
CN (1) CN108667916B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532101B (en) * 2019-09-03 2022-05-03 中国联合网络通信集团有限公司 Deployment system and method of micro-service cluster
CN110865895B (en) * 2019-10-25 2023-07-04 北京三快在线科技有限公司 Access flow control method, device, electronic equipment and storage medium
CN110968603B (en) * 2019-11-29 2023-07-04 中国银行股份有限公司 Data access method and device
CN111339472A (en) * 2020-03-16 2020-06-26 上海英方软件股份有限公司 Method, device and system for improving access speed of web system
CN113760974A (en) * 2020-09-08 2021-12-07 北京沃东天骏信息技术有限公司 Dynamic caching method, device and system
CN116303233A (en) * 2022-12-19 2023-06-23 广州市玄武无线科技股份有限公司 Data storage management method, device, equipment and computer storage medium
CN117519837B (en) * 2024-01-02 2024-06-11 暗物智能科技(广州)有限公司 Interface management method and interface management system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103646115A (en) * 2013-12-26 2014-03-19 浙江宇天科技股份有限公司 Method and system for client side to access to webpage

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7484044B2 (en) * 2003-09-12 2009-01-27 Intel Corporation Method and apparatus for joint cache coherency states in multi-interface caches
US7529903B2 (en) * 2005-07-05 2009-05-05 International Business Machines Corporation Systems and methods for memory migration
US8965819B2 (en) * 2010-08-16 2015-02-24 Oracle International Corporation System and method for effective caching using neural networks
CN102325159B (en) * 2011-07-14 2014-06-04 华中科技大学 Virtual experimental platform offline application interaction system
CN103533042B (en) * 2013-10-10 2018-06-22 北京奇虎科技有限公司 Location-based information issuing method and device
CN106681990B (en) * 2015-11-05 2019-10-25 华中科技大学 Data cached forecasting method under a kind of mobile cloud storage environment
CN105577822B (en) * 2016-01-27 2018-10-12 北京国电通网络技术有限公司 Caching centralized management system based on CDN node
CN106850572B (en) * 2016-12-29 2020-07-21 网宿科技股份有限公司 Target resource access method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103646115A (en) * 2013-12-26 2014-03-19 浙江宇天科技股份有限公司 Method and system for client side to access to webpage

Also Published As

Publication number Publication date
CN108667916A (en) 2018-10-16

Similar Documents

Publication Publication Date Title
CN108667916B (en) Data access method and system for Web application
US8473960B2 (en) Vector throttling to control resource use in computer systems
US10838626B2 (en) Methods, apparatuses, and computer program products for controlling write requests in storage system
CN113391765A (en) Data storage method, device, equipment and medium based on distributed storage system
US9886395B2 (en) Evicting cached stores
CN113381944B (en) System current limiting method, apparatus, electronic device, medium, and program product
US9152220B2 (en) Incremental preparation of videos for delivery
US11366758B2 (en) Method and devices for managing cache
CN109981702B (en) File storage method and system
US9372725B2 (en) Dynamically adjusting wait periods according to system performance
US20180352020A1 (en) Perfect application capacity analysis for elastic capacity management of cloud-based applications
WO2020034729A1 (en) Data processing method, related device, and computer storage medium
CN112799824A (en) Current limiting method, device, equipment and storage medium
US8627124B2 (en) Techniques for performing storage power management
TW202008162A (en) Data monitoring method and device, electronic device, and computer readable storage medium
CN112631504A (en) Method and device for realizing local cache by using off-heap memory
US8429348B2 (en) Method and mechanism for delaying writing updates to a data cache
US9063863B2 (en) Systems and methods for background destaging storage tracks
US20130145075A1 (en) Dynamically managing memory lifespan in hybrid storage configurations
US20210117253A1 (en) Method, device, and computer program product for managing processes
US8930589B2 (en) System, method and computer program product for monitoring memory access
US20190228083A1 (en) Managing application resources based on funnels applied in site navigation
EP3679739B1 (en) Caching and providing data to a device based on available resources
CN115225577A (en) Data processing control method and device, electronic equipment and readable storage medium
US20070150653A1 (en) Processing of cacheable streaming data

Legal Events

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