WO2017185633A1 - Cdn服务器及其缓存数据的方法 - Google Patents

Cdn服务器及其缓存数据的方法 Download PDF

Info

Publication number
WO2017185633A1
WO2017185633A1 PCT/CN2016/100422 CN2016100422W WO2017185633A1 WO 2017185633 A1 WO2017185633 A1 WO 2017185633A1 CN 2016100422 W CN2016100422 W CN 2016100422W WO 2017185633 A1 WO2017185633 A1 WO 2017185633A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
request
target data
cdn server
data
Prior art date
Application number
PCT/CN2016/100422
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 乐视控股(北京)有限公司
Publication of WO2017185633A1 publication Critical patent/WO2017185633A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • 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

Definitions

  • Embodiments of the present invention relate to the field of network communications, and in particular, to a CDN server and a method for buffering data thereof.
  • the Content Delivery Network relies on distributed edge servers deployed in the local area. Through the central platform's load balancing, content distribution, scheduling and other functional modules, users can obtain the required content, reduce network congestion, and improve user access response speed. And the hit rate.
  • the key technologies of the CDN are mainly content storage and distribution technologies.
  • a node in a CDN network is a CDN server that is distributed to areas or networks where user access is relatively concentrated.
  • the global load technology is used to point the user's access to the closest working CDN server.
  • the CDN server caches the data accessed by the user, the CDN server can directly respond to the user request and is not cached on the CDN server.
  • the CDN server requests data from the CDN source station, which reduces the load of the CDN source station, which refers to the original site where the content is published.
  • the CDN server when the CDN server receives the HyperText Transfer Protocol (HTTP) request message, if the HTTP request message includes range information indicating the read range, the CDN server may be from the CDN source station. Or the target data indicated by the range information is obtained in a file cached in the CDN server. Moreover, the CDN server manages the obtained file by using a cache index, which includes the file identifier and a cache status code that identifies each file in a cached state or in a cached state. In addition, the CDN server also performs maintenance management on a processing schedule, which includes the identification of each request message and the processing progress of each request message, for example, where each request message is sent. The progress can include an unprocessed state, a processed state, and a processed state.
  • HTTP HyperText Transfer Protocol
  • the CDN server when the CDN server receives two or more Hypertext Transfer Protocol request messages in succession, the CDN server requests data from the CDN source station when processing the first request message, and continues to receive the second request.
  • the CDN server first determines the cache state of the file corresponding to the second request message according to the file identifier in the cache index. If the requested file state is in the cache process, the CDN server starts timing and times out the file. If not already cached, the second request message is sent to the CDN source station for processing.
  • the CDN server when the CDN server receives two or more hypertext transfer protocol request messages in succession, if the first request message and the second request message correspond to the requested file, and When the second request is received, the CDN server is buffering the file of the corresponding request, and the second request is sent to the CDN source station for processing as long as the remaining time of the file is exceeded for the preset time.
  • the embodiment of the invention provides a CDN server and a method for buffering data thereof, which is used to solve the problem that the processing of the HTTP request message by the existing CDN server wastes the processing resources of the CDN source station, and realizes that the CDN server continuously receives the request for the same file.
  • the request message is processed in a more intelligent and efficient manner.
  • An embodiment of the present invention provides a method for a CDN server to cache data, including:
  • the CDN server receives the first request information, where the first request information is Hypertext Transfer Protocol (HTTP) request information including the first range information of the request range, where the first request message is used to request the first file and the first The first target data indicated by the range information;
  • HTTP Hypertext Transfer Protocol
  • the CDN server receives and caches complete data of the first file sent from a CDN source station in a first time period based on the first request information, where the CDN source station refers to an original site that publishes content;
  • the CDN server receives the second request information in the first time period, where the second request information is Hypertext Transfer Protocol (HTTP) request information including a request range second range information, and the second request message is used to request The second target data indicated by the second range information;
  • HTTP Hypertext Transfer Protocol
  • An embodiment of the present invention provides a CDN server, including:
  • the first request information is Hypertext Transfer Protocol (HTTP) request information including the first range information of the request range, where the first request message is used to request the same in the first file.
  • the first target data indicated by the first range information, the second request information is Hypertext Transfer Protocol (HTTP) request information including a request range second range information, and the second request message is used to request the second range information.
  • HTTP Hypertext Transfer Protocol
  • the CDN source station refers to the original site where the content is posted;
  • a detecting unit configured to detect, when the CDN server receives the second request information in the first time period, whether the second target data is part of data in the first file
  • a response unit configured to: when the second target data is part of the first file, and when a predetermined condition is met, from the complete data of the first file cached on the CDN server Determining the second target data and responding to the second request message according to the second target data on the CDN server.
  • An embodiment of the present invention provides an electronic device, including:
  • a memory for storing instructions
  • processor coupled to the memory for executing the instructions to perform the following steps when the instructions are executed:
  • the first request information is Hypertext Transfer Protocol (HTTP) request information including a request range first range information, where the first request message is used to request the first file and the first a first target data indicated by a range information;
  • HTTP Hypertext Transfer Protocol
  • the second request information is Hypertext Transfer Protocol (HTTP) request information including a request range second range information, where the second request message is used Requesting second target data indicated by the second range information;
  • HTTP Hypertext Transfer Protocol
  • Embodiments of the present invention provide a non-transitory storage medium for storing a computer program, the computer program including instructions for executing the foregoing CDN server and a method of buffering the same.
  • Embodiments of the present invention provide a computer program including instructions for executing the foregoing CDN server and a method of buffering data thereof.
  • the technical solution in the embodiment of the present application may detect another request information when the CDN server receives one request information and receives another request information in the process of acquiring and caching a certain file based on the request information. Whether the file of the corresponding target data of the request is a file being cached, and if so, whether it is determined whether the current system condition satisfies a preset condition that can be transferred to the CDN server for processing, thereby making it possible to make The system transfers the files that do not affect the user experience to the CDN server, thereby saving the processing resources of the CDN source station, and has the technical effect of improving the intelligence level of the CDN server and saving the processing resources of the CDN source station.
  • FIG. 1 is a schematic flowchart of a method for buffering data of a CDN server according to an embodiment of the present invention
  • FIG. 2 is a structural diagram of a CDN server according to an embodiment of the present invention.
  • FIG. 3 is a structural diagram of an electronic device according to an embodiment of the present invention.
  • HTTP is a set of rules for computers to communicate over a network.
  • the HTTP client can request information and services from an HTTP server by sending an HTTP request message.
  • the HTTP client can be a web browser, and the HTTP server can be a web server.
  • An HTTP request message consists of three parts: a Request Line, a Message Headers, and an Entity Body, where the message header and the message body are separated by blank lines.
  • the request line consists of three tokens: the request method, the Uniform Resource Identifier (URI), and the HTTP version, for example: GET/news.asp HTTP/1.1.
  • GET represents the request method
  • /news.asp represents the URI
  • HTTP/1.1 represents the protocol version.
  • the URI completely specifies the network resources in the HTTP server to be accessed, usually by giving a relative directory relative to the root directory of the server.
  • the header allows the HTTP client to pass additional information about the request or about the client to the HTTP server.
  • the message header includes a Host header field, a Referer header field, and the like.
  • the Host header field indicates the host and port number of the requesting resource
  • the Referer header field allows the client to specify the source resource address of the request URI. It is worth noting that Range is a new header field in HTTP/1.1.
  • the range header field allows the client to request one or more sub-scopes of the entity.
  • the message body is used to carry data associated with the request, such as parameters required for some requests. Indicated by the content length Content-Type and the content type Content-Length in the message header.
  • the CDN server acts as a proxy server for the CDN source station (ie, the HTTP server).
  • the HTTP request message sent by the client needs to pass through the CDN server.
  • the CDN server receives the HTTP request message, it is unified according to the HTTP request message.
  • the resource identifier and the range information determine the target data requested by the client.
  • the existing CDN server receives two or more hypertext transfer protocol request messages in succession, if the first request message and the second request message correspond to the requested file, and the second request is received, When the CDN server is caching the file of the corresponding request, the second request is sent to the CDN source station for processing as long as the remaining time of the file is exceeded for the preset time.
  • the technical problem of causing waste of CDN source station processing resources is possible to handle the CDN source station.
  • the embodiment of the invention provides a method for buffering data by a CDN server. As shown in FIG. 1 , the method includes:
  • Step 100 The CDN server receives the first request information, where the first request information is Hypertext Transfer Protocol (HTTP) request information including the first range information of the request range, where the first request message is used to request the information in the first file.
  • HTTP Hypertext Transfer Protocol
  • the CDN server may receive an HTTP request message sent by an HTTP client, and the HTTP client may be a web browser or an application having a browser function.
  • the request line of the HTTP request message includes a uniform resource identifier of the first file in a CDN source station, and a header of the HTTP request message includes a part of data in the first file.
  • the range information, the partial data of the first file is the target data of the HTTP request message request; on the other hand, the first HTTP request message may not include the range information, and the target range is The scope of the complete data in the first file.
  • Step 101 The CDN server receives and caches complete data of the first file sent from a CDN source station in a first time period based on the first request information, where the CDN source station refers to an original site that publishes content. ;
  • the value indicates that, in the existing technical solution, after receiving the HTTP request message that does not include the range information, the CDN source station will include the corresponding resource identifier according to the uniform resource identifier in the HTTP request message.
  • the complete data of the file and the response code 200 are sent to the CDN server.
  • the existing CDN server includes the response code 200 in determining the HTTP response message, the received data is buffered, and if the CDN source station receives the HTTP request including the range information.
  • the response code carried in the HTTP request message returned by the CDN source station is 206.
  • the existing CDN does not cache the received data.
  • the CDN server after receiving the HTTP response message including the complete data of the first file, the CDN server directly caches the complete data of the first file.
  • the CDN server after receiving the HTTP response message including the complete data of the first file, the CDN server caches the complete data of the first file according to the response code 200.
  • an HTTP request message including range information is received at the CDN server.
  • the CDN server is capable of deleting the range information in the HTTP request message, and sending the deleted HTTP request message to the CDN source station, where the CDN source station receives the HTTP request message that does not include the range information.
  • the CDN server receives the HTTP sent by the CDN source station including the complete data of the first file.
  • the CDN server After the response message, the complete data of the first file is cached, and the CDN server caches the data sent by the CDN source station, so that the CDN server caches the complete data of the first file, so the CDN server Subsequently receiving the HTTP request message of all the requested data of the first file, the CDN server may obtain data from the self cache to respond, and no need to request the data of the first file from the CDN source station. Therefore, waste of processing resources to the CDN source station is avoided, thereby reducing the load of the CDN source station.
  • the CDN server receives the first request information including the first range information at the first moment, and determines the request for the first request information based on the first range information.
  • the CDN server may directly acquire the complete data of the first file by the CDN source station, or detect that the first file does not exist in the CDN server. After the complete data, the CDN source station obtains the complete data of the first file.
  • the CDN server may determine, by using various manners in the prior art, the length of time required to obtain complete data of the first file from the CDN source station, and the duration of the segment is the A period of time.
  • the first time period may be characterized in various manners.
  • the time period of 3:45:5:36 may be used to represent the first time period, or may be required.
  • the duration is 10 minutes or 3 hours to characterize the first period of time, and the countdown to 80 units of time can be used to characterize the first period of time, and so on. In the actual operation process, you can set it yourself according to your needs.
  • Step 102 The CDN server receives second request information in the first time period, where the second request information is Hypertext Transfer Protocol (HTTP) request information including a request range second range information, and the second request message And second source data for requesting the second range information indication.
  • HTTP Hypertext Transfer Protocol
  • Step 103 Detect whether the second target data is part of the data in the first file.
  • the system detects the target of the request corresponding to the other request information. Whether the file where the data is located is the file being cached.
  • Step 104 If yes, determining the second target data from the complete data of the first file cached on the CDN server when a predetermined condition is met, and according to the method on the CDN server The second target data is responsive to the second request message.
  • the system may correspond to the request information cached on the CDN server when a predetermined condition is met.
  • the target data is processed in response.
  • the preset condition may be multiple, as long as it can determine whether the file can be transferred to the CDN server for post-cache processing, thereby saving the processing resources of the CDN source station and satisfying the user experience.
  • Conditions can be used as the preset condition.
  • whether the data size of the first file meets the preset size may be used as the preset condition, so that some small files may be processed in a manner of being cached in a CDN server; Whether the file type of a file conforms to the preset type as the preset condition, so that some files with lower priority levels can be processed in a manner of being cached in the CDN server, and the like.
  • the manner of responding to the request message may be multiple, for example, the notification may be sent to the client that sends the request message, and may be sent to the The manner in which the client requesting the message transmits the required file is responsive, and the method can also be forwarded to the other server for processing, and the like, in the technical solution of the embodiment of the present application. .
  • the CDN server when the CDN server receives one request information, and receives another request information in the process of acquiring and caching a certain file based on the request information, the CDN server detects the Whether the file corresponding to the requested target data corresponding to the request information is a file being cached, and if so, further determining whether the current system condition satisfies a preset condition that can be transferred to the CDN server for processing. Therefore, the system can transfer the file that does not affect the user experience to the CDN server for processing, thereby saving the processing resources of the CDN source station, and has the technical effect of improving the intelligence level of the CDN server and saving the processing resources of the CDN source station.
  • the CDN server receives and caches the complete data of the first file sent from the CDN source station in the first time period based on the first request information, including:
  • the CDN service while the CDN server is in the process of caching the first file Establishing a first cache index corresponding to the first file, where the first cache index includes first source location information of the first file;
  • the detecting whether the second target data is part of the data in the first file includes:
  • the second source location information when the second source location information is consistent with the first source location information, characterizing the second target data as part of data in the first file, when the second source location information is When the first source location information is inconsistent, it is characterized that the second target data is not part of the data in the first file.
  • the method may be determined by determining whether the file source location of the request corresponding to the first request information is consistent with the file source location of the request corresponding to the second request information. Whether the two target data is part of the data in the first file.
  • the original source of the data corresponding to the request information is the CDN source station. Therefore, if two or more pieces of request information correspond to the file location of the requested file in the CDN source station, Then, the files corresponding to the request corresponding to the two or more request information are consistent.
  • the technical solution in the embodiment of the present application utilizes the characteristics that the sources of the files in the CDN system are all the same source station, and can determine whether the file source location of the request corresponding to the first request information is corresponding to the second request information.
  • the file source location is in a consistent manner to determine whether the second target data is part of the data in the first file, and thus has the technical effect of improving file consistency judgment accuracy.
  • the second request message includes:
  • the CDN server receives and caches the complete data of the first file, determining the second target data from the complete data of the first file cached on the CDN server, and according to the The second target data on the CDN server is responsive to the second request message.
  • the request is indicated according to the second range information carried by the second request message
  • the target data is exactly the same as the target data indicated by the first range information carried by the first request message, and the system will always cache the CDN server regardless of the remaining time of the first file cached.
  • the second request message is responded to from the data in the first file cached on the CDN server, so that the CDN server can be prevented from repeatedly requesting completely consistent data from the CDN source station.
  • the target data of the request corresponding to the second request message is completely identical to the target data corresponding to the first request message, and is only cached on the CDN server.
  • the file data is processed in response, and therefore has the technical effect of further saving the processing resources of the CDN source station.
  • the method After the detecting whether the second target data is consistent with the first target data, the method includes:
  • the buffer duration is a duration from a current time to a last moment in the first time period
  • the CDN server determines the second target data from the complete data of the first file cached on the CDN server, and passing The CDN server sends the second target data to a client that issues the second request message.
  • the method further includes:
  • the current moment may be the moment when the second request message is received, or may be after the CDN server receives the second request message and makes a determination of the processing status of the file requested by the CDN server. At the moment, you can set it yourself as needed during actual operation.
  • the CDN server may be less than a preset time at the current time from the time when the first file is cached.
  • the duration that is, when the cache duration is less than the preset duration, and after waiting for the CDN server to cache the first file, responding to the second request message by the complete data of the first file cached on the CDN server
  • the duration of the time period when the current time is cached to complete the first file is greater than or equal to the preset duration, that is, when the buffer duration is greater than or equal to the preset duration
  • the second request is Forwarding information to the CDN source station, and responding to the second request information based on file data on the CDN source station, for example, the second request message corresponding to the second request data may be sent to the request by the CDN source station The way the client responds. This achieves another method of processing the request information using the CDN server without affecting the user experience.
  • the technical solution in the embodiment of the present application may further determine whether the second request message is responded to by the data of the first file buffered by the CDN server by detecting whether the buffer duration is greater than or equal to a preset duration. Or responding by sending, by the CDN source station, the second request message to the requesting client in response to the requested second target data. Therefore, the technical solution in the embodiment of the present application implements another method for processing the request information by using the CDN server without affecting the user experience, and further saves the processing resources of the CDN source station and improves the utilization rate of the CDN server. Technical effects.
  • the embodiment of the present invention further provides a CDN server 20, which is used to implement the foregoing method embodiment, and provides a method for buffering data of a CDN server.
  • the CDN server 20 includes:
  • the first receiving unit 200 is configured to receive first request information and second request information, where the first request information is Hypertext Transfer Protocol (HTTP) request information including a request range first range information, where the first request message is used for And requesting first target data indicated by the first range information in the first file, where the second request information is Hypertext Transfer Protocol (HTTP) request information including a request range second range information, where the second request message is used by And requesting the second target data indicated by the second range information;
  • HTTP Hypertext Transfer Protocol
  • HTTP Hypertext Transfer Protocol
  • the buffer unit 201 is configured to receive and cache complete data of the first file sent from a CDN source station in a first time period based on the first request information, where the CDN source station refers to an original site that publishes content;
  • the detecting unit 202 is configured to detect, when the CDN server receives the second request information in the first time period, whether the second target data is part of data in the first file;
  • the response unit 203 is configured to: when the second target data is part of the first file, and complete a predetermined condition, complete data from the first file cached on the CDN server Determining the second target data and responding to the second request message according to the second target data on the CDN server.
  • the cache unit 201 is further configured to: when in the process of caching the first file, establish a first cache index corresponding to the first file, where the first cache index includes the first First source location information of a file;
  • the detecting unit 202 is configured to detect whether the second source location information is related to the first source location when the second request location information of the file where the second target data is located is included in the second request information.
  • the information is consistent, wherein when the second source location information is consistent with the first source location information, the second target data is characterized as part of the first file, and the second source location information When the first source location information is inconsistent, the second target data is not represented as part of the first file.
  • the detecting unit 202 is further configured to detect whether the second target data is consistent with the first target data
  • the response unit 203 is configured to determine the second target from the complete data of the first file cached on the CDN server after the CDN server receives and caches the complete data of the first file. Data and responding to the second request message based on the second target data on the CDN server.
  • the detecting unit 202 is further configured to: when the second target data is inconsistent with the first target data, detecting whether a buffer duration is greater than or equal to a preset duration, where the buffer duration is from a current time to a location Describe the duration of the last moment in the first time period;
  • the response unit 203 is configured to: after the CDN server receives and caches the complete data of the first file, the first cached on the CDN server, when the cache duration is less than a preset duration Determining the second target data in the complete data of the file, and by using the The CDN server transmits the second target data to a client that issues the second request message.
  • the response unit 203 is further configured to: when the buffer duration is greater than or equal to the preset duration, issue a response instruction to notify that the complete data of the first file on the CDN source station is determined.
  • the second target data, and the second target data is sent by the CDN source station to a client that issues the second request message.
  • FIG. 3 is a schematic diagram of an electronic device according to an embodiment of the present invention.
  • the electronic device includes a bus 301, a memory 302 respectively connected to the bus 301, and a processor 303.
  • the memory 302 is configured to store an instruction;
  • the processor 303 is configured to execute the instruction to perform the following steps when the instruction is executed:
  • the first request information is Hypertext Transfer Protocol (HTTP) request information including a request range first range information, where the first request message is used to request the first file and the first a first target data indicated by a range information;
  • HTTP Hypertext Transfer Protocol
  • the second request information is Hypertext Transfer Protocol (HTTP) request information including a request range second range information, where the second request message is used Requesting second target data indicated by the second range information;
  • HTTP Hypertext Transfer Protocol
  • Embodiments of the present invention provide a non-transitory storage medium for storing a computer program, the computer program including instructions for executing a method for buffering data by the CDN server.
  • Embodiments of the present invention provide a computer program, the computer program including instructions for executing a method for buffering data by a CDN server.
  • the technical solution in the embodiment of the present application may detect that the CDN server receives a request message and receives another request information in the process of acquiring and caching a file based on the request information, the system detects the The target data of the request corresponding to another request information Whether the file is a file being cached, and if so, it is further determined whether the current system condition satisfies a preset condition that can be transferred to the CDN server for processing, thereby making the system not affect the user experience.
  • the file is processed by the CDN server to save the processing resources of the CDN source station, and has the technical effect of improving the intelligence level of the CDN server and saving the processing resources of the CDN source station.
  • the technical solution in the embodiment of the present application utilizes the characteristics that the source of the file in the CDN system is the same source station, and can determine whether the file source location of the request corresponding to the first request information corresponds to the second request information.
  • the requested file source location is in a consistent manner to determine whether the second target data is part of the data in the first file, and thus has the technical effect of improving file consistency determination accuracy.
  • the target data corresponding to the request corresponding to the second request message is completely consistent with the target data corresponding to the first request message, it is only cached on the CDN server.
  • the file data is processed in response, and thus has the technical effect of further saving the processing resources of the CDN source station.
  • the technical solution in the embodiment of the present application may further determine whether the data of the first file buffered by the CDN server responds to the second request by detecting whether the buffer duration is greater than or equal to a preset duration.
  • the message is responded to by the CDN source station in a manner that the second request message is sent to the requesting client corresponding to the requested second target data. Therefore, the technical solution in the embodiment of the present application implements another method for processing the request information by using the CDN server without affecting the user experience, and further saves the processing resources of the CDN source station and improves the utilization rate of the CDN server.
  • 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 portion 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 (may be A personal computer, server, or network device, etc.) performs the methods described in various embodiments or portions of the embodiments.
  • a computer readable storage medium such as a ROM/RAM, a magnetic disk, an optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明实施例提供CDN服务器及其缓存数据的方法,在所述CDN服务器接收到一条请求信息,并基于该请求信息获取并缓存某一文件的过程中接收到了另一请求信息时,系统则会检测所述另一请求信息所对应请求的目标数据所在的文件是否是正在缓存中的文件,如果是,则会进一步判断当前的系统条件是否满足可将文件交由缓存于CDN服务器进行处理的预设条件,由此可以使得系统将不影响用户体验的文件交由CDN服务器进行处理,以此节省CDN源站的处理资源,具有提高CDN服务器的智能化水平和节省CDN源站的处理资源的技术效果。

Description

CDN服务器及其缓存数据的方法
本申请要求在2016年04月25日提交中国专利局、申请号为201610262858.4、发明名称为“CDN服务器及其缓存数据的方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明实施例涉及网络通信领域,尤其涉及CDN服务器及其缓存数据的方法。
背景技术
内容分发网络(Content Delivery Network,CDN)依靠部署在各地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能模块,使用户就近获取所需内容,降低网络拥塞,提高用户访问响应速度和命中率。CDN的关键技术主要有内容存储和分发技术。
CDN网络中的一个节点即为一个CDN服务器,这些CDN服务器分布到用户访问相对集中的地区或网络中。在用户访问网站时,利用全局负载技术将用户的访问指向距离最近的工作正常的CDN服务器上,在CDN服务器缓存有用户访问的数据时,该CDN服务器可以直接响应用户请求,在CDN服务器未缓存有用户访问的数据时,该CDN服务器才向CDN源站请求数据,降低了CDN源站的负载,所述CDN源站是指发布内容的原始站点。
现有技术中,CDN服务器接收到超文本传输协议(HyperText Transfer Protocol,HTTP)请求消息时,若该HTTP请求消息中包括用于指示读取范围的range信息,则该CDN服务器可以从CDN源站或缓存于该CDN服务器的文件中获取到该range信息指示的目标数据。并且,CDN服务器会对获取到的文件采用一缓存索引的方式进行管理,该索引中包括文件标识,以及标识每个文件处于已缓存状态或处于缓存中状态的缓存状态码。此外,CDN服务器还会针对一处理进度表进行维护管理,该处理进度表包括每个请求消息的标识以及每个请求消息的处理进度,例如,每个请求消息的处 理进度可以包括处于未处理状态、处理中状态及已处理状态。
然而,当CDN服务器先后接收到两条或两条以上的超文本传输协议请求消息时,CDN服务器会在处理第一个请求消息时向CDN源站索取数据,而当继续接收到第二个请求消息时,CDN服务器会先根据缓存索引中的文件标识,确定第二个请求消息对应所需的文件的缓存状态,若请求的文件状态处于缓存过程中,则CDN服务器会开始计时,超时该文件还未缓存完则会将该第二请求消息发送到CDN源站进行处理。
由此可见,现有技术中存在着当CDN服务器先后接收到两条或两条以上的超文本传输协议请求消息时,如果第一个请求消息和第二个请求消息对应请求的文件一致,且接收到第二个请求的时刻为CDN服务器正在缓存该对应请求的文件过程中时,只要缓存该文件的时间剩余时间超出预设时间则第二个请求就要发送到CDN源站进行处理,因此造成CDN源站处理资源浪费的技术问题。
发明内容
本发明实施例提供一种CDN服务器及其缓存数据的方法,用以解决现有CDN服务器对HTTP请求消息的处理浪费了CDN源站的处理资源的缺陷,实现CDN服务器针对连续接收到请求同一文件的请求消息时采用更加智能化和高效化的处理方式。
本发明实施例提供一种CDN服务器缓存数据的方法,包括:
CDN服务器接收第一请求信息,所述第一请求信息为包括请求范围第一range信息的超文本传输协议HTTP请求信息,所述第一请求消息用于请求第一文件中的与所述第一range信息指示的第一目标数据;
所述CDN服务器基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,所述CDN源站是指发布内容的原始站点;
所述CDN服务器在所述第一时间段内接收第二请求信息,所述第二请求信息为包括请求范围第二range信息的超文本传输协议HTTP请求信息,所述第二请求消息用于请求所述第二range信息指示的第二目标数据;
检测所述第二目标数据是否为所述第一文件中的部分数据;
若是,则在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
本发明实施例提供一种CDN服务器,包括:
接收第一请求信息和第二请求信息,所述第一请求信息为包括请求范围第一range信息的超文本传输协议HTTP请求信息,所述第一请求消息用于请求第一文件中的与所述第一range信息指示的第一目标数据,所述第二请求信息为包括请求范围第二range信息的超文本传输协议HTTP请求信息,所述第二请求消息用于请求所述第二range信息指示的第二目标数据;所述CDN源站是指发布内容的原始站点;
检测单元,用以当所述CDN服务器在所述第一时间段内接收到所述第二请求信息时,检测所述第二目标数据是否为所述第一文件中的部分数据;
响应单元,用以在所述第二目标数据为所述第一文件中的部分数据,且在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
本发明实施例提供一种电子设备,包括:
存储器,用于存储指令;
处理器,与所述存储器相连,用于执行所述指令,以在执行所述指令时执行如下步骤:
通过CDN服务器接收第一请求信息,所述第一请求信息为包括请求范围第一range信息的超文本传输协议HTTP请求信息,所述第一请求消息用于请求第一文件中的与所述第一range信息指示的第一目标数据;
通过所述CDN服务器基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,所述CDN源站是指发布内容的原始站点;
通过所述CDN服务器在所述第一时间段内接收第二请求信息,所述第二请求信息为包括请求范围第二range信息的超文本传输协议HTTP请求信息,所述第二请求消息用于请求所述第二range信息指示的第二目标数据;
检测所述第二目标数据是否为所述第一文件中的部分数据;
若是,则在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
本发明实施例提供一种非暂态存储介质,所述非暂态存储介质用于存储计算机程序,所述计算机程序包括用于执行前述CDN服务器及其缓存数据的方法的指令。
本发明实施例提供一种计算机程序,所述计算机程序包括用于执行前述CDN服务器及其缓存数据的方法的指令。
本申请实施例中的技术方案可以在CDN服务器接收到一条请求信息,并基于该请求信息获取并缓存某一文件的过程中接收到了另一请求信息时,系统则会检测所述另一请求信息所对应请求的目标数据所在的文件是否是正在缓存中的文件,如果是,则会进一步判断当前的系统条件是否满足可将文件交由缓存于CDN服务器进行处理的预设条件,由此可以使得系统将不影响用户体验的文件交由CDN服务器进行处理,以此节省CDN源站的处理资源,具有提高CDN服务器的智能化水平和节省CDN源站的处理资源的技术效果。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的CDN服务器缓存数据的方法的流程示意图;
图2为本发明实施例提供的CDN服务器的结构图;
图3为本发明实施例提供的电子设备的结构图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例, 并不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
为了使本领域的技术人员更容易理解本发明实施例提供的技术方案,下面首先对本发明实施例涉及到的相关技术进行简单介绍。
HTTP是一套计算机通过网络进行通信的规则,使用HTTP客户端通过发送HTTP请求消息能够向HTTP服务器请求信息和服务,所述HTTP客户端可以为Web浏览器,所述HTTP服务器可以为Web服务器。
HTTP请求消息由三个部分组成:请求行(Request Line)、消息头(Message Headers)和消息体(Entity Body),其中,消息头与消息体之间通过空行来分隔。
具体地,请求行由三个标记组成:请求方法、统一资源标识符(Uniform Resource Identifier,URI)和HTTP版本,例如:GET/news.asp HTTP/1.1。以上代码中“GET”代表请求方法,“/news.asp”表示URI,“HTTP/1.1”代表协议版本。值得说明的是,URI完整地指定了要访问的HTTP服务器中的网络资源,通常只要给出相对于服务器的根目录的相对目录即可。
消息头允许HTTP客户端向HTTP服务器传递关于请求或者关于客户端的附加信息。消息头包括Host头域,Referer头域等字段,其中,Host头域表示请求资源的主机和端口号,Referer头域允许客户端指定请求URI的源资源地址。值得说明的是,Range是在HTTP/1.1里新增的一个头域,range头域允许客户端请求实体的一个或者多个子范围。
消息体用于携带与请求相关联的数据,例如一些请求需要的参数等。由消息头中的内容长度Content-Type和内容类型Content-Length来指示。
CDN服务器作为CDN源站(即HTTP服务器)的代理服务器,客户端发送的HTTP请求消息需先经过CDN服务器,由上述介绍可知,CDN服务器接收到HTTP请求消息后,根据该HTTP请求消息中的统一资源标识符以及range信息即可确定客户端请求的目标数据。但是,现有CDN服务器先后接收到两条或两条以上的超文本传输协议请求消息时,如果第一个请求消息和第二个请求消息对应请求的文件一致,且接收到第二个请求的时刻为CDN服务器正在缓存该对应请求的文件过程中时,只要缓存该文件的时间剩余时间超出预设时间则第二个请求就要发送到CDN源站进行处理,因此 造成CDN源站处理资源浪费的技术问题。
本发明实施例提供一种CDN服务器缓存数据的方法,如图1所示,该方法包括:
步骤100:CDN服务器接收第一请求信息,所述第一请求信息为包括请求范围第一range信息的超文本传输协议HTTP请求信息,所述第一请求消息用于请求第一文件中的与所述第一range信息指示的第一目标数据。
值得说明的是,所述CDN服务器可以是接收到HTTP客户端发送的HTTP请求消息,该HTTP客户端可以是Web浏览器,也可以是具有浏览器功能的应用程序。
具体地,该HTTP请求消息的请求行中包括所述第一文件在CDN源站中的统一资源标识符,该HTTP请求消息的消息头中包括用于指示所述第一文件中的部分数据的range信息,所述第一文件的部分数据即为该HTTP请求消息请求的目标数据;另一方面,所述第一HTTP请求消息也可以不包括range信息,此时,所述目标范围即为所述第一文件中的完整数据的范围。
步骤101:所述CDN服务器基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,所述CDN源站是指发布内容的原始站点;
值的说明的是,现有的技术方案中,CDN源站在接收到不包括range信息的HTTP请求消息后,根据该HTTP请求消息中的统一资源标识符,将包括对应该统一资源标识符的文件的完整数据以及响应码200发送至CDN服务器,现有的CDN服务器在确定HTTP响应消息中包括响应码200时,对接收到的数据进行缓存,若CDN源站接收到包括range信息的HTTP请求消息,则该CDN源站返回的HTTP请求消息中携带的响应码为206,现有的CDN在确定HTTP响应消息中的响应码为206时,对接收到的数据不进行缓存。
而在本发明实施例的一种可能的实现方式中,该CDN服务器接收到包括第一文件的完整数据的HTTP响应消息后,直接对该第一文件的完整数据进行缓存。
在本发明实施例的另一种可能的实现方式中,该CDN服务器接收到包括第一文件的完整数据的HTTP响应消息后,根据响应码200缓存所述第一文件的完整数据。
采用上述方法,在CDN服务器接收到包括range信息的HTTP请求消息 时,所述CDN服务器能够删除所述HTTP请求消息中的range信息,并将删除后的所述HTTP请求消息发送至CDN源站,所述CDN源站在接收到不包括range信息的HTTP请求消息的情况下,将所述HTTP请求消息请求的第一文件的完整数据发送至所述CDN服务器,所述CDN服务器在接收到所述CDN源站发送的包括所述第一文件的完整数据的HTTP响应消息后,对所述第一文件的完整数据进行缓存,实现了CDN服务器对CDN源站发送的数据的缓存,这样,由于CDN服务器缓存有第一文件的完整数据,因此,所述CDN服务器后续接收到的所有请求的所述第一文件的数据的HTTP请求消息,所述CDN服务器均可以从自身缓存中获取数据进行响应,无需再从所述CDN源站请求所述第一文件的数据,从而避免了对所述CDN源站的处理资源浪费,进而减轻了CDN源站的负载。
也就是说,在本步骤的执行过程中,若CDN服务器在第一时刻接收到包括第一range信息的第一请求信息,并基于所述第一range信息确定出所述第一请求信息所请求的目标数据为第一文件中的部分数据时,所述CDN服务器可以直接由CDN源站获取所述第一文件的完整数据,或在检测得到所述CDN服务器中不存在所述第一文件的完整数据之后,再由所述CDN源站获取所述第一文件的完整数据。
值得说明的是,所述CDN服务器可以通过现有技术中的多种方式确定出从CDN源站获取到所述第一文件的完整数据所需花费的时长,而该段时长则为所述第一时间段。在实际操作过程中,所述第一时间段可以通过多种方式来表征,例如,可以采用3点45分到5点36分的时刻方式来表征所述第一时间段,也可以采用所需时长为10分钟或3小时的时长方式来表征所述第一时间段,还可以采用倒计时为80单位时间的倒计时方式来表征所述第一时间段,等等。在实际操作过程中可以根据需要而自行设置。
步骤102:所述CDN服务器在所述第一时间段内接收第二请求信息,所述第二请求信息为包括请求范围第二range信息的超文本传输协议HTTP请求信息,所述第二请求消息用于请求所述第二range信息指示的第二目标数据。
步骤103:检测所述第二目标数据是否为所述第一文件中的部分数据。
也就是说,只要是所述CDN服务器正处于缓存某一文件的过程中接收到了另一请求信息,则系统就会检测所述另一请求信息所对应请求的目标 数据所在的文件是否是正在缓存中的文件。
步骤104:若是,则在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
如果所述另一请求信息所对应请求的目标数据所在的文件正是处于缓存中的文件,则系统会在满足一预设条件时,从缓存于所述CDN服务器上的该请求信息所对应的目标数据进行响应处理。
在实际操作过程中,所述预设条件可以为多种,只要是可以判断可否将文件交由CDN服务器进行缓存后处理,由此节省CDN源站的处理资源,并且能满足用户的使用体验的条件则都可以作为所述预设条件。
例如,可以将所述第一文件的数据量大小是否符合预设大小作为所述预设条件,由此可以将一些小型文件均采用缓存于CDN服务器的方式进行响应处理;还可以将所述第一文件的文件类型是否符合预设类型作为所述预设条件,由此可以将一些优先级别较低的文件采用缓存于CDN服务器的方式进行响应处理,等等。
另一方面,在本申请实施例技术方案的实际操作过程中,响应请求消息的方式可以为多种,例如,可以向发出请求消息的客户端发出通知信息的方式以响应,可以向所述发出请求消息的客户端传输所需文件的方式以响应,还可以将所述发出的请求消息转发到其它服务器进行处理的方式以响应,等等,在本申请实施例的技术方案中并不加限制。
可见,本申请实施例中的技术方案可以在CDN服务器接收到一条请求信息,并基于该请求信息获取并缓存某一文件的过程中接收到了另一请求信息时,所述CDN服务器会检测所述另一请求信息所对应请求的目标数据所在的文件是否是正在缓存中的文件,如果是,则会进一步判断当前的系统条件是否满足可将文件交由缓存于CDN服务器进行处理的预设条件,由此可以使得系统将不影响用户体验的文件交由CDN服务器进行处理,以此节省CDN源站的处理资源,具有提高CDN服务器的智能化水平和节省CDN源站的处理资源的技术效果。
可选地,所述CDN服务器基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,包括:
在所述CDN服务器处于缓存所述第一文件的过程中时,所述CDN服务 器建立与所述第一文件对应的第一缓存索引,所述第一缓存索引包括所述第一文件的第一来源位置信息;
所述检测所述第二目标数据是否为所述第一文件中的部分数据,包括:
在所述第二请求信息中包括所述第二目标数据所在的文件的第二来源位置信息时,检测所述第二来源位置信息是否与所述第一来源位置信息一致;
其中,当所述第二来源位置信息与所述第一来源位置信息一致时,表征所述第二目标数据为所述第一文件中的部分数据,当所述第二来源位置信息与所述第一来源位置信息不一致时,则表征所述第二目标数据不为所述第一文件中的部分数据。
也就是说,在步骤103的执行过程中,可以通过判断第一请求信息所对应请求的文件来源位置,是否与第二请求信息所对应请求的文件来源位置为一致的方式,来判断所述第二目标数据是否为所述第一文件中的部分数据。由于在CDN系统中,请求信息所对应请求的数据原始来源均为CDN源站,因此,如果两条或两条以上的请求信息对应请求的文件在CDN源站中所存放的文件位置一致时,则表征两条或两条以上的请求信息所对应请求的文件为一致。
可见,本申请实施例中的技术方案利用了CDN系统中文件的来源均为同一源站的特性,可以通过判断第一请求信息所对应请求的文件来源位置,是否与第二请求信息所对应请求的文件来源位置为一致的方式,来判断所述第二目标数据是否为所述第一文件中的部分数据,因此具有提高文件一致性判断准确性的技术效果。
可选地,所述在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述第二目标数据响应所述第二请求消息,包括:
检测所述第二目标数据是否与所述第一目标数据一致;
若是,则在所述CDN服务器接收并缓存所述第一文件的完整数据之后,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
也就是说,如果根据第二请求消息所携带的第二range信息所指示请求 的目标数据,与第一请求消息所携带的第一range信息所指示请求的目标数据完全一致,那么系统则会不论缓存所述第一文件的剩余时间为多少,一律会在CDN服务器缓存了所述第一文件的完整数据之后,再从缓存在所述CDN服务器上的第一文件中的数据来响应所述第二请求消息,因此可以避免CDN服务器向CDN源站重复请求完全一致的数据。
可见,在本申请实施例的技术方案中,还可以通过在第二请求消息所对应请求的目标数据与第一请求消息对应请求的目标数据完全一致的情况下,只由缓存于CDN服务器上的文件数据进行响应处理,因此还具有进一步节省CDN源站的处理资源的技术效果。
在所述检测所述第二目标数据是否与所述第一目标数据一致之后,所述方法包括:
若否,则检测缓存时长是否大于等于预设时长,所述缓存时长为从当前时刻到所述第一时间段中的最后时刻的时长;
若否,则在所述CDN服务器接收并缓存所述第一文件的完整数据之后,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并通过所述CDN服务器将所述第二目标数据发送到发出所述第二请求消息的客户端。
可选地,在所述检测缓存时长是否大于等于预设时长之后,所述方法还包括:
若是,则从所述CDN源站上的所述第一文件的完整数据中确定所述第二目标数据,并通过所述CDN源站将所述第二目标数据发送到发出所述第二请求消息的客户端。
需要指出的是,所述当前时刻可以为接收到所述第二请求消息的时刻,也可以是CDN服务器接收到所述第二请求消息并作出判断其所请求的文件的处理状态后的某一时刻,在实际操作过程中可以根据需要而自行设置。
也就是说,当第一请求消息对应请求的第一目标数据所在的文件,与第二请求消息对应请求的第二目标数据所在的文件相同(也就是所述第一请求消息与所述第二请求消息对应请求的目标数据均属于第一文件),然而所述第一目标数据与所述第二目标数据不同(也就是所述第一目标数据和所述第二目标数据为所述第一文件的不同部分数据)时,CDN服务器可以在所述当前时刻距离缓存完毕所述第一文件的时刻这段时长小于一预设 时长,也就是所述缓存时长小于所述预设时长时,而等候CDN服务器缓存完毕第一文件后,由缓存在所述CDN服务器上的第一文件的完整数据来响应所述第二请求消息;还可以在所述当前时刻距离缓存完毕所述第一文件的时刻这段时长大于等于所述预设时长,也就是所述缓存时长大于等于所述预设时长时,将所述第二请求信息转发到CDN源站,并基于所述CDN源站上的文件数据响应所述第二请求信息,例如,可以通过CDN源站将所述第二请求消息对应请求的第二目标数据发往请求客户端的方式进行响应。由此实现了另一种不影响用户使用体验,而采用CDN服务器对请求信息进行处理的方法。
可见,本申请实施例中的技术方案还可以通过检测所述缓存时长是否大于等于预设时长,从而确定是否由所述CDN服务器缓存的所述第一文件的数据来响应所述第二请求消息,或者通过CDN源站将所述第二请求消息对应请求的第二目标数据发往请求客户端的方式进行响应。因此,本申请实施例中的技术方案实现了另一种不影响用户使用体验,而采用CDN服务器对请求信息进行处理的方法,具有进一步节省CDN源站处理资源且提高了CDN服务器的利用率的技术效果。
另外,对于上述方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,例如,该CDN服务器也可以先根据range信息将目标数据发送至客户端,再缓存该第一文件的完整数据。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本发明所必须的。
实施例二
本发明实施例还提供一种CDN服务器20,用于实施上述方法实施例提供一种CDN服务器缓存数据的方法,如图2所示,该CDN服务器20包括:
第一接收单元200,用以接收第一请求信息和第二请求信息,所述第一请求信息为包括请求范围第一range信息的超文本传输协议HTTP请求信息,所述第一请求消息用于请求第一文件中的与所述第一range信息指示的第一目标数据,所述第二请求信息为包括请求范围第二range信息的超文本传输协议HTTP请求信息,所述第二请求消息用于请求所述第二range信息指示的第二目标数据;
缓存单元201,用以基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,所述CDN源站是指发布内容的原始站点;
检测单元202,用以当所述CDN服务器在所述第一时间段内接收到所述第二请求信息时,检测所述第二目标数据是否为所述第一文件中的部分数据;
响应单元203,用以在所述第二目标数据为所述第一文件中的部分数据,且在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
可选地,所述缓存单元201,还用以在处于缓存所述第一文件的过程中时,建立与所述第一文件对应的第一缓存索引,所述第一缓存索引包括所述第一文件的第一来源位置信息;
所述检测单元202,用以在所述第二请求信息中包括所述第二目标数据所在的文件的第二来源位置信息时,检测所述第二来源位置信息是否与所述第一来源位置信息一致,其中,当所述第二来源位置信息与所述第一来源位置信息一致时,表征所述第二目标数据为所述第一文件中的部分数据,当所述第二来源位置信息与所述第一来源位置信息不一致时,则表征所述第二目标数据不为所述第一文件中的部分数据。
可选地,所述检测单元202,还用以检测所述第二目标数据是否与所述第一目标数据一致;
所述响应单元203,用以在所述CDN服务器接收并缓存所述第一文件的完整数据之后,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
可选地,所述检测单元202,还用以在所述第二目标数据与所述第一目标数据不一致时,检测缓存时长是否大于等于预设时长,所述缓存时长为从当前时刻到所述第一时间段中的最后时刻的时长;
所述响应单元203,用以在所述缓存时长小于预设时长时,在所述CDN服务器接收并缓存所述第一文件的完整数据之后,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并通过所述 CDN服务器将所述第二目标数据发送到发出所述第二请求消息的客户端。
可选地,所述响应单元203,还用以在所述缓存时长大于等于所述预设时长时,发出响应指令以通知从所述CDN源站上的所述第一文件的完整数据中确定所述第二目标数据,并通过所述CDN源站将所述第二目标数据发送到发出所述第二请求消息的客户端。
图3为本发明实施例提供的电子设备的示意图,电子设备包括:总线301以及分别连接总线301的存储器302以及处理器303。其中,存储器302用于存储指令;处理器303用于执行所述指令,以在执行所述指令时执行如下步骤:
通过CDN服务器接收第一请求信息,所述第一请求信息为包括请求范围第一range信息的超文本传输协议HTTP请求信息,所述第一请求消息用于请求第一文件中的与所述第一range信息指示的第一目标数据;
通过所述CDN服务器基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,所述CDN源站是指发布内容的原始站点;
通过所述CDN服务器在所述第一时间段内接收第二请求信息,所述第二请求信息为包括请求范围第二range信息的超文本传输协议HTTP请求信息,所述第二请求消息用于请求所述第二range信息指示的第二目标数据;
检测所述第二目标数据是否为所述第一文件中的部分数据;
若是,则在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
本发明实施例提供一种非暂态存储介质,所述非暂态存储介质用于存储计算机程序,所述计算机程序包括用于执行前述CDN服务器缓存数据的方法的指令。
本发明实施例提供一种计算机程序,所述计算机程序包括用于执行前述CDN服务器缓存数据的方法的指令。
由此可见,本申请实施例中的技术方案可以在CDN服务器接收到一条请求信息,并基于该请求信息获取并缓存某一文件的过程中接收到了另一请求信息时,系统则会检测所述另一请求信息所对应请求的目标数据所在 的文件是否是正在缓存中的文件,如果是,则会进一步判断当前的系统条件是否满足可将文件交由缓存于CDN服务器进行处理的预设条件,由此可以使得系统将不影响用户体验的文件交由CDN服务器进行处理,以此节省CDN源站的处理资源,具有提高CDN服务器的智能化水平和节省CDN源站的处理资源的技术效果。
本申请实施例中的技术方案还具有如下技术效果:
进一步地,本申请实施例中的技术方案利用了CDN系统中文件的来源均为同一源站的特性,可以通过判断第一请求信息所对应请求的文件来源位置,是否与第二请求信息所对应请求的文件来源位置为一致的方式,来判断所述第二目标数据是否为所述第一文件中的部分数据,因此具有提高文件一致性判断准确性的技术效果。
进一步地,在本申请实施例的技术方案中,还可以通过在第二请求消息所对应请求的目标数据与第一请求消息对应请求的目标数据完全一致的情况下,只由缓存于CDN服务器上的文件数据进行响应处理,因此还具有进一步节省CDN源站的处理资源的技术效果。
进一步地,本申请实施例中的技术方案还可以通过检测所述缓存时长是否大于等于预设时长,从而确定是否由所述CDN服务器缓存的所述第一文件的数据来响应所述第二请求消息,或者通过CDN源站将所述第二请求消息对应请求的第二目标数据发往请求客户端的方式进行响应。因此,本申请实施例中的技术方案实现了另一种不影响用户使用体验,而采用CDN服务器对请求信息进行处理的方法,具有进一步节省CDN源站处理资源且提高了CDN服务器的利用率的技术效果。
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡 献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims (13)

  1. 一种CDN服务器缓存数据的方法,其特征在于,包括:
    CDN服务器接收第一请求信息,所述第一请求信息为包括请求范围第一range信息的超文本传输协议HTTP请求信息,所述第一请求消息用于请求第一文件中的与所述第一range信息指示的第一目标数据;
    所述CDN服务器基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,所述CDN源站是指发布内容的原始站点;
    所述CDN服务器在所述第一时间段内接收第二请求信息,所述第二请求信息为包括请求范围第二range信息的超文本传输协议HTTP请求信息,所述第二请求消息用于请求所述第二range信息指示的第二目标数据;
    检测所述第二目标数据是否为所述第一文件中的部分数据;
    若是,则在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
  2. 如权利要求1所述的方法,其特征在于,所述CDN服务器基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,包括:
    在所述CDN服务器处于缓存所述第一文件的过程中时,所述CDN服务器建立与所述第一文件对应的第一缓存索引,所述第一缓存索引包括所述第一文件的第一来源位置信息;
    所述检测所述第二目标数据是否为所述第一文件中的部分数据,包括:
    在所述第二请求信息中包括所述第二目标数据所在的文件的第二来源位置信息时,检测所述第二来源位置信息是否与所述第一来源位置信息一致;
    其中,当所述第二来源位置信息与所述第一来源位置信息一致时,表征所述第二目标数据为所述第一文件中的部分数据,当所述第二来源位置信息与所述第一来源位置信息不一致时,则表征所述第二目标数据 不为所述第一文件中的部分数据。
  3. 如权利要求1所述的方法,其特征在于,所述在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述第二目标数据响应所述第二请求消息,包括:
    检测所述第二目标数据是否与所述第一目标数据一致;
    若是,则在所述CDN服务器接收并缓存所述第一文件的完整数据之后,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
  4. 如权利要求3所述的方法,其特征在于,在所述检测所述第二目标数据是否与所述第一目标数据一致之后,所述方法包括:
    若否,则检测缓存时长是否大于等于预设时长,所述缓存时长为从当前时刻到所述第一时间段中的最后时刻的时长;
    若否,则在所述CDN服务器接收并缓存所述第一文件的完整数据之后,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并通过所述CDN服务器将所述第二目标数据发送到发出所述第二请求消息的客户端。
  5. 如权利要求4所述的方法,其特征在于,在所述检测缓存时长是否大于等于预设时长之后,所述方法还包括:
    若是,则从所述CDN源站上的所述第一文件的完整数据中确定所述第二目标数据,并通过所述CDN源站将所述第二目标数据发送到发出所述第二请求消息的客户端。
  6. 一种CDN服务器,其特征在于,包括:
    第一接收单元,用以接收第一请求信息和第二请求信息,所述第一请求信息为包括请求范围第一range信息的超文本传输协议HTTP请求信息,所述第一请求消息用于请求第一文件中的与所述第一range信息指示的第一目标数据,所述第二请求信息为包括请求范围第二range信息的超文本传输协议HTTP请求信息,所述第二请求消息用于请求所述第二range信息指示的第二目标数据;
    缓存单元,用以基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,所述CDN源站是指发布 内容的原始站点;
    检测单元,用以当所述CDN服务器在所述第一时间段内接收到所述第二请求信息时,检测所述第二目标数据是否为所述第一文件中的部分数据;
    响应单元,用以在所述第二目标数据为所述第一文件中的部分数据,且在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
  7. 如权利要求6所述的CDN服务器,其特征在于,所述缓存单元,还用以在处于缓存所述第一文件的过程中时,建立与所述第一文件对应的第一缓存索引,所述第一缓存索引包括所述第一文件的第一来源位置信息;
    所述检测单元,用以在所述第二请求信息中包括所述第二目标数据所在的文件的第二来源位置信息时,检测所述第二来源位置信息是否与所述第一来源位置信息一致,其中,当所述第二来源位置信息与所述第一来源位置信息一致时,表征所述第二目标数据为所述第一文件中的部分数据,当所述第二来源位置信息与所述第一来源位置信息不一致时,则表征所述第二目标数据不为所述第一文件中的部分数据。
  8. 如权利要求6所述的CDN服务器,其特征在于,所述检测单元,还用以检测所述第二目标数据是否与所述第一目标数据一致;
    所述响应单元,用以在所述CDN服务器接收并缓存所述第一文件的完整数据之后,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
  9. 如权利要求8所述的CDN服务器,其特征在于,所述检测单元,还用以在所述第二目标数据与所述第一目标数据不一致时,检测缓存时长是否大于等于预设时长,所述缓存时长为从当前时刻到所述第一时间段中的最后时刻的时长;
    所述响应单元,用以在所述缓存时长小于预设时长时,在所述CDN服务器接收并缓存所述第一文件的完整数据之后,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并通过所 述CDN服务器将所述第二目标数据发送到发出所述第二请求消息的客户端。
  10. 如权利要求9所述的CDN服务器,其特征在于,所述响应单元,还用以在所述缓存时长大于等于所述预设时长时,发出响应指令以通知从所述CDN源站上的所述第一文件的完整数据中确定所述第二目标数据,并通过所述CDN源站将所述第二目标数据发送到发出所述第二请求消息的客户端。
  11. 一种电子设备,其特征在于,包括:
    存储器,用于存储指令;
    处理器,与所述存储器相连,用于执行所述指令,以在执行所述指令时执行如下步骤:
    通过CDN服务器接收第一请求信息,所述第一请求信息为包括请求范围第一range信息的超文本传输协议HTTP请求信息,所述第一请求消息用于请求第一文件中的与所述第一range信息指示的第一目标数据;
    通过所述CDN服务器基于所述第一请求信息在第一时间段内接收并缓存从CDN源站发送的所述第一文件的完整数据,所述CDN源站是指发布内容的原始站点;
    通过所述CDN服务器在所述第一时间段内接收第二请求信息,所述第二请求信息为包括请求范围第二range信息的超文本传输协议HTTP请求信息,所述第二请求消息用于请求所述第二range信息指示的第二目标数据;
    检测所述第二目标数据是否为所述第一文件中的部分数据;
    若是,则在满足一预设条件时,从缓存于所述CDN服务器上的所述第一文件的完整数据中确定所述第二目标数据,并根据所述CDN服务器上的所述第二目标数据响应所述第二请求消息。
  12. 一种非暂态存储介质,其特征在于,所述非暂态存储介质用于存储计算机程序,所述计算机程序包括用于执行权利要求1至5任一项所述的方法的指令。
  13. 一种计算机程序,其特征在于,所述计算机程序包括用于执行权利要求1至5任一项所述的方法的指令。
PCT/CN2016/100422 2016-04-25 2016-09-27 Cdn服务器及其缓存数据的方法 WO2017185633A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610262858.4A CN105959358A (zh) 2016-04-25 2016-04-25 Cdn服务器及其缓存数据的方法
CN201610262858.4 2016-04-25

Publications (1)

Publication Number Publication Date
WO2017185633A1 true WO2017185633A1 (zh) 2017-11-02

Family

ID=56915562

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/100422 WO2017185633A1 (zh) 2016-04-25 2016-09-27 Cdn服务器及其缓存数据的方法

Country Status (2)

Country Link
CN (1) CN105959358A (zh)
WO (1) WO2017185633A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515545A (zh) * 2021-06-30 2021-10-19 北京百度网讯科技有限公司 数据查询方法、装置、系统、电子设备以及存储介质
CN114172945A (zh) * 2021-11-26 2022-03-11 武汉烽火技术服务有限公司 一种模拟实现全双工即时通信方法与设备

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105959358A (zh) * 2016-04-25 2016-09-21 乐视控股(北京)有限公司 Cdn服务器及其缓存数据的方法
CN107241398B (zh) * 2017-05-24 2019-09-03 中广热点云科技有限公司 一种基于内容分发网络的视频下载方法
CN111385157B (zh) * 2018-12-27 2022-06-03 厦门白山耘科技有限公司 一种服务器异常检测方法及装置
CN110855786B (zh) * 2019-11-18 2022-07-29 天津联想协同科技有限公司 针对网络数据请求的处理方法、设备及计算机存储介质
CN111314414B (zh) * 2019-12-17 2021-09-28 聚好看科技股份有限公司 数据传输方法、装置及系统
CN113590915A (zh) * 2021-06-30 2021-11-02 影石创新科技股份有限公司 一种分片数据的缓存、访问方法、装置、终端及存储介质
CN113849125B (zh) * 2021-08-30 2024-01-09 北京东方网信科技股份有限公司 一种cdn服务器磁盘读取的方法、装置及系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101662483A (zh) * 2008-08-28 2010-03-03 盛大计算机(上海)有限公司 云计算网络的缓存系统及其方法
US20130205030A1 (en) * 2009-03-27 2013-08-08 Amazon Technologies, Inc. Managing resources in resource cache components
CN103475679A (zh) * 2012-06-06 2013-12-25 百度在线网络技术(北京)有限公司 对分片请求进行定长对齐的缓存方法、系统及装置
CN104185036A (zh) * 2014-09-10 2014-12-03 北京奇艺世纪科技有限公司 一种视频文件回源方法及装置
CN104967677A (zh) * 2015-06-05 2015-10-07 无锡量子云数字新媒体科技有限公司 一种基于ndn缓存优化的文件传输方法以及装置
CN105959358A (zh) * 2016-04-25 2016-09-21 乐视控股(北京)有限公司 Cdn服务器及其缓存数据的方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8463846B2 (en) * 2010-05-06 2013-06-11 Cdnetworks Co., Ltd. File bundling for cache servers of content delivery networks
WO2013086707A1 (zh) * 2011-12-14 2013-06-20 华为技术有限公司 内容分发网络cdn路由方法、设备和系统
CN103747112A (zh) * 2013-12-24 2014-04-23 乐视网信息技术(北京)股份有限公司 一种cdn回源的方法、第一服务器及系统
CN104935648B (zh) * 2015-06-03 2018-07-17 北京快网科技有限公司 一种高性价比的cdn系统及文件预推、分片缓存的方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101662483A (zh) * 2008-08-28 2010-03-03 盛大计算机(上海)有限公司 云计算网络的缓存系统及其方法
US20130205030A1 (en) * 2009-03-27 2013-08-08 Amazon Technologies, Inc. Managing resources in resource cache components
CN103475679A (zh) * 2012-06-06 2013-12-25 百度在线网络技术(北京)有限公司 对分片请求进行定长对齐的缓存方法、系统及装置
CN104185036A (zh) * 2014-09-10 2014-12-03 北京奇艺世纪科技有限公司 一种视频文件回源方法及装置
CN104967677A (zh) * 2015-06-05 2015-10-07 无锡量子云数字新媒体科技有限公司 一种基于ndn缓存优化的文件传输方法以及装置
CN105959358A (zh) * 2016-04-25 2016-09-21 乐视控股(北京)有限公司 Cdn服务器及其缓存数据的方法

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515545A (zh) * 2021-06-30 2021-10-19 北京百度网讯科技有限公司 数据查询方法、装置、系统、电子设备以及存储介质
CN113515545B (zh) * 2021-06-30 2024-05-14 北京百度网讯科技有限公司 数据查询方法、装置、系统、电子设备以及存储介质
CN114172945A (zh) * 2021-11-26 2022-03-11 武汉烽火技术服务有限公司 一种模拟实现全双工即时通信方法与设备
CN114172945B (zh) * 2021-11-26 2023-05-26 武汉烽火技术服务有限公司 一种模拟实现全双工即时通信方法与设备

Also Published As

Publication number Publication date
CN105959358A (zh) 2016-09-21

Similar Documents

Publication Publication Date Title
WO2017185633A1 (zh) Cdn服务器及其缓存数据的方法
US10411956B2 (en) Enabling planned upgrade/downgrade of network devices without impacting network sessions
CN111614736A (zh) 网络内容资源调度方法、域名调度服务器及电子设备
US10491657B2 (en) Network acceleration method, apparatus and device based on router device
US8326985B2 (en) Distributed management of keep-alive message signaling for mobile network resource conservation and optimization
US8606996B2 (en) Cache optimization
US8966066B2 (en) Application and network-based long poll request detection and cacheability assessment therefor
WO2017190641A1 (zh) 拦截爬虫的方法、装置、服务器终端以及计算机可读介质
CN106534243B (zh) 基于http协议的缓存、请求、响应方法及相应装置
CN111124819B (zh) 全链路监控的方法和装置
US7970856B2 (en) System and method for managing and distributing assets over a network
WO2013078875A1 (zh) 内容的管理方法的方法、装置和系统
WO2012145544A2 (en) Device resource sharing for network resource conservation
WO2019006775A1 (zh) 一种数据传输方法及其系统
US9088462B2 (en) Common web accessible data store for client side page processing
WO2017080459A1 (zh) 服务内容的缓存及提供方法、装置、系统和存储介质
WO2013023306A1 (en) Stream processing using a client-server architecture
GB2495172A (en) Web page script management
US9787791B2 (en) Managing a data cache for a computer system
JP2020102838A5 (zh)
US11204971B1 (en) Token-based authentication for a proxy web scraping service
US20150006622A1 (en) Web contents transmission method and apparatus
WO2017097092A1 (zh) 缓存集群服务的处理方法及系统
WO2013113150A1 (zh) 缓存优化的方法、缓存器和缓存优化的系统
CN113079210A (zh) 一种跨区数据自动同步的配置方法、终端设备及存储介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 16900142

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16900142

Country of ref document: EP

Kind code of ref document: A1