WO2018177286A1 - 一种静态资源请求处理方法及装置 - Google Patents

一种静态资源请求处理方法及装置 Download PDF

Info

Publication number
WO2018177286A1
WO2018177286A1 PCT/CN2018/080671 CN2018080671W WO2018177286A1 WO 2018177286 A1 WO2018177286 A1 WO 2018177286A1 CN 2018080671 W CN2018080671 W CN 2018080671W WO 2018177286 A1 WO2018177286 A1 WO 2018177286A1
Authority
WO
WIPO (PCT)
Prior art keywords
static resource
requests
resource request
total
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2018/080671
Other languages
English (en)
French (fr)
Inventor
胡龙军
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Publication of WO2018177286A1 publication Critical patent/WO2018177286A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application 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/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a static resource request processing method and apparatus.
  • each web page operator needs to change the status of the web page frequently according to the holiday, news or user feedback requirements, etc., which needs to be implemented through a static resource request, and the static resource request of the web page is mainly used to change the display of the web page and The function of the web page.
  • the transmission of each static resource request requires a HyperText Transfer Protocol (HTTP) request from the server and the client.
  • HTTP HyperText Transfer Protocol
  • the present invention provides a static resource request processing method and apparatus, which are used to solve the technical problem of slow processing speed caused by too many HTTP request connections in the prior art.
  • the present invention provides a method for processing a static resource request, including:
  • N static resource requests where N is an integer greater than one
  • the N static resource requests are classified into M type static resource requests, and M is a positive integer smaller than N;
  • Each type of static resource request in the type M static resource request is separately combined and merged into M total static resource requests;
  • the classifying the N static resource requests includes: determining a function of the N static resource requests, classifying the N static resource requests based on the function; or determining the The N static resource request generation time, the N static resource requests are classified according to the generation time; or the acquisition source of the N static resource requests is determined, and the N statics are determined based on the acquisition source Resource requests are categorized.
  • the merging each type of static resource request in the type M static resource request separately includes: combining all static resource requests in each type of static resource request into one total static resource request. Separating each static resource request in each type of static resource request by a preset symbol.
  • the merging each type of the static resource request in the M type static resource request separately includes: using the NGINX server and the LUA language, each type of static resource in the M type static resource request Request to merge separately.
  • a method for processing a static resource request including:
  • the total static resource request after deleting the domain name information is divided, and multiple sub-requests are obtained;
  • the plurality of sub-requests are respectively executed.
  • the step of dividing the total static resource request after deleting the domain name information by using the preset division rule includes: dividing the total static resource request after deleting the domain name information by using a preset symbol as a separator.
  • the method further includes: combining execution results of executing the multiple sub-requests into the cache.
  • the method further includes: performing MD5 verification on the merged execution result to obtain a K value; when receiving the K value and obtaining When the new static resource request with the same K value is requested, the execution result is written into the cache as the execution result of the new static resource request.
  • a processing device for requesting a static resource includes:
  • a first acquiring module configured to acquire N static resource requests, where N is an integer greater than one
  • a classification module configured to classify the N static resource requests into M type static resource requests, where M is a positive integer smaller than N;
  • a merging module configured to merge each type of static resource request in the type M static resource request into a total of two static resource requests
  • a sending module configured to send the M total static resource requests to the client.
  • a processing device for requesting a static resource including
  • a second obtaining module configured to obtain a total static resource request
  • a deleting module configured to delete domain name information in the total static resource request
  • the dividing module is configured to divide the total static resource request after deleting the domain name information by using a preset dividing rule, and obtain multiple sub-requests;
  • An execution module is configured to separately execute the plurality of sub-requests.
  • the method and device provided by the embodiments of the present application combine the same type of static resource requests in multiple static resource requests, and then send the combined total static resource requests to the client to reduce the number of static resource requests, thereby reducing the need.
  • FIG. 1 is a flowchart of a method for processing a static resource request according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of a method for processing a static resource request according to Embodiment 2 of the present invention
  • FIG. 3 is a schematic structural diagram of a device for processing a static resource request according to Embodiment 3 of the present invention.
  • FIG. 4 is a schematic structural diagram of a device for processing a static resource request according to Embodiment 4 of the present invention.
  • the embodiment of the present application provides a static resource request processing method and device, which is used to solve the technical problem that the processing speed is slow due to the excessive number of HTTP request connections in the prior art.
  • the technical effect of improving the processing speed of static resource request is realized.
  • N static resource requests where N is an integer greater than 1; classifying the N static resource requests into M type static resource requests, where M is a positive integer less than N; Each type of static resource request is separately merged and merged into M total static resource requests; the M total static resource requests are sent to the client.
  • the foregoing method combines the same type of static resource requests in multiple static resource requests, and then sends the combined total static resource requests to the client to reduce the number of static resource requests, thereby reducing the number of HTTP request connections that need to be established. This speeds up the processing of static resource requests.
  • This embodiment provides a method for processing a static resource request. As shown in FIG. 1 , the method includes:
  • Step S101 Acquire N static resource requests, where N is an integer greater than 1.
  • Step S102 classifying the N static resource requests into M type static resource requests, where M is a positive integer smaller than N;
  • Step S103 Combine each type of static resource request in the M type static resource request, and merge them into M total static resource requests.
  • Step S104 Send the M total static resource requests to the client.
  • the method may be applied to a server.
  • step S101 is executed to acquire N static resource requests, where N is an integer greater than 1.
  • N static resource requests may be requests for writing by the webpage maintenance personnel, or may be requests received by other electronic devices, and are not limited herein.
  • step S102 is performed to classify the N static resource requests into M class static resource requests, where M is a positive integer smaller than N.
  • the classifying the N static resource requests includes:
  • the request may divide the N static resource requests into three categories according to functions.
  • the static resource requests corresponding to the same webpage domain name may be classified into one class according to the N static resource request.
  • step S103 each type of static resource request in the M type static resource request is separately combined and merged into M total static resource requests.
  • the first type is divided by a preset separator.
  • the merging each type of static resource request in the M type static resource request separately includes:
  • All static resource requests in each type of static resource request are combined into one total static resource request, and each static resource request in each type of static resource request is separated by a preset symbol.
  • the preset symbol may be a semicolon, a comma, a dash, a slash, or a space, and is not listed here, nor is it limited.
  • the requests that need to be merged are a1, a2, a3, and a4, and the semicolon is used as a separator to merge them into a1; a2; a3; a4.
  • the requests to be merged are a1, a2, a3, and a4, they are merged into a1AND a2AND a3AND a4 using the preset statement "AND".
  • the merging of the static resource request is mainly implemented by the NGINX server and the LUA scripting language.
  • step S104 is executed to send the M total static resource requests to the client.
  • the M total static resource requests are sent to the client, and only M HTTP request connections need to be established, thereby reducing the number of HTTP request connections. , improve the processing speed of static resource requests.
  • the present application further provides a method corresponding to the processing method of the static resource request in the first embodiment.
  • a method corresponding to the processing method of the static resource request in the first embodiment For details, refer to the second embodiment.
  • This embodiment provides a method for processing a static resource request. As shown in FIG. 2, the method includes:
  • Step S201 Acquire a total static resource request.
  • Step S202 deleting domain name information in the total static resource request
  • Step S203 according to the preset division rule, dividing the total static resource request after deleting the domain name information, and obtaining a plurality of sub-requests;
  • Step S204 respectively executing the plurality of sub-requests.
  • the method provided in this embodiment corresponds to the method provided in the first embodiment.
  • the method of the first embodiment is mainly for the merging of the static resource request, and the method provided by the embodiment is to solve the problem of how to divide and execute the original static resource request from the merged static resource request.
  • the method of this embodiment can be applied to a client.
  • step S201 is performed to obtain a total static resource request.
  • the server may send the combined total static resource request in Embodiment 1 to the client by using an HTTP request connection established with the client.
  • step S202 is performed to delete the domain name information in the total static resource request.
  • the static resource request has domain name information of the webpage that needs to be changed to determine which webpage needs to be changed, and the domain name information may be deleted before each sub-request is divided. .
  • step S203 is executed to divide the total static resource request after deleting the domain name information according to the preset division rule, and obtain a plurality of sub-requests.
  • the method for dividing the total static resource request in this embodiment should be corresponding to the merging method of the total static resource request in the first embodiment, so as to achieve accurate division.
  • the method for dividing the total static resource request after deleting the domain name information is: dividing the total static resource request after deleting the domain name information by using the preset symbol as a separator.
  • the preset symbol may be a semicolon, a comma, a dash, a slash, or a space, and is not listed here, nor is it limited.
  • step S204 is performed to execute the plurality of sub-requests respectively.
  • the method further includes:
  • the execution result of executing the plurality of sub-requests is merged into the cache.
  • the method further includes:
  • the execution result of each execution is merged into the cache, and when the same total static resource request is received subsequently, the execution result stored in the cache can be directly extracted and used, which can be extremely Reduce the amount of calculation and increase the calculation speed.
  • the MD5 check may be performed on each execution result to obtain the K corresponding to the total static resource request. value.
  • the K value can be written to help the client determine whether the received total static resource request has been received. If the subsequent request for the same K value is received, the execution result is directly written into the cache to reduce the amount of system calculation.
  • the client returns the K value to the server to make the server maintenance personnel know, and then write the same total static resource request B next time.
  • the client obtains the total static resource request B
  • the client obtains the total static resource request B, by extracting the K value, it can be determined that the total static resource request B and the total static resource request A are the same request, that is, the total static
  • the execution result of the resource request A is extracted and used directly.
  • the present application further provides an apparatus corresponding to the processing method of the static resource request in the first embodiment.
  • an apparatus corresponding to the processing method of the static resource request in the first embodiment.
  • the embodiment provides a processing device for a static resource request. As shown in FIG. 3, the device includes:
  • the first obtaining module 301 is configured to acquire N static resource requests, where N is an integer greater than 1.
  • the classification module 302 is configured to classify the N static resource requests into M type static resource requests, where M is a positive integer smaller than N;
  • the merging module 303 is configured to separately merge each type of static resource request in the M-type static resource request, and merge them into M total static resource requests.
  • the sending module 304 is configured to send the M total static resource requests to the client.
  • the device may be a stand-alone server or a server group composed of multiple servers, which is not limited herein.
  • the device introduced in the third embodiment of the present invention is a device used in the method for processing a static resource request according to the first embodiment of the present invention. Therefore, those skilled in the art can understand the device according to the method introduced in the first embodiment of the present invention. The specific structure and deformation, and therefore will not be described here.
  • the apparatus used in the method of the first embodiment of the present invention is within the scope of the present invention.
  • the present application further provides an apparatus corresponding to the processing method of the static resource request in the second embodiment.
  • an apparatus corresponding to the processing method of the static resource request in the second embodiment.
  • the embodiment provides a processing device for a static resource request. As shown in FIG. 4, the device includes:
  • the second obtaining module 401 is configured to obtain a total static resource request.
  • the deleting module 402 is configured to delete the domain name information in the total static resource request.
  • the dividing module 403 is configured to divide the total static resource request after deleting the domain name information according to a preset dividing rule, and obtain a plurality of sub-requests;
  • the executing module 404 is configured to separately execute the plurality of sub-requests.
  • the device may be an Android system, an IOS system, or a Windows system, and is not limited herein.
  • the device may be a smart phone, a tablet computer or a desktop computer, and is not limited herein.
  • the device introduced in the fourth embodiment of the present invention is a device used in the method for processing the static resource request according to the second embodiment of the present invention. Therefore, those skilled in the art can understand the device according to the method described in the second embodiment of the present invention. The specific structure and deformation, and therefore will not be described here.
  • the apparatus used in the method of the second embodiment of the present invention is within the scope of the present invention.
  • the method and device provided by the embodiments of the present application combine the same type of static resource requests in multiple static resource requests, and then send the combined total static resource requests to the client to reduce the number of static resource requests, thereby reducing the need.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

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

Abstract

本发明公开了一种静态资源请求的处理方法和装置,其中方法包括:获取N个静态资源请求,N为大于1的整数;对N个静态资源请求进行分类,分为M类静态资源请求,M为小于N的正整数;将M类静态资源请求中的每一类静态资源请求分别进行合并,共合并为M个总静态资源请求;发送M个总静态资源请求至客户端。方法还包括:获取总静态资源请求;删除总静态资源请求中的域名信息;按预设划分规则,对删除域名信息后的总静态资源请求进行划分,获得多个分请求;分别执行多个分请求。本申请提供的方法和装置可以解决现有技术中HTTP请求连接数过多导致的处理速度慢的技术问题,实现了提高静态资源请求处理速度的技术效果。

Description

一种静态资源请求处理方法及装置 技术领域
本发明涉及计算机技术领域,尤其涉及一种静态资源请求处理方法及装置。
背景技术
目前,随着网络通信技术的进步和宽带网络的提速,越来越多的用户使用网络页面来交流或获取信息。
为了提升用户体验,各网页运营商需要根据节日、新闻或用户反馈需求等来频繁的更改网页的状态,这就需要通过静态资源请求来实现,网页的静态资源请求主要用来更改网页的显示及网页的功能。而每条静态资源请求的传输均需要服务器与客户端建立对应的超文本传输协议(HyperText Transfer Protocol,HTTP)请求来实现,当网页更改较多时,对应的静态资源请求数量就多,需要建立的HTTP请求连接数就越多。
然而,HTTP请求连接数过多会极大的影响客户端和服务器端对静态资源请求的处理速度,导致处理速度慢的技术问题。
发明内容
本发明提供一种静态资源请求处理方法及装置,用以解决现有技术中HTTP请求连接数过多导致的处理速度慢的技术问题。
一方面,本发明提供了一种静态资源请求的处理方法,包括:
获取N个静态资源请求,N为大于1的整数;
对所述N个静态资源请求进行分类,分为M类静态资源请求,M为小于N的正整数;
将所述M类静态资源请求中的每一类静态资源请求分别进行合并,共合并为M个总静态资源请求;
发送所述M个总静态资源请求至客户端。
可选的,所述对所述N个静态资源请求进行分类,包括:确定所述N个静态资源请求的功能,基于所述功能对所述N个静态资源请求进行分类;或者,确定所述N个静态资源请求的生成时间,基于所述生成时间对所述N个静态资源请求进行分类;或者,确定所述N个静态资源请求的获取来源,基于所述获取来源对所述N个静态资源请求进行分类。
可选的,所述将所述M类静态资源请求中的每一类静态资源请求分别进行合并,包括:将所述每一类静态资源请求中的所有静态资源请求合并在一条总 静态资源请求中,以预设符号分隔所述每一类静态资源请求中的每条静态资源请求。
可选的,所述将所述M类静态资源请求中的每一类静态资源请求分别进行合并,包括:通过NGINX服务器和LUA语言,将所述M类静态资源请求中的每一类静态资源请求分别进行合并。
另一方面,提供一种静态资源请求的处理方法,包括:
获取总静态资源请求;
删除所述总静态资源请求中的域名信息;
按预设划分规则,对删除域名信息后的总静态资源请求进行划分,获得多个分请求;
分别执行所述多个分请求。
可选的,所述按预设划分规则,对删除域名信息后的总静态资源请求进行划分,包括:以预设符号为分隔符,对删除域名信息后的总静态资源请求进行划分。
可选的,在所述分别执行所述多个分请求之后,还包括:将执行所述多个分请求的执行结果合并写入缓存。
可选的,在所述将执行所述多个分请求的执行结果写入缓存之后,还包括:对合并后的所述执行结果进行MD5校验以获得K值;当收到K值与获得的所述K值相同的新静态资源请求时,把所述执行结果作为所述新静态资源请求的执行结果写入缓存。
再一方面,提供一种静态资源请求的处理装置,包括:
第一获取模块,用于获取N个静态资源请求,N为大于1的整数;
分类模块,用于对所述N个静态资源请求进行分类,分为M类静态资源请求,M为小于N的正整数;
合并模块,用于将所述M类静态资源请求中的每一类静态资源请求分别进行合并,共合并为M个总静态资源请求;
发送模块,用于发送所述M个总静态资源请求至客户端。
再一方面,提供一种静态资源请求的处理装置,包括
第二获取模块,用于获取总静态资源请求;
删除模块,用于删除所述总静态资源请求中的域名信息;
划分模块,用于按预设划分规则,对删除域名信息后的总静态资源请求进行划分,获得多个分请求;
执行模块,用于分别执行所述多个分请求。
本发明实施例中提供的一个或多个技术方案,至少具有如下技术效果或优 点:
本申请实施例提供的方法及装置,对多个静态资源请求中的同一类静态资源请求进行合并,再将合并后的总静态资源请求发送至客户端,以减少静态资源请求数量,从而减少需要建立的HTTP请求连接数,进而加快对静态资源请求的处理速度。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例一中静态资源请求的处理方法的流程图;
图2为本发明实施例二中静态资源请求的处理方法的流程图;
图3为本发明实施例三中静态资源请求的处理装置的结构示意图;
图4为本发明实施例四中静态资源请求的处理装置的结构示意图。
具体实施方式
本申请实施例通过提供一种静态资源请求处理方法及装置,用以解决现有技术中HTTP请求连接数过多导致的处理速度慢的技术问题。实现了提高静态资源请求处理速度的技术效果。
本申请实施例中的技术方案,总体思路如下:
获取N个静态资源请求,N为大于1的整数;对所述N个静态资源请求进行分类,分为M类静态资源请求,M为小于N的正整数;将所述M类静态资源请求中的每一类静态资源请求分别进行合并,共合并为M个总静态资源请求;发送所述M个总静态资源请求至客户端。
上述方法通过对多个静态资源请求中的同一类静态资源请求进行合并,再将合并后的总静态资源请求发送至客户端,以减少静态资源请求数量,从而减少需要建立的HTTP请求连接数,进而加快对静态资源请求的处理速度。
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中 的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
实施例一
本实施例提供一种静态资源请求的处理方法,如图1所示,所述方法包括:
步骤S101,获取N个静态资源请求,N为大于1的整数;
步骤S102,对所述N个静态资源请求进行分类,分为M类静态资源请求,M为小于N的正整数;
步骤S103,将所述M类静态资源请求中的每一类静态资源请求分别进行合并,共合并为M个总静态资源请求;
步骤S104,发送所述M个总静态资源请求至客户端。
在本申请实施例中,所述方法可以应用于服务器端。
下面,结合图1详细介绍所述静态资源请求的处理方法的实施步骤。
首先,执行步骤S101,获取N个静态资源请求,N为大于1的整数。
需要说明的是,所述N个静态资源请求可以是网页维护人员撰写输入的请求,也可以是接收到的其他电子设备发送的请求,在此不作限制。
然后,执行步骤S102,对所述N个静态资源请求进行分类,分为M类静态资源请求,M为小于N的正整数。
在本申请实施例中,所述对所述N个静态资源请求进行分类,包括:
确定所述N个静态资源请求的功能,基于所述功能对所述N个静态资源请求进行分类;或者,
确定所述N个静态资源请求的生成时间,基于所述生成时间对所述N个静态资源请求进行分类;
确定所述N个静态资源请求的获取来源,基于所述获取来源对所述N个静态资源请求进行分类。
举例来说,当所述N个静态资源请求中有一部分是用于改变网页显示状态的请求,还有一部分是用于改变网页播放音乐的请求,另外还有一部分是用于改变网页交互模式的请求,则可以将所述N个静态资源请求按照功能分为三类。
当然,在具体实施过程中,还可以根据N个静态资源请求所针对更改的网页的网页域名来进行分类,即,将同一网页域名对应的静态资源请求划分为一类。
再下来,执行步骤S103,将所述M类静态资源请求中的每一类静态资源请求分别进行合并,共合并为M个总静态资源请求。
例如,假设12个静态资源请求按照功能分为8个用于网页显示更改和4个用于网页功能更改两大类,则对应可以将所述8个用于网页显示更改的静态资源 请求合并为一条请求,将4个用于网页功能更改的静态资源请求合并为另一条请求,合并后共有2条总静态资源请求,只需要建立2条HTTP请求连接,能大大减少需要建立的HTTP请求连接数量。
在本申请实施例中,合并所述静态资源请求的方法较多,下面列举两种为例:
第一种、采用预设分隔符号来划分。
即,所述将所述M类静态资源请求中的每一类静态资源请求分别进行合并,包括:
将所述每一类静态资源请求中的所有静态资源请求合并在一条总静态资源请求中,以预设符号分隔所述每一类静态资源请求中的每条静态资源请求。
具体来讲,所述预设符号可以是分号、逗号、破折号、斜杠或空格等,在此不再一一列举,也不作限制。
例如:需要合并的请求为a1,a2,a3和a4,则以分号为分隔符,将其合并为a1;a2;a3;a4。
第二种,采用预设语句来划分。
例如,需要合并的请求为a1,a2,a3和a4,则采用预设语句“AND”将其合并为a1AND a2AND a3AND a4。
在本申请实施例中,对静态资源请求的合并主要是通过NGINX服务器和LUA脚本语言来实现的。
再下来,执行步骤S104,发送所述M个总静态资源请求至客户端。
具体来讲,由于通过合并同类的静态资源请求减少了静态资源请求的数量,故发送所述M个总静态资源请求至客户端,只需要建立M条HTTP请求连接,减少了HTTP请求连接的数量,提高了静态资源请求的处理速度。
基于同一发明构思,本申请还提供了与实施例一中静态资源请求的处理方法对应的方法,详见实施例二。
实施例二
本实施例提供了一种静态资源请求的处理方法,如图2所示,所述方法包括:
步骤S201,获取总静态资源请求;
步骤S202,删除所述总静态资源请求中的域名信息;
步骤S203,按预设划分规则,对删除域名信息后的总静态资源请求进行划分,获得多个分请求;
步骤S204,分别执行所述多个分请求。
需要说明的是,本实施例中提供的方法是与实施例一中提供的方法对应 的。实施例一的方法主要是对静态资源请求的合并,而本实施例提供的方法是解决如何从合并后的静态资源请求中划分出原来的各条静态资源请求,并执行。
在具体实施过程中,本实施例的方法可以应用于客户端。
下面,结合图2,详细介绍本实施例提供的静态资源请求的处理方法的实施步骤:
首先,执行步骤S201,获取总静态资源请求。
具体来讲,可以是服务器通过与客户端建立的HTTP请求连接,将实施例一中合并后的所述总静态资源请求发送至所述客户端。
然后,执行步骤S202,删除所述总静态资源请求中的域名信息。
具体来讲,由于静态资源请求中除了各条分请求外,还有需要更改的网页的域名信息,以确定需要更改的是哪个网页,在划分出各分请求前,可以先删除所述域名信息。
再下来,执行步骤S203,按预设划分规则,对删除域名信息后的总静态资源请求进行划分,获得多个分请求。
需要说明的是,本实施例中对总静态资源请求进行划分的方法,应该与实施例一中该总静态资源请求的合并方法对应,才能实现准确划分。
举例来说,如果所述总静态资源请求的合并方法为:将所述每一类静态资源请求中的所有静态资源请求合并在一条总静态资源请求中,以预设符号分隔所述每一类静态资源请求中的每条静态资源请求。则对应的,对删除域名信息后的总静态资源请求进行划分的方法为:以所述预设符号为分隔符,对删除域名信息后的总静态资源请求进行划分。
具体来讲,所述预设符号可以是分号、逗号、破折号、斜杠或空格等,在此不再一一列举,也不作限制。
采用预设语句来合并生成总静态资源请求时的划分方法与之类似,在此不再累述。
然后,执行步骤S204,分别执行所述多个分请求。
在本申请实施例中,在所述分别执行所述多个分请求之后,还包括:
将执行所述多个分请求的执行结果合并写入缓存。
进一步,在所述将执行所述多个分请求的执行结果写入缓存之后,还包括:
对合并后的所述执行结果进行MD5校验以获得K值;
当收到K值与获得的所述K值相同的新静态资源请求时,把所述执行结果作为所述新静态资源请求的执行结果写入缓存。
具体来讲,将每次的所述执行结果合并写入缓存,能并于后续再接收到同 样的总静态资源请求时,能直接提取缓存中存储的所述执行结果来使用,能极大的减少计算量,提高计算速度。
进一步,为了能便于判断后续接收到的总静态资源请求是否与之前执行过的总静态资源请求为相同的请求,可以对每次的执行结果进行MD5校验以获得该总静态资源请求对应的K值。在后续其他总静态资源请求中可以通过写入K值来帮助客户端判断接收到的总静态资源请求是否曾经接收过。如果后续收到同样K值的请求时直接把执行结果写入缓存,以减少系统计算量。
例如,对总静态资源请求A进行MD5校验,获得K值为x时,客户端返回该K值至服务器端,以使服务器端的维护人员获知,则下次再编写同样的总静态资源请求B时,可以写入同样的K值x,当客户端获得总静态资源请求B时,通过提取出K值,就可以判断出总静态资源请求B与总静态资源请求A是同一请求,即将总静态资源请求A的执行结果提取出来,直接使用。
基于同一发明构思,本申请还提供了与实施例一中静态资源请求的处理方法对应的装置,详见实施例三。
实施例三
本实施例提供了一种静态资源请求的处理装置,如图3所示,该装置包括:
第一获取模块301,用于获取N个静态资源请求,N为大于1的整数;
分类模块302,用于对所述N个静态资源请求进行分类,分为M类静态资源请求,M为小于N的正整数;
合并模块303,用于将所述M类静态资源请求中的每一类静态资源请求分别进行合并,共合并为M个总静态资源请求;
发送模块304,用于发送所述M个总静态资源请求至客户端。
在本申请实施例中,所述装置可以是一台独立的服务器,也可以是多台服务器组成的服务器群,在此不作限制。
由于本发明实施例三所介绍的装置,为实施本发明实施例一的静态资源请求的处理方法所采用的装置,故而基于本发明实施例一所介绍的方法,本领域所属人员能够了解该装置的具体结构及变形,故而在此不再赘述。凡是本发明实施例一的方法所采用的装置都属于本发明所欲保护的范围。
基于同一发明构思,本申请还提供了与实施例二中静态资源请求的处理方法对应的装置,详见实施例四。
实施例四
本实施例提供了一种静态资源请求的处理装置,如图4所示,所述装置包括:
第二获取模块401,用于获取总静态资源请求;
删除模块402,用于删除所述总静态资源请求中的域名信息;
划分模块403,用于按预设划分规则,对删除域名信息后的总静态资源请求进行划分,获得多个分请求;
执行模块404,用于分别执行所述多个分请求。
在本申请实施例中,所述装置可以为Android系统,IOS系统或Windows系统,在此不作限制。所述装置可以为智能手机,平板电脑或台式机,在此也不作限制。
由于本发明实施例四所介绍的装置,为实施本发明实施例二的静态资源请求的处理方法所采用的装置,故而基于本发明实施例二所介绍的方法,本领域所属人员能够了解该装置的具体结构及变形,故而在此不再赘述。凡是本发明实施例二的方法所采用的装置都属于本发明所欲保护的范围。
本申请实施例中提供的技术方案,至少具有如下技术效果或优点:
本申请实施例提供的方法及装置,对多个静态资源请求中的同一类静态资源请求进行合并,再将合并后的总静态资源请求发送至客户端,以减少静态资源请求数量,从而减少需要建立的HTTP请求连接数,进而加快对静态资源请求的处理速度。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处 理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明实施例进行各种改动和变型而不脱离本发明实施例的精神和范围。这样,倘若本发明实施例的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (10)

  1. 一种静态资源请求的处理方法,其特征在于,包括:
    获取N个静态资源请求,N为大于1的整数;
    对所述N个静态资源请求进行分类,分为M类静态资源请求,M为小于N的正整数;
    将所述M类静态资源请求中的每一类静态资源请求分别进行合并,共合并为M个总静态资源请求;
    发送所述M个总静态资源请求至客户端。
  2. 如权利要求1所述的方法,其特征在于,所述对所述N个静态资源请求进行分类,包括:
    确定所述N个静态资源请求的功能,基于所述功能对所述N个静态资源请求进行分类;或者,
    确定所述N个静态资源请求的生成时间,基于所述生成时间对所述N个静态资源请求进行分类;或者,
    确定所述N个静态资源请求的获取来源,基于所述获取来源对所述N个静态资源请求进行分类。
  3. 如权利要求1所述的方法,其特征在于,所述将所述M类静态资源请求中的每一类静态资源请求分别进行合并,包括:
    将所述每一类静态资源请求中的所有静态资源请求合并在一条总静态资源请求中,以预设符号分隔所述每一类静态资源请求中的每条静态资源请求。
  4. 如权利要求1所述的方法,其特征在于,所述将所述M类静态资源请求中的每一类静态资源请求分别进行合并,包括:
    通过NGINX服务器和LUA语言,将所述M类静态资源请求中的每一类静态资源请求分别进行合并。
  5. 一种静态资源请求的处理方法,其特征在于,包括:
    获取总静态资源请求;
    删除所述总静态资源请求中的域名信息;
    按预设划分规则,对删除域名信息后的总静态资源请求进行划分,获得多个分请求;
    分别执行所述多个分请求。
  6. 如权利要求5所述的方法,其特征在于,所述按预设划分规则,对删除域名信息后的总静态资源请求进行划分,包括:
    以预设符号为分隔符,对删除域名信息后的总静态资源请求进行划分。
  7. 如权利要求5所述的方法,其特征在于,在所述分别执行所述多个分请 求之后,还包括:
    将执行所述多个分请求的执行结果合并写入缓存。
  8. 如权利要求7所述的方法,其特征在于,在所述将执行所述多个分请求的执行结果写入缓存之后,还包括:
    对合并后的所述执行结果进行MD5校验以获得K值;
    当收到K值与获得的所述K值相同的新静态资源请求时,把所述执行结果作为所述新静态资源请求的执行结果写入缓存。
  9. 一种静态资源请求的处理装置,其特征在于,包括:
    第一获取模块,用于获取N个静态资源请求,N为大于1的整数;
    分类模块,用于对所述N个静态资源请求进行分类,分为M类静态资源请求,M为小于N的正整数;
    合并模块,用于将所述M类静态资源请求中的每一类静态资源请求分别进行合并,共合并为M个总静态资源请求;
    发送模块,用于发送所述M个总静态资源请求至客户端。
  10. 一种静态资源请求的处理装置,其特征在于,包括
    第二获取模块,用于获取总静态资源请求;
    删除模块,用于删除所述总静态资源请求中的域名信息;
    划分模块,用于按预设划分规则,对删除域名信息后的总静态资源请求进行划分,获得多个分请求;
    执行模块,用于分别执行所述多个分请求。
PCT/CN2018/080671 2017-03-27 2018-03-27 一种静态资源请求处理方法及装置 Ceased WO2018177286A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710190250.XA CN106941530B (zh) 2017-03-27 2017-03-27 一种静态资源请求处理方法及装置
CN201710190250.X 2017-03-27

Publications (1)

Publication Number Publication Date
WO2018177286A1 true WO2018177286A1 (zh) 2018-10-04

Family

ID=59463148

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/080671 Ceased WO2018177286A1 (zh) 2017-03-27 2018-03-27 一种静态资源请求处理方法及装置

Country Status (2)

Country Link
CN (1) CN106941530B (zh)
WO (1) WO2018177286A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106941530B (zh) * 2017-03-27 2019-04-05 武汉斗鱼网络科技有限公司 一种静态资源请求处理方法及装置
CN107545058B (zh) * 2017-08-29 2019-12-03 北京北信源软件股份有限公司 一种页面加载方法、服务器及浏览器
CN107729495A (zh) * 2017-10-18 2018-02-23 郑州云海信息技术有限公司 一种文件元数据浏览方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101888404A (zh) * 2010-05-27 2010-11-17 北京开心人信息技术有限公司 一种移动设备数据更新的方法及装置
US20110196988A1 (en) * 2002-02-01 2011-08-11 Codekko Software, Inc. System and Method for Partial Data Compression and Data Transfer
CN103701714A (zh) * 2013-12-25 2014-04-02 北京奇虎科技有限公司 页面提取方法、服务器及网络系统
CN104580495A (zh) * 2015-01-21 2015-04-29 百度在线网络技术(北京)有限公司 网络请求处理方法和装置
CN106294597A (zh) * 2016-07-28 2017-01-04 百度在线网络技术(北京)有限公司 用于对网页的静态资源进行分组的方法和装置
CN106941530A (zh) * 2017-03-27 2017-07-11 武汉斗鱼网络科技有限公司 一种静态资源请求处理方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8577889B2 (en) * 2006-07-18 2013-11-05 Aol Inc. Searching for transient streaming multimedia resources
CN102184231A (zh) * 2011-05-12 2011-09-14 广州市动景计算机科技有限公司 获取页面资源的方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110196988A1 (en) * 2002-02-01 2011-08-11 Codekko Software, Inc. System and Method for Partial Data Compression and Data Transfer
CN101888404A (zh) * 2010-05-27 2010-11-17 北京开心人信息技术有限公司 一种移动设备数据更新的方法及装置
CN103701714A (zh) * 2013-12-25 2014-04-02 北京奇虎科技有限公司 页面提取方法、服务器及网络系统
CN104580495A (zh) * 2015-01-21 2015-04-29 百度在线网络技术(北京)有限公司 网络请求处理方法和装置
CN106294597A (zh) * 2016-07-28 2017-01-04 百度在线网络技术(北京)有限公司 用于对网页的静态资源进行分组的方法和装置
CN106941530A (zh) * 2017-03-27 2017-07-11 武汉斗鱼网络科技有限公司 一种静态资源请求处理方法及装置

Also Published As

Publication number Publication date
CN106941530B (zh) 2019-04-05
CN106941530A (zh) 2017-07-11

Similar Documents

Publication Publication Date Title
US10025878B1 (en) Data lineage analysis
US9612946B2 (en) Using linked data to determine package quality
JP6080866B2 (ja) ネットワーク文書の1つまたは複数の動的視覚オブジェクトをマッピングするコンピュータ化された方法、システム、およびコンピュータ・プログラム
CN108287708A (zh) 一种数据处理方法、装置、服务器及计算机可读存储介质
CN107862044A (zh) 展示页面的方法和装置
CN114996675A (zh) 数据查询方法、装置、计算机设备及存储介质
CN108897858A (zh) 分布式集群索引分片的评估方法及装置、电子设备
TW202027003A (zh) 受理區塊鏈存證交易的方法及系統
CN113452733A (zh) 文件下载方法和装置
WO2023071566A1 (zh) 数据处理方法、装置、计算机设备、计算机可读存储介质及计算机程序产品
CN107944063A (zh) 一种基于主题模型与用户群组的新闻推荐方法及系统
US10929412B2 (en) Sharing content based on extracted topics
CN103324484B (zh) 一种展现视图的方法及设备
CN106941530B (zh) 一种静态资源请求处理方法及装置
US20250124053A1 (en) Method and system for automatic data clustering
US20170093652A1 (en) Visualization hypertext
US20200151227A1 (en) Computing system with dynamic web page feature
CN116821493A (zh) 消息推送方法、装置、计算机设备及存储介质
CN104598554B (zh) 网页页面加载方法及装置
US11429400B2 (en) User interface metadata from an application program interface
CN109587224B (zh) 数据处理方法、装置、电子设备及计算机可读介质
US20150261733A1 (en) Asset collection service through capture of content
CN113849686B (zh) 一种视频数据获取方法、装置、电子设备及存储介质
CN117573543A (zh) 测试数据的生成方法及装置、电子设备和存储介质
CN104572921A (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: 18774454

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: 18774454

Country of ref document: EP

Kind code of ref document: A1