WO2017092350A1 - 提高缓存命中率的方法及装置 - Google Patents

提高缓存命中率的方法及装置 Download PDF

Info

Publication number
WO2017092350A1
WO2017092350A1 PCT/CN2016/089480 CN2016089480W WO2017092350A1 WO 2017092350 A1 WO2017092350 A1 WO 2017092350A1 CN 2016089480 W CN2016089480 W CN 2016089480W WO 2017092350 A1 WO2017092350 A1 WO 2017092350A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
format
request information
response packet
deleting
Prior art date
Application number
PCT/CN2016/089480
Other languages
English (en)
French (fr)
Inventor
庞传晓
王冉阳
Original Assignee
乐视控股(北京)有限公司
乐视体育文化产业发展(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 乐视控股(北京)有限公司, 乐视体育文化产业发展(北京)有限公司 filed Critical 乐视控股(北京)有限公司
Priority to US15/246,508 priority Critical patent/US20170155731A1/en
Publication of WO2017092350A1 publication Critical patent/WO2017092350A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • 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
    • 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/565Conversion or adaptation of application format or content

Definitions

  • the embodiments of the present invention relate to the field of Internet technologies, and in particular, to a method and an apparatus for improving a cache hit ratio.
  • the data in the cache server is read faster than the data in the business server.
  • the web server obtains the corresponding data from the cache server according to the data request information. If yes, the cache server sends the data corresponding to the data request information to the user, thereby improving the access of the web server. effectiveness.
  • the specific process of the web server adding the historical data to the cache server is as follows: the web server constructs a keyword key according to the Uniform Resource Locator (URL) in the user data request information; when the service server returns data to the user, The web server obtains the data value corresponding to the keyword key, and adds the ⁇ keyword key, data value> pair to the cache server.
  • URL Uniform Resource Locator
  • the inventor adds the ⁇ keyword key, data value> to the cache server by way of way, it finds that there is a problem that the web server constructs the keyword key to use the entire URL as the cache keyword key; or, using a part of the URL as the URL Cache keyword key. If the URL in the data request information sent by the user is inconsistent with the cache key in the cache server, the value of the data saved in the cache server cannot be read, thereby reducing the cache hit ratio. At the same time, when the web server stores the data value, the data value returned by the service server is directly added to the cache server. Since the data type of the same data value may be different, the data requested by the user is different from the data value stored in the cache server. The probability is greater, thus further reducing the cache hit rate.
  • the embodiment of the invention provides a method and a device for improving the cache hit ratio, and the main purpose thereof is to improve the cache hit ratio in the cache server.
  • An embodiment of the present invention provides a method for improving a cache hit ratio, including:
  • the first data request information is data request information acquired by the server for the first time
  • the first data response packet includes format data corresponding to the format parameter, deleting the format data
  • An embodiment of the present invention provides an apparatus for improving a cache hit ratio, including:
  • a first acquiring unit configured to acquire first data request information, where the first data request information is data request information acquired by the device for improving a cache hit ratio for the first time;
  • a first determining unit configured to determine whether a format parameter exists in the first data request information acquired by the first acquiring unit
  • a first deleting unit configured to delete the format parameter when the first determining unit determines that the format parameter exists in the first data request information
  • a second acquiring unit configured to acquire a first data response packet corresponding to the first data request information acquired by the first acquiring unit
  • a second determining unit configured to determine whether the first data response packet acquired by the second acquiring unit includes format data corresponding to the format parameter, where the format data is used to describe the first data request information The format corresponding to the requested data;
  • a second deleting unit configured to delete the format data when the second determining unit determines that the first data response packet includes format data corresponding to the format parameter
  • a saving unit configured to save the first data request information after the first deletion unit deletes the format parameter and the first data response packet after the second deletion unit deletes the format data to the cache server, where the format parameter is deleted.
  • the subsequent first data request information has a one-to-one correspondence with the first data response packet after the format data is deleted.
  • the method and device for improving the cache hit ratio provided by the embodiment of the present invention, first, the web server obtains the first data request information, and determines whether a format parameter exists in the first data request information, and determines that the first data request information exists. When the format parameter is used, the format parameter is deleted; secondly, the web server obtains the first data response packet corresponding to the first data request information, and determines whether a format corresponding to the format parameter exists in the first data response packet, when determining When the first data response packet includes format data corresponding to the format parameter, the format data is deleted, and the format data is used to describe a format corresponding to the data requested by the first data request information; and finally, the web server The first data request information after the format parameter is deleted and the first data response packet after the format data is deleted are stored in the cache server.
  • the web server receives the data request information according to the embodiment of the present invention.
  • the format parameter in the deletion is deleted, and the data request information is increased with the keyword key in the cache server.
  • the web server deletes the format data in the first data response packet obtained, so that the data types of the same data value are the same, thereby improving the cache hit ratio and shortening the response of the client data request. delay.
  • FIG. 1 is a flowchart of a method for improving a cache hit ratio according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for a web server to respond to data request information sent by a client according to an embodiment of the present invention
  • FIG. 3 is a structural block diagram of an apparatus for improving a cache hit ratio according to an embodiment of the present invention
  • FIG. 4 is a block diagram showing another composition of an apparatus for improving a cache hit ratio according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a web server according to an embodiment of the present invention.
  • An embodiment of the present invention improves a method for improving a cache hit ratio.
  • the method is applied to a web server. As shown in FIG. 1 , the method includes:
  • the web server receives and acquires the first data request information sent by the client according to the HTTP-Hypertext Transfer Protocol (HTTP), where the first data request information includes a Uniform Resource Locator (URL).
  • HTTP HyperText Transfer Protocol
  • the web server obtains data corresponding to the first data request information from the service server or the cache server through the URL.
  • the web server receives the first data request information based on its own service processing interface, and the service processing interface performs the first data request information according to the necessary parameters of the response data request information recorded in the configuration file. response.
  • the web server obtains the first data request information, determining whether there is a format parameter in the first data request information, where the format parameter is a non-essential parameter of the web server responding to the first data request information, and the format parameter usually includes a web
  • the JSONP JSON with Padding
  • the first data request information is data request information acquired by the web server for the first time.
  • the first data request information acquired by the web server for the first time is the first acquisition in the traditional sense, that is, the web server never receives the first data request information; as another embodiment of the present invention Implementation, the web server has obtained the first The data request information, however, the effective time for the web server to save the first data request information has expired, and the first data request information acquired by the web server is still obtained for the first time.
  • the format parameter is deleted; if the web server determines that the format parameter does not exist in the first data request information, step 103 is directly performed.
  • the web server sends the first data request information to the service server, and the service server is configured to generate a corresponding request result according to the data request information of the client.
  • the service server returns the first data response packet corresponding to the first data request information to the client
  • the web server obtains the first data response packet, and determines whether the first data response packet includes format data corresponding to the format parameter, if If the first data response packet includes format data corresponding to the format parameter, step 104 is performed; if it is determined that the first data response packet does not include format data corresponding to the format parameter, the format is deleted.
  • the first data request information after the parameter and the first data response packet are saved to the cache server.
  • the format data is used to describe a format corresponding to the data requested by the first data request information.
  • the first data response packet includes format data corresponding to the format parameter, deleting the format data.
  • the first data request information after the format parameter is deleted is used as a keyword key
  • the first data response packet after the format data is deleted is used as the data value
  • the keyword key and the data value are in one-to-one correspondence
  • the keyword key and the data value are the first Secondary storage in the cache server.
  • the web server stores the keyword key and the data value in pairs in the cache server.
  • the web server records the address of the cache server that stores the keyword key and the data value.
  • the web server obtains the corresponding data value according to the address of the cache server recorded by the server, and sends the data value to the client.
  • the method for improving the cache hit ratio provided by the embodiment of the present invention, first, the web server obtains the first a data request information, and determining whether a format parameter exists in the first data request information, wherein the first data request information is data request information acquired by the web server for the first time; when it is determined that the first data request information exists When the format parameter is used, the format parameter is deleted; secondly, the web server obtains the first data response packet corresponding to the first data request information, and determines whether the format data corresponding to the format parameter exists in the first data response packet, when When the format data corresponding to the format parameter is included in the first data response packet, the format in the first data response packet is deleted; finally, the web server deletes the first data request information after the format parameter and deletes the format data.
  • the first data response packet is stored in the cache server.
  • the web server deletes the format parameter in the received data request information, and increases the data request information and the cache server.
  • the matching probability of the key in the key in addition, the first data response packet that the web server will obtain Delete data format, so that the same data value of the same data type, thus, increase the cache hit rate while reducing the response delay of the client data request.
  • the web server parses the obtained first data request information. , get the URL it contains, and determine if there is a format parameter in the URL.
  • the URL included in the first data request information is: http://api.lesports.com/sis-web/app/match/getMatchStatusByMatchIds?
  • the web server After the web server saves the first data request information after deleting the format parameter and the first data response packet after deleting the format data to the cache server, the keyword key and the data value are paired. After saving to the cache server, the web server responds to the data request information sent by the client based on the keyword key and the data value stored in the cache server.
  • the following methods may be used, but are not limited to the following. As shown in FIG. 2, the method includes:
  • step 202 If it is determined that the format parameter exists in the second data request information, step 202 is performed; if it is determined that the format parameter does not exist in the second data request information, step 203 is performed.
  • the web server obtains the second data request information, and the second data request information may be consistent with the keyword key stored by the cache server, or may be inconsistent with the keyword key stored by the cache server.
  • the second data request is performed by the embodiment of the present invention.
  • the content of the information is not limited.
  • the format parameter is recorded, and the purpose is: when the web server is based on the second data request information after deleting the format parameter, that is, the keyword key in the cache server.
  • the format data corresponding to the format parameter is dynamically added to the data value, which not only ensures the access efficiency of the web server, but also ensures the accuracy of the data acquired by the client.
  • the web server determines whether the second data request information and the first data request information after deleting the format parameter, that is, the keyword key in the cache server are consistent. Alternatively, the web server determines the first data request information after deleting the format parameter, that is, the keyword key in the cache server, and the second data after deleting the format parameter. Whether the request information is consistent. If they are consistent, step 204 is performed. If the data is inconsistent, the data corresponding to the second data request information is not stored in the cache server, and the web server needs to obtain the corresponding data from the service server based on the second data request information.
  • the first data response packet after deleting the format data is obtained from the cache server, and the first data response packet after deleting the format data is converted into a second data response packet.
  • the web server obtains the corresponding data value from the cache server based on the keyword key, and the data value does not include the format data.
  • the first data response packet is obtained, that is, the cache server is obtained.
  • the first data response packet is converted into the second data response packet, and the specific operation includes: the web server is the first data response packet obtained, that is, the data value is added according to the format parameter recorded in step 202. Format data.
  • the corresponding first data response packet that is, the data value is: ⁇ callback: "", +data"[...], +msgs:[...], result:1, timeStamp:20150921110502 ⁇
  • the above is only an exemplary example, and the content of the first data request information, the second data request information, the first data response packet, the second data response packet, and the format parameter are not specifically limited.
  • the web server determines whether the first data response packet includes the format data corresponding to the format parameter, and the method includes: the web server parses the obtained first data response packet, and traverses the parsed first data response packet. And determining whether the format data corresponding to the format parameter exists in the parsed first data response packet.
  • the first data response packet parsed by the web server includes: abc( ⁇ callback:"", +data"[...], +msgs:[...], result:1, timeStamp:20150921110502 ⁇ ), First, traversing from the first character of the first data response packet to the end of the last character of the first data response packet, determining that abc() is the first data response packet Data, abc() is deleted; and ⁇ callback:"", +data"[...], +msgs:[...], result:1, timeStamp:20150921110502 ⁇ and its corresponding first data of the delete format parameter
  • the request information is stored in pairs in the cache server.
  • the web server can communicate with a plurality of cache servers, wherein the cache server is a distributed cache server, and can respond to the data request information sent by the client in time.
  • the cache server is a distributed cache server, and can respond to the data request information sent by the client in time.
  • the keyword key and the data value are stored in the cache server
  • the keyword is stored according to the degree of similarity of the keyword key. If the keyword similarity of the keyword received by the web server is extremely high, the web server stores the keyword key and its corresponding data value in a cache server, causing the load of the cache server to be too large, thereby causing the web.
  • the server increases the response latency of the response client.
  • the web server determines the timeliness of the cache server response data request information, and the web server saves the first data request information after the format parameter and the first data response packet after deleting the format data to the cache server.
  • the web server encrypts the first data request information after deleting the format parameter and the first data response packet after deleting the format data, that is, the keyword key and its corresponding data value are encrypted, and the encrypted keyword key and its corresponding data value are encrypted.
  • the keyword key and its corresponding data value are randomly stored in the cache server on the web server, which improves the dispersibility of the keyword key and its corresponding data value, and reduces the concentration of the keyword key and its corresponding data.
  • the load on the cache server is too large.
  • the encryption of the keyword key and its corresponding data value may be implemented by, but not limited to, the following implementation manners, for example, a hash algorithm hash, including a message digest algorithm (MD5), and a specific embodiment of the present invention.
  • a hash algorithm hash including a message digest algorithm (MD5), and a specific embodiment of the present invention.
  • MD5 message digest algorithm
  • the implementation algorithm is not limited.
  • an embodiment of the present invention provides an apparatus for improving a cache hit ratio.
  • the apparatus includes:
  • the first obtaining unit 301 is configured to acquire first data request information, where the first data request information is data request information that is first acquired by the device that improves the cache hit ratio, and the device that improves the cache hit ratio is based on its own.
  • the service processing interface receives the first data request information, and the service processing interface responds to the first data request information according to the necessary parameters of the response data request information recorded in the configuration file.
  • the device that improves the cache hit ratio After the device that improves the cache hit ratio obtains the first data request information, determining whether a format parameter exists in the first data request information, where the format parameter is The device that improves the cache hit ratio responds to the non-essential parameter of the first data request information, and the format parameter generally includes a JSONP (JSON with Padding) format parameter used by the client when the device that improves the cache hit ratio sends the first data response packet to the client. ;
  • JSONP JSON with Padding
  • a first determining unit 302 configured to determine whether a format parameter exists in the first data request information acquired by the first acquiring unit 301;
  • a first deleting unit 303 configured to delete the format parameter when the first determining unit 302 determines that the format parameter exists in the first data request information
  • the second obtaining unit 304 is configured to acquire a first data response packet corresponding to the first data request information acquired by the first acquiring unit 301;
  • the second determining unit 305 is configured to determine whether the first data response packet acquired by the second acquiring unit 304 includes format data corresponding to the format parameter, where the format data is used to describe the first data.
  • a second deleting unit 306, configured to delete the format data when the second determining unit 305 determines that the first data response packet includes format data corresponding to the format parameter;
  • the saving unit 307 is configured to save the first data request information after the first deletion unit 303 deletes the format parameter and the first data response packet after the second deletion unit 306 deletes the format data to the cache server, where The first data request information after the format parameter is deleted is in one-to-one correspondence with the first data response packet after the format data is deleted.
  • the device further includes:
  • the third obtaining unit 308 is configured to: after the saving unit 307 saves the first data request information after deleting the format parameter and the first data response packet after deleting the format data to the cache server, acquiring the second data request information;
  • a third determining unit 309 configured to determine whether the format parameter exists in the second data request information acquired by the third acquiring unit 308;
  • the recording unit 310 is configured to: when the third determining unit 309 determines that the format parameter exists in the second data request information, record the format parameter, and the purpose thereof is: when the device that improves the cache hit ratio is based on the deletion format
  • the second data request information after the parameter, that is, the keyword key in the cache server obtains the format corresponding to the format parameter for the data value when the corresponding data value is obtained, thereby ensuring the access of the device for improving the cache hit rate. Efficiency; and ensure the accuracy of the client to obtain data;
  • a third deleting unit 311, configured to delete the format parameter after the recording unit records 310 the format parameter
  • the first determining unit 312 is configured to determine whether the first data request information after deleting the format parameter is consistent with the second data request information after the third deleting unit 311 deletes the format parameter;
  • the fourth obtaining unit 313 is configured to: when the first determining unit 312 determines that the first data request information after deleting the format parameter is consistent with the second data request information after the third deleting unit 311 deletes the format parameter, Determining, by the cache server, a first data response packet after deleting the format data;
  • the converting unit 314 is configured to convert the first data response packet after the deleted format data acquired by the fourth acquiring unit 313 into a second data response packet, where the second response packet includes the first data after deleting the format data.
  • the response packet dynamically adds the format data corresponding to the format parameter of the record;
  • the first sending unit 315 is configured to send the second data response packet converted by the converting unit 314 to the client.
  • the device further includes:
  • the second determining unit 316 is configured to: when it is determined that the format parameter is not included in the second data request information acquired by the third acquiring unit 308, determine, by deleting the format parameter, the first data request information and the first Whether the two data request information is consistent;
  • the fifth obtaining unit 317 is configured to: after the second determining unit 316 determines that the first data request information after deleting the format parameter is consistent with the second data request information, obtain the deleted format data from the cache server. First data response packet;
  • the second sending unit 318 is configured to send the first data response packet acquired by the fifth obtaining unit 317 to the client.
  • the first determining unit 302 includes:
  • the parsing module 3021 is configured to parse the first data request information.
  • the obtaining module 3022 is configured to obtain a uniform resource locator URL after the parsing module 3021 parses the first data request information, where the first data request information includes the URL;
  • the determining module 3023 is configured to determine whether the format parameter exists in the URL acquired by the obtaining module 3022.
  • the second determining unit 305 includes:
  • the parsing module 3051 is configured to parse the first data response packet
  • the traversing module 3052 is configured to parse the first data response packet in the parsing module 3051 After parsing, traversing the parsed first data response packet;
  • the determining module 3053 is configured to determine whether the parsed first data response packet includes format data corresponding to the format parameter.
  • the device further includes:
  • the encryption unit 319 is configured to: after the saving unit 307 saves the first data request information after deleting the format parameter and the first data response packet after deleting the format data to the cache server, deleting the first data request after the format parameter Encrypting the information and the first data response packet after deleting the format data;
  • the saving unit 307 is further configured to save the first data request information after deleting the format parameter encrypted by the encryption unit 318 and the first data response packet after deleting the format data to the cache server.
  • the device for improving the cache hit ratio provided by the embodiment of the present invention, first, the web server obtains the first data request information, and determines whether a format parameter exists in the first data request information; wherein the first data request information is the The first time, the web server obtains the first data response packet corresponding to the first data request information, and determines the Whether there is format data corresponding to the format parameter in the first data response packet, and when determining that the first data response packet includes format data corresponding to the format parameter, deleting the format in the first data response packet; The web server stores the first data request information after the format parameter is deleted and the first data response packet after the format data is deleted in the cache server. Compared with the prior art, the web server receives the received information in the embodiment of the present invention.
  • the format parameters in the data request information are deleted, and the data request information is increased in the cache server.
  • the matching probability of the key key in addition, the web server deletes the format data in the first data response packet obtained, so that the data type of the same data value is the same, thereby improving the cache hit rate and shortening the client.
  • the response delay of the data request is not limited to, but not limited to, but not limited to, but not limited to, but not limited to the data request.
  • FIG. 5 is a schematic structural diagram of a web server according to an embodiment of the present invention.
  • the server may include: a processor. (processor) 51, communication interface (Communications Interface) 52, storage A memory 53 and a bus 54, wherein the processor 51, the communication interface 52, and the memory 53 complete communication with each other via the bus 54.
  • Communication interface 52 can be used for information transfer between the server and the client.
  • the processor 51 may call the logic instruction in the memory 53 to perform the following method: acquiring the first data request information, and determining whether a format parameter exists in the first data request information; if it is determined that the first data request information exists Deleting the format parameter, the first data response packet corresponding to the first data request information, and determining whether the first data response packet includes format data corresponding to the format parameter, The format data is used to describe a format corresponding to the data requested by the first data request information; if it is determined that the first data response packet includes format data corresponding to the format parameter, deleting the format data; Saving the first data request information after deleting the format parameter and the first data response packet after deleting the format data to the cache server, where the first data request information after deleting the format parameter and the first data response after deleting the format data One-to-one correspondence.
  • the logic instructions in the memory 53 described above may be implemented in the form of a software functional unit and sold or used as a stand-alone product, and may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.
  • the points may be embodied in the form of a software product, which may be stored in a computer readable storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including instructions for causing a computer device (which may be a personal computer)
  • the server, or network device, etc. performs the methods described in various embodiments or portions of the embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明实施例提供一种提高缓存命中率的方法及装置,本发明实施例的技术方案包括:web服务器获取第一数据请求信息,并确定第一数据请求信息中是否存在格式参数;其中,第一数据请求信息为web服务器首次获取的数据请求信息;若确定第一数据请求信息中存在格式参数,则删除格式参数;获取第一数据请求信息对应的第一数据响应包,并确定第一数据响应包中是否包含与格式参数对应的格式数据;若确定第一数据响应包中包含与格式参数对应的格式数据,则删除格式数据;将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器中,提高了缓存命中率,同时,缩短了客户端数据请求的响应延迟。

Description

提高缓存命中率的方法及装置 技术领域
本发明实施例涉及互联网技术领域,尤其涉及一种提高缓存命中率的方法及装置。
背景技术
随着互联网的普及,人们对web服务器的访问效率的要求也越来越高。目前,通过将历史访问的数据加入到缓存服务器中,该缓存服务器中数据的读取速度比业务服务器中数据的读取速度快。当用户向web服务器发送数据请求信息时,首先,web服务器根据该数据请求信息向缓存服务器获取对应数据,若存在,则缓存服务器将数据请求信息对应的数据发送给用户,提高了web服务器的访问效率。
web服务器将历史数据加入到缓存服务器的具体过程如下:web服务器根据用户数据请求信息中的统一资源定位符(Uniform Resource Locator,URL),构造生成关键字key;当业务服务器向用户返回数据后,web服务器获取关键字key对应的数据value,并将<关键字key,数据value>对添加至缓存服务器中。
发明人在通过方式将<关键字key,数据value>添加至缓存服务器中时,发现其存在如下问题:web服务器构造生成关键字key时将整个URL作为缓存关键字key;或者,使用一部分URL作为缓存关键字key。若用户发送数据请求信息中的URL与缓存服务器中的缓存关键字不一致,则缓存服务器中保存的数据value不能被读取,因此,降低了缓存命中率。同时,在web服务器存储数据value时,直接将业务服务器返回的数据value添加到缓存服务器中,由于同一数据value的数据类型可能存在差异,用户请求的数据与缓存服务器中存储的数据value存在差异的机率较大,因此,进一步降低了缓存命中率。
发明内容
本发明实施例提供一种提高缓存命中率的方法及装置,其主要目的在于提高提高缓存服务器中的缓存命中率。
本发明实施例提供一种提高缓存命中率的方法,包括:
获取第一数据请求信息,并确定所述第一数据请求信息中是否存在格式参数,其中,所述第一数据请求信息为所述服务器首次获取的数据请求信息;
若确定所述第一数据请求信息中存在所述格式参数,则删除所述格式参数;
获取所述第一数据请求信息对应的第一数据响应包,并确定所述第一数据响应包中是否包含与所述格式参数对应的格式数据,所述格式数据用于描述所述第一数据请求信息请求的数据所对应的格式;
若确定所述第一数据响应包中包含与所述格式参数对应的格式数据,则删除所述格式数据;
将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器中,所述删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包一一对应。
本发明实施例提供一种提高缓存命中率的装置,包括:
第一获取单元,用于获取第一数据请求信息,其中,所述第一数据请求信息为所述提高缓存命中率的装置首次获取的数据请求信息;
第一确定单元,用于确定所述第一获取单元获取的所述第一数据请求信息中是否存在格式参数;
第一删除单元,用于当所述第一确定单元确定所述第一数据请求信息中存在所述格式参数时,删除所述格式参数;
第二获取单元,用于获取所述第一获取单元获取的所述第一数据请求信息对应的第一数据响应包;
第二确定单元,用于确定所述第二获取单元获取的所述第一数据响应包中是否包含与所述格式参数对应的格式数据,所述格式数据用于描述所述第一数据请求信息请求的数据所对应的格式;
第二删除单元,用于当所述第二确定单元确定所述第一数据响应包中包含与所述格式参数对应的格式数据时,删除所述格式数据;
保存单元,用于将所述第一删除单元删除格式参数后的第一数据请求信息与所述第二删除单元删除格式数据后的第一数据响应包保存至缓存服务器中,所述删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包一一对应。
本发明实施例提供的提高缓存命中率的方法及装置,首先,web服务器获取第一数据请求信息,并确定该第一数据请求信息中是否存在格式参数,当确定该第一数据请求信息中存在格式参数时,将该格式参数删除;其次,web服务器获取第一数据请求信息对应的第一数据响应包,并确定该第一数据响应包中是否存在与所述格式参数对应的格式,当确定第一数据响应包中包含与所述格式参数对应的格式数据时,删除所述格式数据,所述格式数据用于描述所述第一数据请求信息请求的数据所对应的格式;最后,web服务器将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包存储于缓存服务器中;与现有技术相比,本发明实施例的,web服务器将接收到的数据请求信息中的格式参数进行删除,增大了数据请求信息与缓存服务器中关键字key的匹配概率,此外,web服务器将获取到的第一数据响应包中的格式数据进行删除,使得同一数据value的数据类型相同,因此,提高了缓存命中率,同时,缩短了客户端数据请求的响应延迟。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1示出了本发明实施例提供的提高缓存命中率的方法的流程图;
图2示出了本发明实施例提供的一种web服务器响应客户端发送的数据请求信息的方法的流程图;
图3示出了本发明实施例提供的一种提高缓存命中率的装置的组成框图;
图4示出了本发明实施例提供的另一种提高缓存命中率的装置的组成框图;
图5示出了本发明实施例提供的一种web服务器的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明实施例提高一种提高缓存命中率的方法,该方法应用于web服务器端,如图1所示,该方法包括:
101、获取第一数据请求信息,并确定所述第一数据请求信息中是否存在格式参数。
web服务器基于超文本传送协议(HTTP-Hypertext transfer protocol,HTTP)接收并获取客户端发送的第一数据请求信息,该第一数据请求信息中包含有统一资源定位符(Uniform Resource Locator,URL),web服务器通过该URL向业务服务器或者缓存服务器获取该第一数据请求信息对应的数据。
在本发明实施例中,web服务器基于其自身的业务处理接口接收所述第一数据请求信息,业务处理接口会根据配置文件中记录的响应数据请求信息的必要参数,对第一数据请求信息进行响应。在web服务器获取到第一数据请求信息之后,确定该第一数据请求信息中是否存在格式参数,其中,所述格式参数为web服务器响应第一数据请求信息的非必要参数,格式参数通常包含web服务器向客户端发送第一数据响应包时,客户端使用的JSONP(JSON with Padding)格式参数,其中,有关JSONP格式的具体内容,请参考现有技术中的相关描述,本发明实施例在此不再进行一一赘述。
需要说明的是,所述第一数据请求信息为所述web服务器首次获取的数据请求信息。作为本发明实施例的一种实现方式,web服务器首次获取的第一数据请求信息为传统意义上的首次获取,即web服务器从未接收到第一数据请求信息;作为本发明实施例的另一种实现方式,web服务器获取过第一 数据请求信息,但是,web服务器保存第一数据请求信息的有效时间已失效,那么,本次web服务器获取的第一数据请求信息仍为首次获取。
102、若确定所述第一数据请求信息中存在所述格式参数,则删除所述格式参数。
当web服务器确定第一数据请求信息中存在格式参数时,将该格式参数进行删除;若web服务器确定第一数据请求信息中不存在格式参数时,直接执行步骤103。
103、获取所述第一数据请求信息对应的第一数据响应包,并确定所述第一数据响应包中是否包含与所述格式参数对应的格式数据。
web服务器将第一数据请求信息发送至业务服务器,该业务服务器用于根据客户端的数据请求信息生成对应的请求结果。业务服务器向客户端返回第一数据请求信息对应的第一数据响应包时,web服务器获取该第一数据响应包,并确定该第一数据响应包中是否包含格式参数对应的格式数据,若确定所述第一数据响应包中包含与所述格式参数对应的格式数据,则执行步骤104;若确定所述第一数据响应包中不包含与所述格式参数对应的格式数据,则将删除格式参数后的第一数据请求信息与第一数据响应包保存到缓存服务器中。本发明实施例中,所述格式数据用于描述所述第一数据请求信息请求的数据所对应的格式。
104、若确定所述第一数据响应包中包含与所述格式参数对应的格式数据,则删除所述格式数据。
105、将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器中。
所述删除格式参数后的第一数据请求信息作为关键字key,删除格式数据后的第一数据响应包作为数据value,关键字key与数据value一一对应,且关键字key与数据value均为首次存储于所述缓存服务器中。
web服务器在将关键字key与数据value成对保存到缓存服务器中,web服务器会记录有保存关键字key与数据value的缓存服务器的地址,当客户端发送包含关键字key的请求信息时,web服务器根据其记录的缓存服务器的地址,获取对应的数据value,将该与数据value发送至客户端。
本发明实施例提供的提高缓存命中率的方法,首先,web服务器获取第 一数据请求信息,并确定该第一数据请求信息中是否存在格式参数,其中,所述第一数据请求信息为所述web服务器首次获取的数据请求信息;当确定该第一数据请求信息中存在格式参数时,将该格式参数删除;其次,web服务器获取第一数据请求信息对应的第一数据响应包,并确定该第一数据响应包中是否存在与所述格式参数对应的格式数据,当确定第一数据响应包中包含与所述格式参数对应的格式数据时,将第一数据响应包中的格式删除;最后,web服务器将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包存储于缓存服务器中;与现有技术相比,本发明实施例的,web服务器将接收到的数据请求信息中的格式参数进行删除,增大了数据请求信息与缓存服务器中关键字key的匹配概率,此外,web服务器将获取到的第一数据响应包中的格式数据进行删除,使得同一数据value的数据类型相同,因此,提高了缓存命中率,同时,缩短了客户端数据请求的响应延迟。
进一步的,作为对上述实施例的细化和扩展,在执行步骤101确定所述第一数据请求信息中是否存在格式参数时,其具体过程如下:web服务器对获取的第一数据请求信息进行解析,获取其包含的URL,确定该URL中是否存在格式参数。示例性的,假设,第一数据请求信息中包含的URL为:http://api.lesports.com/sis-web/app/match/getMatchStatusByMatchIds?version=2.0&ids=1070;web服务器确定该URL中包含格式参数version=2.0,将该格式参数version=2.0进行删除,并将删除格式参数后的URL:http://api.lesports.com/sis-web/app/match/getMatchStatusByMatchIds?ids=1070及其对应的数据响应包分别作为关键字key与数据value存储于缓存服务器中。
进一步的,基于图1所示的方法,web服务器将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器之后,即将关键字key与数据value成对保存到缓存服务器之后,web服务器基于缓存服务器中保存的关键字key与数据value对客户端发送的数据请求信息进行响应。在web服务器对数据请求信息响应时,可以采用但不局限于以下的方式,如图2所示,该方法包括:
201、获取第二数据请求信息,并确定所述第二数据请求信息中是否存在所述格式参数。
若确定所述第二数据请求信息中存在所述格式参数,则执行步骤202;若确定所述第二数据请求信息中不存在所述格式参数,则执行步骤203。
web服务器获取第二数据请求信息,该第二数据请求信息可以与缓存服务器存储的关键字key一致;也可以与缓存服务器存储的关键字key不一致,具体的,本发明实施例对第二数据请求信息的内容不进行限定。
示例性的,假设,若第二数据请求信息中包含的URL为:http://api.lesports.com/sis-web/app/match/getMatchStatusByMatchIds?ids=1070&callback=abc,则确定该第二数据请求信息中的格式参数包括:callback=abc。若第二数据请求信息中包含的URL为:http://api.lesports.com/sis-web/app/match/getMatchStatusByMatchIds?ids=1070,则确定第二数据请求信息中不存在所述格式参数。需要说明的是,有关web服务器确定所述第二数据请求信息中是否存在所述格式参数的具体实现方式,请参考上述有关说明,本发明实施例在此不再进行赘述。
202、记录所述格式参数,并将所述格式参数删除。
当web服务器确定第二数据请求信息中存在格式参数时,将该格式参数进行记录,其目的在于:当web服务器基于删除格式参数后的第二数据请求信息,即缓存服务器中的关键字key,获取其对应的数据value时,为数据value动态添加与格式参数对应的格式数据,既能确保提高web服务器的访问效率;又能确保客户端获取数据的准确度。
承由上述示例,若第二数据请求信息中包含的URL为:http://api.lesports.com/sis-web/app/match/getMatchStatusByMatchIds?ids=1070&callback=abc,则删除格式参数后的URL为:http://api.lesports.com/sis-web/app/match/getMatchStatusByMatchIds?ids=1070。其中,web服务器记录的格式参数包括:callback=abc。
203、判断删除格式参数后的第一数据请求信息与第二数据请求信息是否一致。
当web服务器确定所述第二数据请求信息中不存在所述格式参数时,判断该第二数据请求信息与删除格式参数后的第一数据请求信息,即缓存服务器中的关键字key是否一致。或者,web服务器判断删除格式参数后的第一数据请求信息,即缓存服务器中的关键字key,与删除格式参数后的第二数据 请求信息是否一致。若一致,则执行步骤204。若不一致,则说明缓存服务器中未存储关于第二数据请求信息对应的数据,web服务器需基于该第二数据请求信息向业务服务器获取其对应的数据。
204、从所述缓存服务器中获取删除格式数据后的第一数据响应包,并将删除格式数据后的第一数据响应包转换为第二数据响应包。
web服务器基于关键字key从缓存服务器中获取对应的数据value,该数据value不包含格式数据,为了确保数据value与客户端所需的数据value一致,在获取第一数据响应包,即获取缓存服务器中的数据value之后,将第一数据响应包转换为第二数据响应包,其具体操作包括:web服务器为获取的第一数据响应包,即数据value添加步骤202中记录的格式参数所对应的格式数据。
示例性的,若删除格式参数后的第二数据请求信息(或者删除格式参数后的第一数据请求信息)中包含的URL,即缓存服务器中的关键词key为:http://api.lesports.com/sis-web/app/match/getMatchStatusByMatchIds?ids=1070,其对应的第一数据响应包,即数据value为:{callback:"",+data”[…],+msgs:[…],result:1,timeStamp:20150921110502},而步骤202中web服务器记录的格式参数包括:callback=abc。因此,web服务器需根据记录的格式参数:callback=abc对数据value动态添加对应的格式数据,添加格式数据后的数据value为:abc({callback:"",+data”[…],+msgs:[…],result:1,timeStamp:20150921110502})。以上仅为示例性的举例,本发明实施例对第一数据请求信息、第二数据请求信息、第一数据响应包、第二数据响应包及格式参数等内容不进行具体限定。
205、将所述第二数据响应包发送至客户端。
进一步的,在web服务器确定第一数据响应包中是否包含与所述格式参数对应的格式数据,包括:web服务器对获取的第一数据响应包进行解析,并遍历解析后的第一数据响应包,确定解析后的第一数据响应包中是否存在与格式参数对应的格式数据。示例性的,若web服务器解析得到的第一数据响应包中包含:abc({callback:"",+data”[…],+msgs:[…],result:1,timeStamp:20150921110502}),首先,从该第一数据响应包的第一个字符开始依次遍历,到第一数据响应包的最后一个字符结束,确定abc()为第一数据响应包的格 式数据,将abc()删除;并将{callback:"",+data”[…],+msgs:[…],result:1,timeStamp:20150921110502}及其对应的删除格式参数的第一数据请求信息成对存储于缓存服务器中。
web服务器能够与多个缓存服务器进行通信交互,其中,所述缓存服务器为分布式高速缓存服务器,能够对客户端发送的数据请求信息进行及时响应。而现有技术中,在将关键字key与数据value存储于缓存服务器中时,根据关键字key的相似程度进行存储。若web服务器接收的多个关键字key相似度极高,则web服务器会将该些关键字key与其对应数据value存储于一台缓存服务器中,导致该台缓存服务器的负荷过大,进而导致web服务器增大了响应客户端响应延迟。
进一步的,为了减轻缓存服务器的负载,确定缓存服务器响应数据请求信息的及时性,web服务器将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器之前,web服务器将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包进行加密操作,即将关键字key与其对应数据value进行加密,加密后的关键字key与其对应数据value为随机的字符串,在web服务器将关键字key与其对应数据value随机的存储在缓存服务器中,提高关键字key与其对应数据value的分散性,减小了由于关键字key与其对应数据value过于集中,而导致该台缓存服务器的负荷过大。关键字key与其对应数据value进行加密可以采用但不局限于以下的实现方式,例如,哈希算法Hash,包括:消息摘要算法(Message-Digest Algorithm 5,MD5);本发明实施例对加密的具体实现算法不进行限定。
作为对图1所示方法的具体实现,本发明实施例提供一种提高缓存命中率的装置,如图3所示,该装置包括:
第一获取单元301,用于获取第一数据请求信息;其中,所述第一数据请求信息为所述提高缓存命中率的装置首次获取的数据请求信息,提高缓存命中率的装置基于其自身的业务处理接口接收所述第一数据请求信息,业务处理接口会根据配置文件中记录的响应数据请求信息的必要参数,对第一数据请求信息进行响应。在提高缓存命中率的装置获取到第一数据请求信息之后,确定该第一数据请求信息中是否存在格式参数,其中,所述格式参数为 提高缓存命中率的装置响应第一数据请求信息的非必要参数,格式参数通常包含提高缓存命中率的装置向客户端发送第一数据响应包时,客户端使用的JSONP(JSON with Padding)格式参数;
第一确定单元302,用于确定所述第一获取单元301获取的所述第一数据请求信息中是否存在格式参数;
第一删除单元303,用于当所述第一确定单元302确定所述第一数据请求信息中存在所述格式参数时,删除所述格式参数;
第二获取单元304,用于获取所述第一获取单元301获取的所述第一数据请求信息对应的第一数据响应包;
第二确定单元305,用于确定所述第二获取单元304获取的所述第一数据响应包中是否包含与所述格式参数对应的格式数据,所述格式数据用于描述所述第一数据请求信息请求的数据所对应的格式;
第二删除单元306,用于当所述第二确定单元305确定所述第一数据响应包中包含与所述格式参数对应的格式数据时,删除所述格式数据;
保存单元307,用于将所述第一删除单元303删除格式参数后的第一数据请求信息与所述第二删除单元306删除格式数据后的第一数据响应包保存至缓存服务器中,所述删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包一一对应。
进一步的,如图4所示,所述装置还包括:
第三获取单元308,用于在所述保存单元307将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器之后,获取第二数据请求信息;
第三确定单元309,用于确定所述第三获取单元308获取的所述第二数据请求信息中是否存在所述格式参数;
记录单元310,用于当所述第三确定单元309确定所述第二数据请求信息中存在所述格式参数时,记录所述格式参数,其目的在于:当提高缓存命中率的装置基于删除格式参数后的第二数据请求信息,即缓存服务器中的关键字key,获取其对应的数据value时,为数据value动态添加与格式参数对应的格式,既能确保提高提高缓存命中率的装置的访问效率;又能确保客户端获取数据的准确度;
第三删除单元311,用于在所述记录单元记录310所述格式参数之后,将所述格式参数删除;
第一判断单元312,用于判断删除格式参数后的第一数据请求信息与所述第三删除单元311删除格式参数后的第二数据请求信息是否一致;
第四获取单元313,用于当所述第一判断单元312判断删除格式参数后的第一数据请求信息与所述第三删除单元311删除格式参数后的第二数据请求信息一致时,从所述缓存服务器中获取删除格式数据后的第一数据响应包;
转换单元314,用于将所述第四获取单元313获取的删除格式数据后的第一数据响应包转换为第二数据响应包,所述第二响应包包含为删除格式数据后的第一数据响应包动态添加记录的所述格式参数对应的格式数据;
第一发送单元315,用于将所述转换单元314转换的所述第二数据响应包发送至客户端。
进一步的,如图4所示,所述装置还包括:
第二判断单元316,用于当确定所述第三获取单元308获取的所述第二数据请求信息中不存在所述格式参数时,判断删除格式参数后的第一数据请求信息与所述第二数据请求信息是否一致;
第五获取单元317,用于当所述第二判断单元316判断删除格式参数后的第一数据请求信息与所述第二数据请求信息一致时,从所述缓存服务器中获取删除格式数据后的第一数据响应包;
第二发送单元318,用于将所述第五获取单元317获取的所述第一数据响应包发送至所述客户端。
进一步的,如图4所示,所述第一确定单元302包括:
解析模块3021,用于解析所述第一数据请求信息;
获取模块3022,用于在所述解析模块3021解析所述第一数据请求信息之后,获取统一资源定位符URL,所述第一数据请求信息中包含所述URL;
确定模块3023,用于确定所述获取模块3022获取的所述URL中是否存在所述格式参数。
进一步的,如图4所示,所述第二确定单元305包括:
解析模块3051,用于对所述第一数据响应包进行解析;
遍历模块3052,用于在所述解析模块3051解析对所述第一数据响应包 进行解析之后,遍历解析后的第一数据响应包;
确定模块3053,用于确定解析后的第一数据响应包中是否包含与所述格式参数对应的格式数据。
进一步的,如图4所示,所述装置还包括:
加密单元319,用于在所述保存单元307将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器之前,将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包进行加密;
所述保存单元307,还用于将所述加密单元318加密后的删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至所述缓存服务器。
本发明实施例提供的提高缓存命中率的装置,首先,web服务器获取第一数据请求信息,并确定该第一数据请求信息中是否存在格式参数;其中,所述第一数据请求信息为所述web服务器首次获取的数据请求信息;当确定该第一数据请求信息中存在格式参数时,将该格式参数删除;其次,web服务器获取第一数据请求信息对应的第一数据响应包,并确定该第一数据响应包中是否存在与所述格式参数对应的格式数据,当确定第一数据响应包中包含与所述格式参数对应的格式数据时,将第一数据响应包中的格式删除;最后,web服务器将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包存储于缓存服务器中;与现有技术相比,本发明实施例的,web服务器将接收到的数据请求信息中的格式参数进行删除,增大了数据请求信息与缓存服务器中关键字key的匹配概率,此外,web服务器将获取到的第一数据响应包中的格式数据进行删除,使得同一数据value的数据类型相同,因此,提高了缓存命中率,同时,缩短了客户端数据请求的响应延迟。
需要说明的是,针对上述提高缓存命中率的装置,凡是本发明实施例中使用到的各个单元模块的功能都可以通过硬件处理器(hardware processor)来实现。
示例性的,当所述提高缓存命中率的装置为web服务器时,如图5所示,图5示出了本发明实施例提供的一种web服务器的结构示意图,该服务器可以包括:处理器(processor)51、通信接口(Communications Interface)52、存储 器(memory)53和总线54,其中,处理器51、通信接口52、存储器53通过总线54完成相互间的通信。通信接口52可以用于服务器与客户端之间的信息传输。处理器51可以调用存储器53中的逻辑指令,以执行如下方法:获取第一数据请求信息,并确定所述第一数据请求信息中是否存在格式参数;若确定所述第一数据请求信息中存在所述格式参数,则删除所述格式参数;获取所述第一数据请求信息对应的第一数据响应包,并确定所述第一数据响应包中是否包含与所述格式参数对应的格式数据,所述格式数据用于描述所述第一数据请求信息请求的数据所对应的格式;若确定所述第一数据响应包中包含与所述格式参数对应的格式数据,则删除所述格式数据;将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器中,所述删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包一一对应。
此外,上述的存储器53中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部 分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims (12)

  1. 一种提高缓存命中率的方法,其特征在于,包括:
    服务器获取第一数据请求信息,并确定所述第一数据请求信息中是否存在格式参数;其中,所述第一数据请求信息为所述服务器首次获取的数据请求信息;
    若确定所述第一数据请求信息中存在所述格式参数,则删除所述格式参数;
    获取所述第一数据请求信息对应的第一数据响应包,并确定所述第一数据响应包中是否包含与所述格式参数对应的格式数据,所述格式数据用于描述所述第一数据请求信息请求的数据所对应的格式;
    若确定所述第一数据响应包中包含与所述格式参数对应的格式数据,则删除所述格式数据;
    将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器中,所述删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包一一对应。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器之后,获取第二数据请求信息,并确定所述第二数据请求信息中是否存在所述格式参数;
    若确定所述第二数据请求信息中存在所述格式参数,则记录所述格式参数,并将所述格式参数删除;
    判断删除格式参数后的第一数据请求信息与删除格式参数后的第二数据请求信息是否一致;
    若一致,则从所述缓存服务器中获取删除格式数据后的第一数据响应包,并将删除格式数据后的第一数据响应包转换为第二数据响应包,所述第二响应包包含为删除格式数据后的第一数据响应包动态添加记录的所述格式参数对应的格式数据;
    将所述第二数据响应包发送至客户端。
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    若确定所述第二数据请求信息中不存在所述格式参数,则判断删除格式 参数后的第一数据请求信息与所述第二数据请求信息是否一致;
    若一致,则从所述缓存服务器中获取删除格式数据后的第一数据响应包,并将删除格式参数后的第一数据响应包发送至所述客户端。
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述确定所述第一数据请求信息中是否存在格式参数包括:
    解析所述第一数据请求信息,获取统一资源定位符URL,所述第一数据请求信息中包含所述URL;
    确定所述URL中是否存在所述格式参数。
  5. 根据权利要求4所述的方法,其特征在于,确定所述第一数据响应包中是否包含与所述格式参数对应的格式数据包括:
    对所述第一数据响应包进行解析,并遍历解析后的第一数据响应包;
    确定解析后的第一数据响应包中是否包含与所述格式参数对应的格式数据。
  6. 根据权利要求5所述的方法,其特征在于,在将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器之前,所述方法还包括:
    将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包进行加密;
    所述将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器中包括:
    将加密后的删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至所述缓存服务器。
  7. 一种提高缓存命中率的装置,其特征在于,包括:
    第一获取单元,用于获取第一数据请求信息;其中,所述第一数据请求信息为所述提高缓存命中率的装置首次获取的数据请求信息;
    第一确定单元,用于确定所述第一获取单元获取的所述第一数据请求信息中是否存在格式参数;
    第一删除单元,用于当所述第一确定单元确定所述第一数据请求信息中存在所述格式参数时,删除所述格式参数;
    第二获取单元,用于获取所述第一获取单元获取的所述第一数据请求信 息对应的第一数据响应包;
    第二确定单元,用于确定所述第二获取单元获取的所述第一数据响应包中是否包含与所述格式参数对应的格式数据,所述格式数据用于描述所述第一数据请求信息请求的数据所对应的格式;
    第二删除单元,用于当所述第二确定单元确定所述第一数据响应包中包含与所述格式参数对应的格式数据时,将删除所述格式数据;
    保存单元,用于将所述第一删除单元删除格式参数后的第一数据请求信息与所述第二删除单元删除格式数据后的第一数据响应包保存至缓存服务器中,所述删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包一一对应。
  8. 根据权利要求7所述的装置,其特征在于,所述装置还包括:
    第三获取单元,用于在所述保存单元将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器之后,获取第二数据请求信息;
    第三确定单元,用于确定所述第三获取单元获取的所述第二数据请求信息中是否存在所述格式参数;
    记录单元,用于当所述第三确定单元确定所述第二数据请求信息中存在所述格式参数时,记录所述格式参数;
    第三删除单元,用于在所述记录单元记录所述格式参数之后,将所述格式参数删除;
    第一判断单元,用于判断删除格式参数后的第一数据请求信息与所述第三删除单元删除格式参数后的第二数据请求信息是否一致;
    第四获取单元,用于当所述第一判断单元判断删除格式参数后的第一数据请求信息与所述第三删除单元删除格式参数后的第二数据请求信息一致时,从所述缓存服务器中获取删除格式数据后的第一数据响应包;
    转换单元,用于将所述第四获取单元获取的删除格式数据后的第一数据响应包转换为第二数据响应包,所述第二响应包包含为删除格式数据后的第一数据响应包动态添加记录的所述格式参数对应的格式数据;
    第一发送单元,用于将所述转换单元转换的所述第二数据响应包发送至客户端。
  9. 根据权利要求8所述的装置,其特征在于,所述装置还包括:
    第二判断单元,用于当确定所述第三获取单元获取的所述第二数据请求信息中不存在所述格式参数时,判断删除格式参数后的第一数据请求信息与所述第二数据请求信息是否一致;
    第五获取单元,用于当所述第二判断单元判断删除格式参数后的第一数据请求信息与所述第二数据请求信息一致时,从所述缓存服务器中获取删除格式数据后的第一数据响应包;
    第二发送单元,用于将所述第五获取单元获取的所述第一数据响应包发送至所述客户端。
  10. 根据权利要求7-9中任一项所述的装置,其特征在于,所述第一确定单元包括:
    解析模块,用于解析所述第一数据请求信息;
    获取模块,用于在所述解析模块解析所述第一数据请求信息之后,获取统一资源定位符URL,所述第一数据请求信息中包含所述URL;
    确定模块,用于确定所述获取模块获取的所述URL中是否存在所述格式参数。
  11. 根据权利要求10所述的装置,其特征在于,所述第二确定单元包括:
    解析模块,用于对所述第一数据响应包进行解析;
    遍历模块,用于在所述解析模块解析对所述第一数据响应包进行解析之后,遍历解析后的第一数据响应包;
    确定模块,用于确定解析后的第一数据响应包中是否包含与所述格式参数对应的格式数据。
  12. 根据权利要求11所述的装置,其特征在于,所述装置还包括:
    加密单元,用于在所述保存单元将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至缓存服务器之前,将删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包进行加密;
    所述保存单元,还用于将所述加密单元加密后的删除格式参数后的第一数据请求信息与删除格式数据后的第一数据响应包保存至所述缓存服务器。
PCT/CN2016/089480 2015-12-01 2016-07-08 提高缓存命中率的方法及装置 WO2017092350A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/246,508 US20170155731A1 (en) 2015-12-01 2016-08-24 Method and device for increasing cache hit ratio

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510863189.1A CN105871980A (zh) 2015-12-01 2015-12-01 提高缓存命中率的方法及装置
CN201510863189.1 2015-12-01

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/246,508 Continuation US20170155731A1 (en) 2015-12-01 2016-08-24 Method and device for increasing cache hit ratio

Publications (1)

Publication Number Publication Date
WO2017092350A1 true WO2017092350A1 (zh) 2017-06-08

Family

ID=56623827

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/089480 WO2017092350A1 (zh) 2015-12-01 2016-07-08 提高缓存命中率的方法及装置

Country Status (2)

Country Link
CN (1) CN105871980A (zh)
WO (1) WO2017092350A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112882829A (zh) * 2021-01-29 2021-06-01 成都环宇知了科技有限公司 一种基于nodejs服务端的缓存优化方法及系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1617500A (zh) * 2003-11-12 2005-05-18 国际商业机器公司 用于处理对Web服务的请求的方法和系统
WO2006108037A1 (en) * 2005-04-01 2006-10-12 Multiplied Media Corporation Multi-mode location based e-directory service enabling method, system, and apparatus
CN104331255A (zh) * 2014-11-17 2015-02-04 中国科学院声学研究所 一种基于嵌入式文件系统的流式数据读取方法

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020099813A1 (en) * 2000-12-04 2002-07-25 Jason Winshell Method for collecting statistics about Web site usage
CN102012931A (zh) * 2010-12-01 2011-04-13 北京瑞信在线系统技术有限公司 过滤式缓存方法及其装置、缓存系统
CN102638580A (zh) * 2012-03-30 2012-08-15 奇智软件(北京)有限公司 一种网页信息处理方法和装置
CN102843437A (zh) * 2012-09-17 2012-12-26 北京星网锐捷网络技术有限公司 网页应用的转换方法、装置和网络设备
CN104202360B (zh) * 2014-08-13 2015-12-30 小米科技有限责任公司 访问网页的方法、装置及路由器
CN104516973B (zh) * 2014-12-26 2019-03-05 北京奇虎科技有限公司 访问页面的方法和装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1617500A (zh) * 2003-11-12 2005-05-18 国际商业机器公司 用于处理对Web服务的请求的方法和系统
WO2006108037A1 (en) * 2005-04-01 2006-10-12 Multiplied Media Corporation Multi-mode location based e-directory service enabling method, system, and apparatus
CN104331255A (zh) * 2014-11-17 2015-02-04 中国科学院声学研究所 一种基于嵌入式文件系统的流式数据读取方法

Also Published As

Publication number Publication date
CN105871980A (zh) 2016-08-17

Similar Documents

Publication Publication Date Title
WO2017092351A1 (zh) 缓存数据的更新方法及装置
CN108306877B (zh) 基于node js的用户身份信息的验证方法、装置和存储介质
US9148332B2 (en) Content delivery network
WO2019095416A1 (zh) 信息推送方法、装置、终端设备及存储介质
WO2019057212A1 (zh) Cdn节点内服务调度方法、装置、设备及存储介质
WO2017114205A1 (zh) 短链接处理方法、装置及服务器
US8302169B1 (en) Privacy enhancements for server-side cookies
US10650119B2 (en) Multimedia data processing method, apparatus, system, and storage medium
TWI671642B (zh) 跨應用共享資料的方法及網頁瀏覽器
CN102882974B (zh) 一种通过网站识别版本号节省网站访问资源的方法
US9554276B2 (en) System and method for on the fly protocol conversion in obtaining policy enforcement information
US10536439B2 (en) Client fingerprinting for information system security
WO2016082371A1 (zh) 一种基于ssh协议的会话解析方法及系统
TW201824047A (zh) 攻擊請求的確定方法、裝置及伺服器
US8645550B2 (en) Database virtualization
US10025599B1 (en) Connectivity as a service
WO2017080459A1 (zh) 服务内容的缓存及提供方法、装置、系统和存储介质
CN109639819B (zh) 文件传输方法、客户端、服务器及系统
CN105812351A (zh) 实现会话共享的方法和系统
US20170155712A1 (en) Method and device for updating cache data
WO2020133608A1 (zh) 一种拖拉视频数据的处理方法及代理服务器
US10574703B1 (en) Content delivery employing multiple security levels
WO2018228234A1 (zh) 视频缓存方法及视频缓存装置
WO2016082616A1 (zh) 为搜索引擎提供网站认证数据的方法及装置
WO2022068235A1 (zh) 基于信息的属性生成随机数的信息处理方法、装置及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16869663

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16869663

Country of ref document: EP

Kind code of ref document: A1