CN111368237B - Distributed website cache staticizing method, server and system - Google Patents

Distributed website cache staticizing method, server and system Download PDF

Info

Publication number
CN111368237B
CN111368237B CN202010156646.4A CN202010156646A CN111368237B CN 111368237 B CN111368237 B CN 111368237B CN 202010156646 A CN202010156646 A CN 202010156646A CN 111368237 B CN111368237 B CN 111368237B
Authority
CN
China
Prior art keywords
client
request
returning
service
cache
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010156646.4A
Other languages
Chinese (zh)
Other versions
CN111368237A (en
Inventor
郑浩然
陈思远
姜祝进
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuxi Kaiyun Information Technology Co ltd
Original Assignee
Wuxi Kaiyun Information 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 Wuxi Kaiyun Information Technology Co ltd filed Critical Wuxi Kaiyun Information Technology Co ltd
Priority to CN202010156646.4A priority Critical patent/CN111368237B/en
Publication of CN111368237A publication Critical patent/CN111368237A/en
Application granted granted Critical
Publication of CN111368237B publication Critical patent/CN111368237B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to the technical field of website caching, and particularly discloses a distributed website caching staticizing method, which comprises the following steps: receiving a service request sent by a client; judging the type of the service request; if the type of the service request is a page request, returning a request processing result to the client according to a page request processing mode; and if the type of the service request is interface service, returning a request processing result to the client according to an interface service processing mode. The invention also discloses a server and a distributed website cache staticizing system. The distributed website cache staticizing method provided by the invention has the advantages of light weight, low cost, compatibility, reduced resource waste, improved website response speed and reduced operation and maintenance cost.

Description

Distributed website cache staticizing method, server and system
Technical Field
The invention relates to the technical field of website caching, in particular to a distributed website caching staticizing method, a server and a distributed website caching staticizing system comprising the server.
Background
For many websites, the main function is to display information, while many traditional websites dynamically load data and dynamically acquire pages, but most of the contents are unchanged, and such requests often cause resource waste, especially when the access amount is increased, the database is crashed or the whole website is crashed. In order to avoid these resource waste, it is necessary to make the website static and cache the data.
Meanwhile, in the distributed website, the traditional solution is to cache the data at the server, so that manpower is required to develop the required cache function, and the situation of data asynchronization can occur. For websites which do not adopt front-end and back-end separation, static pages are generally in a dynamic server, even in a container with interface service, each http request needs to consume resources, the request of the container is limited, once the interface is blocked, the request of the whole website is blocked, and the website cannot access, so that the situation is a huge disaster for the website.
Current websites are written in a number of languages, such as python, php, java, c# and the like, and for each language, different techniques are required to achieve caching and statics. In the case of high concurrency, it is often adopted to add servers, cluster the servers, and the resources occupied by the server are huge, and good hardware is needed to support, so that a part of expenses are increased. In view of these problems, a convenient, fast, lightweight, and compatible method is needed to solve these problems.
Disclosure of Invention
The invention provides a distributed website cache staticizing method, a server and a distributed website cache staticizing system comprising the server, which solve the problem that the server occupies large resources due to the lack of a method with good lightweight compatibility in the related technology.
As a first aspect of the present invention, there is provided a distributed website cache stationing method, including:
receiving a service request sent by a client;
judging the type of the service request;
if the type of the service request is a page request, returning a request processing result to the client according to a page request processing mode;
and if the type of the service request is interface service, returning a request processing result to the client according to an interface service processing mode.
Further, if the type of the service request is a page request, returning a request processing result to the client according to a page request processing mode, including:
if the type of the service request is a page request, judging whether static HTML (hypertext markup language) is generated or not;
if the static HTML is generated, returning the static HTML to the client;
and if the static HTML is not generated, generating an HTML page and returning to the client.
Further, the generating the HTML page and returning to the client includes:
generating an HTML page by intercepting data sent to the client;
and compressing the HTML page, and returning the compressed HTML page to the client.
Further, if the type of the service request is an interface service, returning a request processing result to the client according to an interface service processing mode, including:
if the type of the service request is interface service, judging whether cache exists in Redis;
if the cache exists, returning cache data to the client;
if no cache exists, intercepting the data returned to the client;
and saving the intercepted data to the Redis and returning to the client.
Further, if the type of the service request is interface service, returning a request processing result to the client according to an interface service processing mode further includes that before the intercepted data is saved in the dis and returned to the client:
and compressing the intercepted data.
As another aspect of the present invention, there is provided a server, including:
the receiving module is used for receiving the service request sent by the client;
the judging module is used for judging the type of the service request;
the first processing module is used for returning a request processing result to the client according to a page request processing mode if the type of the service request is a page request;
and the second processing module is used for returning a request processing result to the client according to an interface service processing mode if the type of the service request is the interface service.
Further, the first processing module includes:
the first judging unit is used for judging whether static HTML (hypertext markup language) is generated or not if the type of the service request is a page request;
the first return unit is used for returning the static HTML to the client if the static HTML is generated;
and the second return unit is used for generating an HTML page and returning to the client if the static HTML is not generated.
Further, the second processing module includes:
the second judging unit is used for judging whether the Redis has a cache or not if the type of the service request is interface service;
the third return unit is used for returning the cache data to the client if the cache exists;
the interception unit is used for intercepting the data returned to the client if the cache does not exist;
and the fourth return unit is used for saving the intercepted data to the Redis and returning to the client.
As another aspect of the present invention, there is provided a distributed website cache stationing system, including a client and a server as described above, where the client is communicatively connected to the server;
the client is used for sending a service request to the server and receiving a request processing result returned by the server;
the server is used for receiving the service request and processing the service request to obtain a request processing result.
The distributed website cache staticizing method provided by the invention judges the service request of the client, then respectively processes the service requests according to different types, and returns the processing result to the client. The distributed website cache staticizing method can be light in weight, low in cost and compatible to achieve website cache and website staticizing, reduces resource waste, improves website response speed and reduces operation and maintenance cost.
Drawings
The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification, illustrate the invention and together with the description serve to explain, without limitation, the invention. In the drawings:
FIG. 1 is a flow chart of a method for staticizing a distributed website cache.
FIG. 2 is a flowchart illustrating a specific implementation process of the method for stationing a distributed website cache.
FIG. 3 is a schematic diagram of a static HTML and cached update page according to the present invention.
Detailed Description
It should be noted that, without conflict, the embodiments of the present invention and features of the embodiments may be combined with each other. The invention will be described in detail below with reference to the drawings in connection with embodiments.
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the invention herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In this embodiment, a method for stationing a distributed website cache is provided, and fig. 1 is a flowchart of the method for stationing a distributed website cache provided according to an embodiment of the present invention, as shown in fig. 1, including:
s110, receiving a service request sent by a client;
s120, judging the type of the service request;
s130, if the type of the service request is a page request, returning a request processing result to the client according to a page request processing mode;
and S140, if the type of the service request is interface service, returning a request processing result to the client according to an interface service processing mode.
The distributed website cache staticizing method provided by the embodiment of the invention judges the service request of the client, then respectively processes the service requests according to different types, and returns the processing result to the client. The distributed website cache staticizing method can be light in weight, low in cost and compatible to achieve website cache and website staticizing, reduces resource waste, improves website response speed and reduces operation and maintenance cost.
The following describes in detail a specific implementation procedure of the distributed website cache stationing method according to an embodiment of the present invention with reference to fig. 1 to 3.
It will be appreciated that at the client, the user may enter a configuration center to choose to configure the web site under the full domain name, including page and service interfaces, or to choose to configure the page address and interface services separately that need to be static, to choose the frequency of page updates, or to choose the version number function. If the update frequency is selected, the page and interface will periodically update the most up-to-date page and cache (as shown in FIG. 3) based on the update frequency. If the selected version is good, the latest version notification can be manually input, and the server can judge whether the page and the cache need to be updated according to the latest version number.
Specifically, if the type of the service request is a page request, returning a request processing result to the client according to a page request processing mode, including:
if the type of the service request is a page request, judging whether static HTML (HyperText Markup Language ) is generated;
if the static HTML is generated, returning the static HTML to the client;
and if the static HTML is not generated, generating an HTML page and returning to the client.
Further specifically, the generating the HTML page and returning to the client includes:
generating an HTML page by intercepting data sent to the client;
and compressing the HTML page, and returning the compressed HTML page to the client.
It can be understood that the client requests the cache server, the server receives the service request, judges the request type of the current request, if the request is a page request, judges whether static HTML is generated in the server, if the request is a page request, the static HTML is returned to the client, if the request is not a page request, the server is requested to generate an HTML page by intercepting the data returned by the server, the page is compressed, the bandwidth is reduced, the request is returned to the client, and the next request of the client is requested to the static HTML without requesting the server.
Specifically, if the type of the service request is interface service, returning a request processing result to the client according to an interface service processing mode, including:
if the type of the service request is interface service, judging whether cache exists in Redis (Remote Dictionary Serve, remote dictionary service);
if the cache exists, returning cache data to the client;
if no cache exists, intercepting the data returned to the client;
and saving the intercepted data to the Redis and returning to the client.
Further specifically, if the type of the service request is interface service, returning a request processing result to the client according to an interface service processing manner further includes performing before the intercepted data is saved in the dis and returned to the client:
and compressing the intercepted data.
It can be understood that if the client requests interface service, whether cache exists in the Redis is judged, if so, cache data is returned, if no request server exists, data returned by the interception server is compressed and stored in the Redis, then the data is returned to the client, and the client accesses the cache in the distributed cache server next time.
In the event that the server stops, the client may still have access to the cached data and pages. Thus, the server can be maintained and upgraded gracefully.
When the concurrency of the cache server is insufficient, only the node of the cache server needs to be added, and meanwhile, because of the light weight, the added concurrency is huge when one node is added, and meanwhile, the expenditure of adding the service node is little.
As another embodiment of the present invention, there is provided a server including:
the receiving module is used for receiving the service request sent by the client;
the judging module is used for judging the type of the service request;
the first processing module is used for returning a request processing result to the client according to a page request processing mode if the type of the service request is a page request;
and the second processing module is used for returning a request processing result to the client according to an interface service processing mode if the type of the service request is the interface service.
The server provided by the embodiment of the invention judges the service request of the client, then respectively processes the service request according to different types of service requests, and returns the processing result to the client. The server can be light in weight and low in cost, and compatibility is achieved for caching websites and staticizing websites, so that resource waste is reduced, response speed of websites is improved, and operation and maintenance cost is reduced.
Specifically, the first processing module includes:
the first judging unit is used for judging whether static HTML (hypertext markup language) is generated or not if the type of the service request is a page request;
the first return unit is used for returning the static HTML to the client if the static HTML is generated;
and the second return unit is used for generating an HTML page and returning to the client if the static HTML is not generated.
Specifically, the second processing module includes:
the second judging unit is used for judging whether the Redis has a cache or not if the type of the service request is interface service;
the third return unit is used for returning the cache data to the client if the cache exists;
the interception unit is used for intercepting the data returned to the client if the cache does not exist;
and the fourth return unit is used for saving the intercepted data to the Redis and returning to the client.
It should be noted that, for the specific working principle of the server, reference may be made to the foregoing description of the method for stationing the distributed website cache, which is not repeated herein.
As another embodiment of the present invention, a distributed website cache staticizing system is provided, where the system includes a client and the server described above, where the client is communicatively connected to the server;
the client is used for sending a service request to the server and receiving a request processing result returned by the server;
the server is used for receiving the service request and processing the service request to obtain a request processing result.
According to the distributed website cache staticizing system provided by the embodiment of the invention, the server judges the service requests of the client, then respectively processes the service requests according to different types of service requests, and returns a processing result to the client. The distributed website cache staticizing system can be light in weight, low in cost and compatible to achieve website cache and website staticizing, reduces resource waste, improves website response speed and reduces operation and maintenance cost.
It should be noted that, for the specific working principle of the distributed website cache stationing system, reference may be made to the description of the distributed website cache stationing method, which is not repeated herein.
It is to be understood that the above embodiments are merely illustrative of the application of the principles of the present invention, but not in limitation thereof. Various modifications and improvements may be made by those skilled in the art without departing from the spirit and substance of the invention, and are also considered to be within the scope of the invention.

Claims (5)

1. The method for staticizing the distributed website cache is characterized by comprising the following steps:
receiving a service request sent by a client;
judging the type of the service request;
if the type of the service request is a page request, returning a request processing result to the client according to a page request processing mode;
if the type of the service request is interface service, returning a request processing result to the client according to an interface service processing mode;
and if the service request is of the type of the page request, returning a request processing result to the client according to a page request processing mode, wherein the method comprises the following steps:
if the type of the service request is a page request, judging whether static HTML (hypertext markup language) is generated or not;
if the static HTML is generated, returning the static HTML to the client;
if static HTML is not generated, generating an HTML page and returning to the client;
the generating the HTML page and returning to the client includes:
generating an HTML page by intercepting data sent to the client;
compressing the HTML page, and returning the compressed HTML page to the client;
and if the type of the service request is interface service, returning a request processing result to the client according to an interface service processing mode, wherein the method comprises the following steps:
if the type of the service request is interface service, judging whether cache exists in Redis;
if the cache exists, returning cache data to the client;
if no cache exists, intercepting the data returned to the client;
storing the intercepted data into a Redis and returning the intercepted data to the client;
if the type of the service request is interface service, returning a request processing result to the client according to an interface service processing mode further comprises the steps of before the intercepted data is stored in the Redis and returned to the client:
and compressing the intercepted data.
2. A server for implementing the distributed website cache staticizing method as recited in claim 1, comprising:
the receiving module is used for receiving the service request sent by the client;
the judging module is used for judging the type of the service request;
the first processing module is used for returning a request processing result to the client according to a page request processing mode if the type of the service request is a page request;
and the second processing module is used for returning a request processing result to the client according to an interface service processing mode if the type of the service request is the interface service.
3. The server of claim 2, wherein the first processing module comprises:
the first judging unit is used for judging whether static HTML (hypertext markup language) is generated or not if the type of the service request is a page request;
the first return unit is used for returning the static HTML to the client if the static HTML is generated;
and the second return unit is used for generating an HTML page and returning to the client if the static HTML is not generated.
4. A server according to claim 3, wherein the second processing module comprises:
the second judging unit is used for judging whether the Redis has a cache or not if the type of the service request is interface service;
the third return unit is used for returning the cache data to the client if the cache exists;
the interception unit is used for intercepting the data returned to the client if the cache does not exist;
and the fourth return unit is used for saving the intercepted data to the Redis and returning to the client.
5. A distributed website cache staticizing system, comprising a client and the server of any one of claims 2 to 4, wherein the client is communicatively connected to the server;
the client is used for sending a service request to the server and receiving a request processing result returned by the server;
the server is used for receiving the service request and processing the service request to obtain a request processing result.
CN202010156646.4A 2020-03-09 2020-03-09 Distributed website cache staticizing method, server and system Active CN111368237B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010156646.4A CN111368237B (en) 2020-03-09 2020-03-09 Distributed website cache staticizing method, server and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010156646.4A CN111368237B (en) 2020-03-09 2020-03-09 Distributed website cache staticizing method, server and system

Publications (2)

Publication Number Publication Date
CN111368237A CN111368237A (en) 2020-07-03
CN111368237B true CN111368237B (en) 2024-03-19

Family

ID=71211690

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010156646.4A Active CN111368237B (en) 2020-03-09 2020-03-09 Distributed website cache staticizing method, server and system

Country Status (1)

Country Link
CN (1) CN111368237B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112468570A (en) * 2020-11-24 2021-03-09 福建天泉教育科技有限公司 Data request processing method and CDN server side

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100332587A1 (en) * 2009-06-30 2010-12-30 The Go Daddy Group, Inc. In-line static and dynamic content delivery
CN103064932A (en) * 2012-12-24 2013-04-24 乐视网信息技术(北京)股份有限公司 System and method for processing static page
CN104391868A (en) * 2014-10-28 2015-03-04 用友优普信息技术有限公司 Staticizing device and method for dynamic page
CN106210022A (en) * 2016-06-29 2016-12-07 天涯社区网络科技股份有限公司 A kind of system and method for processing forum's height concurrent data requests
CN108306921A (en) * 2017-08-04 2018-07-20 深圳壹账通智能科技有限公司 Call external service method and application server
CN108737527A (en) * 2018-05-11 2018-11-02 重庆工商职业学院 One kind being suitable for platform large-scale consumer access method and system
CN109815432A (en) * 2018-12-26 2019-05-28 北京博鳌纵横网络科技有限公司 A kind of method of the method and page static of whole station static
CN109918435A (en) * 2019-02-27 2019-06-21 北京奇艺世纪科技有限公司 A kind of processing method and system of business interface

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100332587A1 (en) * 2009-06-30 2010-12-30 The Go Daddy Group, Inc. In-line static and dynamic content delivery
CN103064932A (en) * 2012-12-24 2013-04-24 乐视网信息技术(北京)股份有限公司 System and method for processing static page
CN104391868A (en) * 2014-10-28 2015-03-04 用友优普信息技术有限公司 Staticizing device and method for dynamic page
CN106210022A (en) * 2016-06-29 2016-12-07 天涯社区网络科技股份有限公司 A kind of system and method for processing forum's height concurrent data requests
CN108306921A (en) * 2017-08-04 2018-07-20 深圳壹账通智能科技有限公司 Call external service method and application server
CN108737527A (en) * 2018-05-11 2018-11-02 重庆工商职业学院 One kind being suitable for platform large-scale consumer access method and system
CN109815432A (en) * 2018-12-26 2019-05-28 北京博鳌纵横网络科技有限公司 A kind of method of the method and page static of whole station static
CN109918435A (en) * 2019-02-27 2019-06-21 北京奇艺世纪科技有限公司 A kind of processing method and system of business interface

Also Published As

Publication number Publication date
CN111368237A (en) 2020-07-03

Similar Documents

Publication Publication Date Title
CN107590001B (en) Load balancing method and device, storage medium and electronic equipment
CN103218434B (en) A kind of method and apparatus loading static resource
US6862593B2 (en) Separation of database transactions
US10198414B2 (en) Methods for optimizing interaction with a form in a website page and systems thereof
KR950027577A (en) File system cache management method, computer file system, name caching method and computer system cache device
IL167256A (en) Remote dynamic configuration of a web server to provide capacity demand
CN101184105A (en) Client appartus for updating data
CN103347089A (en) Method and device for separating and accelerating dynamic resources and static resources of website
US20110093533A1 (en) Generating site maps
CN102937981A (en) Webpage representing system and method
CN109634753B (en) Data processing method, device, terminal and storage medium for switching browser kernels
CN112579928A (en) Page jump method, page jump device, computer equipment and computer readable storage medium
CN111782692A (en) Frequency control method and device
CN112003945A (en) Service request response method and device
CN103634393A (en) IVR (interactive voice response) and realization method thereof
CN111368237B (en) Distributed website cache staticizing method, server and system
CN114125051B (en) Agent method and device for dynamic service discovery
US20070055663A1 (en) Programmatic response for detected variants of HTTP requests
US10749982B2 (en) Multiple geography service routing
CN113569173A (en) Page loading method and device, storage medium and electronic equipment
US10771578B2 (en) Webpage loading method and apparatus
CN114124893A (en) Domain name caching method, device, system, storage medium and computer equipment
CN113596164A (en) Data access method, device, system, equipment and medium
CN102932334B (en) A kind of webpage trans-coding system
CN102902803B (en) Webpage trans-coding system

Legal Events

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