CN114090927A - Page loading method and device, computer equipment and storage medium - Google Patents

Page loading method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114090927A
CN114090927A CN202111438614.4A CN202111438614A CN114090927A CN 114090927 A CN114090927 A CN 114090927A CN 202111438614 A CN202111438614 A CN 202111438614A CN 114090927 A CN114090927 A CN 114090927A
Authority
CN
China
Prior art keywords
address
target image
original image
page loading
network 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.)
Pending
Application number
CN202111438614.4A
Other languages
Chinese (zh)
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.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China 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 Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202111438614.4A priority Critical patent/CN114090927A/en
Publication of CN114090927A publication Critical patent/CN114090927A/en
Pending legal-status Critical Current

Links

Images

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

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 Transfer Between Computers (AREA)

Abstract

The application relates to the field of data processing, and discloses a page loading method, a page loading device, computer equipment and a storage medium, wherein the page loading method comprises the following steps: sending a page loading request to a gateway server; receiving response data sent by the gateway server, wherein the response data comprise an original image address corresponding to the page loading request; if the current network type is the weak network type, address adjustment is carried out on the original image address to obtain a target image address; and accessing a file server based on the target image address to acquire a target image corresponding to the target image address from the file server, and loading a page by using the target image. The page loading speed can be increased under the weak network condition. The present application relates to blockchain techniques, such as the above data may be written into a blockchain for scenarios such as page loading.

Description

Page loading method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of data processing, and in particular, to a page loading method and apparatus, a computer device, and a storage medium.
Background
In daily work and life, when a user uses a terminal, the situation that network signals are poor is usually encountered, and in the situation, when pages on the terminal are loaded, a large number of pages cannot be normally and quickly displayed. For example, when a user opens a relevant page of a client in a subway environment, a blank page usually appears. Therefore, how to accelerate the page loading speed in the weak network environment becomes a problem to be solved urgently.
Disclosure of Invention
The embodiment of the application provides a page loading method and device, computer equipment and a storage medium, which can acquire an image with lower quality under the condition that the current network type is detected to be a weak network, so that the page loading is carried out by utilizing the image with lower quality, the page loading speed can be increased, and the user weak network experience is improved.
In a first aspect, an embodiment of the present application discloses a page loading method, where the method includes:
sending a page loading request to a gateway server;
receiving response data sent by the gateway server, wherein the response data comprise an original image address corresponding to the page loading request;
if the current network type is the weak network type, address adjustment is carried out on the original image address to obtain a target image address;
and accessing a file server based on the target image address to acquire a target image corresponding to the target image address from the file server, and loading a page by using the target image.
In a second aspect, an embodiment of the present application discloses a page loading apparatus, where the apparatus includes:
the sending unit is used for sending a page loading request to the gateway server;
a receiving unit, configured to receive response data sent by the gateway server, where the response data includes an original image address corresponding to the page loading request;
the adjusting unit is used for carrying out address adjustment on the original image address to obtain a target image address if the current network type is the weak network type;
and the loading unit is used for accessing a file server based on the target image address so as to acquire a target image corresponding to the target image address from the file server and loading a page by using the target image.
In a third aspect, an embodiment of the present application discloses a computer device, including a processor and a memory, where the memory is used for storing a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method of the first aspect.
In a fourth aspect, embodiments of the present application disclose a computer-readable storage medium storing a computer program, the computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method of the first aspect.
In the embodiment of the application, a page loading request may be sent to the gateway server, and response data sent by the gateway server may be received, where the response data may include an original image address corresponding to the page loading request. If the current network type is a weak network type, address adjustment can be carried out on the original image address to obtain a target image address, the file server is accessed based on the target image address, and therefore a target image corresponding to the target image address can be obtained from the file server, and page loading is carried out by utilizing the target image. By implementing the method, the image with lower quality can be obtained under the condition that the current network type is detected to be the weak network, so that the page can be loaded by utilizing the image with lower quality, the background response speed under the weak network environment can be improved, the page loading speed is accelerated, and the user weak network experience is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic architecture diagram of a page loading system according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of image storage according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of a page loading method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a page loading method according to an embodiment of the present application;
fig. 5 is a schematic flowchart of a page loading method according to an embodiment of the present application;
fig. 6 is a schematic flowchart of a page loading method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a page loading apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to improve the background response speed in the weak network environment and accelerate the page loading speed, the embodiment of the application provides a page loading method. The page loading method has the following general principle: a page loading request may be sent to the gateway server, and response data sent by the gateway server may be received, where the response data may include an original image address corresponding to the page loading request. After receiving the response data, a current network type of the current network may also be determined, wherein the current network type may include a weak network type or a non-weak network type. If the current network type is the weak network type, the address of the original image address can be adjusted to obtain the target image address. The image stored corresponding to the original image address is an original image, the image stored corresponding to the target image address is a target image, the target image may be obtained by performing quality reduction processing on the original image, and the quality reduction processing may be performed on the original image by performing compression processing. After the quality reduction processing, the image resolution of the original image is greater than that of the target image, the original image and the target image have the same image content, and the memory occupied by the target image is smaller than that occupied by the original image. After the target image address is obtained, the file server can be accessed based on the target image address, so that a target image corresponding to the target image address can be obtained from the file server, and page loading is performed by using the target image. By implementing the method, the image with lower quality can be obtained under the condition that the current network type is detected to be the weak network, so that the page loading is carried out by utilizing the image with lower quality, the page loading speed can be increased, and the user experience of the weak network can be improved.
It should be noted that the page loading method provided by the present application can be specifically applied to a page loading system, please refer to fig. 1, and fig. 1 is a schematic structural diagram of a page loading system provided in an embodiment of the present application. Referring to fig. 1, the page loading system may include at least one computer device 101, a gateway server 102, a business server 103, and a file server 104.
The computer device 101 may communicate with the gateway server 102, the business server 103, and the file server 104, for example, a page load request may be initiated to the business server 103 by the gateway server 102, an image stored in the file server 104 may be accessed, and so on. The computer device 101 may be a terminal, and the terminal may be a smart phone, a tablet computer, a notebook computer, a desktop computer, or an external device such as a handle and a touch screen, which is not limited in the embodiment of the present application. The computer device 101 may particularly be a client configured in the terminal, such as may be for example a shopping, news reading, movie entertainment client.
The gateway server 102 may be configured to perform information security maintenance, for example, to detect whether a page loading request sent by the computer device 101 is legal, such as whether a user corresponding to the page loading request is logged in normally, whether a request parameter included in the page loading request is modified maliciously, or the like. Gateway server 102 may also forward data, for example, after receiving a page load request, the page load request may be forwarded to service server 103; as another example, after receiving response data of the business server in response to the page load request, the response data may be forwarded to the computer device 101.
The service server 103 may be used to respond to the page load request to obtain corresponding response data.
File server 104 may be used to store images, etc., needed in page load requests. The stored image may include an original image and a target image corresponding to the original image, where the target image may be obtained by performing quality reduction processing on the original image, where the quality reduction processing may be performed by performing compression processing on the original image. It will be appreciated that the image resolution of the original image is greater than the image resolution of the target image, and that the original image and the target image have the same image content.
The servers (such as the gateway server 102, the service server 103, and the file server 104) may be independent physical servers, may also be a server cluster or a distributed system formed by a plurality of physical servers, and may also be cloud servers that provide basic cloud computing services such as cloud services, a cloud database, cloud computing, cloud functions, cloud storage, Network services, cloud communication, middleware services, domain name services, security services, Content Delivery Networks (CDNs), big data and artificial intelligence platforms, and the like. The computer device 101 may be directly or indirectly connected with servers (such as the gateway server 102, the service server 103, and the file server 104) through wired or wireless communication, which is not limited herein.
In one implementation, the above-mentioned file server stores an original image and a corresponding target image, where the original image may be used for page loading in the case of a non-weak network and the target image may be used for page loading in the case of a weak network. Based on this, it can be seen that before the user initiates a page loading request through the computer device, the image for page loading needs to be stored, so as to be directly available later. In order to acquire different images in different network environments, two types of images (a high-resolution image and a low-resolution image) may be stored for one image when the images are stored. The low-resolution image is mainly used for page loading under the weak network condition, the high-resolution image is mainly used for page loading under the non-weak network condition, the high-resolution image is the original image mentioned in the application, and the low-resolution image is the target image mentioned in the application. As shown in fig. 2, the specific implementation process for image storage may include the following steps:
s1: the developer can upload the original image to the service server through the computer device, and the service server can upload the original image to the file server after receiving the original image.
S2: the file server may receive and store an original image uploaded by the service server, and after receiving the original image, the file server may further generate a unique identifier (which may be referred to as an original unique identifier) for indicating the original image, and return the unique identifier to the service server. The original Unique Identifier may be generated by using a Universal Unique Identifier (UUID) random algorithm, and may also be generated by using other random algorithms, which is not limited in this application.
S3: after receiving the original image, the service server may further perform quality reduction processing on the original image to obtain a target image corresponding to the original image, so that the target image may be uploaded to the file server. The quality reduction processing may refer to a reduction processing of the image resolution of the image, and the quality reduction processing may be an image compression processing, for example. The business server can also generate a unique identifier (which can be called as a target unique identifier) corresponding to the target image. The target unique identifier of the target image may be generated based on the original unique identifier of the original image, for example, the target unique identifier corresponding to the target image may be composed of the original unique identifier of the original image and a specified suffix. The target unique identifier is generated on the basis of the original unique identifier, so that the original image and the corresponding target image can be quickly associated. The specified suffix may be preset, e.g. the specified suffix may be. The designated suffix can be any other suffix, and the application is not limited. When the suffix is designated as zip, the target image can be clearly understood to be the image subjected to the quality reduction processing by directly using the suffix, as compared with any other suffix. After the service server determines the target image corresponding to the original image and the target unique identifier of the target image, the target image and the corresponding target unique identifier can be uploaded to the file server, so that the file server can store the target image and the corresponding target unique identifier.
S4: after storing the original image and the corresponding target image, the file server may return an image address of the original image (which may be referred to as an original image address) to the service server, so that after a subsequent service server acquires a page loading request, the file server may acquire the image address of the original image from the service server. The service server may also return an image address of the original image to the computer device so that a subsequent computer device may obtain the original image or a target image of its original image from the file server based on the image address.
Therefore, the corresponding target picture is uploaded while the original picture is uploaded to the file server, and the content of the current business service is not required to be changed, so that zero intrusion to the business code can be realized, and the user weak network experience can be improved.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
referring to fig. 3, fig. 3 is a schematic flowchart of a page loading method according to an embodiment of the present application, where the page loading method can be executed by the aforementioned computer device, and the page loading method includes the following steps:
s301: and sending a page loading request to the gateway server.
In one implementation, the computer device may send a page load request to the gateway server to obtain data required for page loading, which may be response data described below. For example, the computer device may be a terminal, and specifically may be a news reading client, a browser, and the like configured in the terminal, where the client may generally have an information search setting item, and a user may set relevant search information in the information search setting item, so that the client may display a loading page corresponding to the search information on a front-end page based on the search information. The page loading request may specifically be search information set by a user through a search setting item (for example, a search setting item in a browser), and when the client detects the search information, it may be determined that the page loading request is received, so as to further send the page loading request to the gateway server.
In an implementation manner, to better understand the page loading method provided in the embodiment of the present application, the following further describes with reference to the flow shown in fig. 4, as shown in fig. 4, the page loading method involves interaction among a computer device, a gateway server, a service server, and a file server. In the following description of the related implementation, reference may be made to the flow shown in fig. 4.
In an implementation manner, as shown in the flowchart of the page loading method shown in fig. 4, after the gateway server receives the page loading request sent by the computer device, the gateway server may forward the page loading request to the service server, and after the service server receives the page loading request, the service server may respond to the page loading request to obtain response data.
S302: and receiving response data sent by the gateway server, wherein the response data comprises an original image address corresponding to the page loading request.
In one implementation, referring to fig. 4, after the service server obtains corresponding response data in response to the page loading request, the response data may be sent to the gateway server. And after receiving the response data, the gateway server may forward the response data to the computer device, and the computer device may receive the response data sent by the gateway server. The response data may include an original image address corresponding to the page loading request. After the computer device receives the response data forwarded by the gateway server, page loading can be performed according to the response data. The response data may include one or more of loading data of a text class and loading data of an image class, and the application mainly takes the example that the response data includes the loading data of the image class as an example. The loading data of the image class in the response data may be an image address corresponding to the image (the image address is an address stored in the file server, and may be referred to as an accessible network address; or may also be referred to as an image link), and after the computer device obtains the image address from the response data, the computer device may access the file server based on the image address to obtain the image corresponding to the image address from the file server, so as to perform page loading by using the obtained image. Page loading is typically the process whereby a computer device follows the data returned by a server and then renders the data on a front-end page. Then, after the computer device acquires the response data, page loading may be performed according to the response data. The response data may be data of a Json data structure, and is a certain response data as follows: { "title": hello "," subtitle ": good", "image": http:// www.baidu.com/image/45665890282.png "}. The title and the subtitle in the response data are simple characters, and the front end only needs to acquire and display corresponding character data (such as hello and good) at corresponding positions. For the loaded data of the image class, the image address corresponding to the image, namely the original image address for the original image, is included in the response data, as described above as "http:// www.baidu.com/image/45665890282. png".
S303: and if the current network type is the weak network type, carrying out address adjustment on the original image address to obtain a target image address.
In one implementation, after receiving the response data, the computer device may further determine a current network type of the current network to determine whether address adjustment is required for the original image address according to the current network type, so as to perform image acquisition by using the address-adjusted original image address. The current network type may include a weak network type and a non-weak network type, and if the current network type is the weak network type, the address adjustment may be performed on the original image address to obtain a target image address, which is an image address for a target image (i.e., a low resolution image). If the current network type is not the weak network type, the address adjustment of the original image address is not needed.
In one implementation, the specific implementation of determining the current network type of the current network may be: first, a current network type of a current network may be obtained to determine whether the current network type is a preset network type, and if the current network type is determined to be the preset network type, the current network type may be determined to be a weak network type. In the embodiment of the present application, the network mode indicating the cellular mobile network (for example, the network mode may include a 1G network, a 2G network, a 3G network, a 4G network, and a 5G network) may be used to determine the weak network type, for example, the network mode may be the 1G network, the 2G network, and the 3G network may be determined as the weak network type, that is, the preset network type may refer to any one of the 1G network, the 2G network, and the 3G network.
It should be noted that the image address stored in the service server is an image address for the original image, that is, the image address in the response data acquired by the computer device is the original image address corresponding to the original image. In the weak network type network environment, the target image (i.e., the low-resolution image) corresponding to the original image is required for page loading, and then the target image address corresponding to the target image is required to be acquired. To obtain the target image address, the original image address may be adjusted to obtain a corresponding target image address. In a specific implementation, a specified address suffix may be obtained and added to the original image address to obtain the target image address. Wherein the specified address suffix is specified when the original image and the corresponding target image are stored in the file server, i.e. the specified suffix mentioned above for the target unique identifier. If the designated address suffix can be zip, other suffixes are also possible, and the application is not limited. For example, taking the example of the suffix designated address being zip, assuming the original image address is http:// www.baidu.com/image/45665890282.pn, then the corresponding target image address may be http:// www.baidu.com/image/45665890282.pn.
In one implementation, the number of original image addresses in the response data may be one or more. When the number of the original image addresses is multiple, each original image address can be sequentially adjusted based on the image loading sequence of the image, and in the process of adjusting the addresses, after a target image address corresponding to one original image address is obtained, the target image address can be used for accessing the file server to continuously obtain a target image corresponding to the target image address from the file server, and when the target image is displayed on the front-end page subsequently, the target image can also be sequentially displayed on the front-end page according to the obtaining sequence of the multiple target images. In a specific implementation, an image loading sequence of the original image corresponding to each of the plurality of original image addresses may be obtained first. The image loading order of the original images can be determined based on the height range of each original image relative to the front page, for example, the image loading order can be determined based on the distance between the position of the original image and the top of the front page, and it can be understood that the image loading order is about backward when the distance between the position of the original image and the top of the front page is farther, and the image loading order is about forward when the distance between the position of the original image and the top of the front page is closer. Then, after the image loading order is obtained, address adjustment may be performed on the plurality of original image addresses in sequence according to the image loading order, so as to obtain a target image address corresponding to each original image address.
In one implementation, it is considered that the image sharpness is worse than the high resolution when the low resolution image is displayed on the front page, and the high resolution image is better displayed when some images are displayed on the front page. Under the condition that the number of the original image addresses is one or more, in order to ensure that the user perception experience under the weak network condition is not influenced while the page loading speed is increased, whether the corresponding original image addresses need address adjustment or not can be determined according to the image types of the original images. For example, if the image type of the original image is a preset image type, it is determined that the address adjustment of the address of the original image is required, and if the image type of the original image is not the preset image type, it is determined that the address adjustment of the address of the original image is not required. The preset image type may be preset according to a requirement, for example, the preset image type may be an image that does not affect the sensory experience of the user under the condition of low resolution, such as a landscape image and an animal image, and these images may be loaded by using a target image, that is, after an original image address is obtained, address adjustment may be performed; for an image including a large number of text classes, in order to enable a user to clearly understand the text in the image, the original image may be used for loading, that is, after the address of the original image is obtained, address adjustment may not be performed. For another example, the preset image type may be determined based on a historical browsing record of the user, the image types of the images browsed by the user in the preset time period may be counted, the image types may be sorted according to a sequence of browsing times corresponding to the image types from small to large, and the image type located at the top N bits in the sorting result may be used as the preset image type. The preset time period may refer to a period of time before the current time, for example, the preset time period may be the first 5 days of the current time; the image types can comprise landscape images, animal image images, human image images, character images and the like, and can also be divided in other manners; n may be any positive integer, such as 3, 5, etc., and the specific value is not limited in this application. The preset image type may also be set according to other rules, which are not specifically limited in this application.
In an implementation manner, when the number of the original image addresses is multiple, it may be further determined whether address adjustment needs to be performed on all the original image addresses based on the characteristics of multiple dimensions, so as to screen out more appropriate original image addresses that need address adjustment based on the characteristics of multiple dimensions. For example, the original image address that needs to be address adjusted may be determined jointly based on the image type and the weak mesh value. In specific implementation, the weak mesh degree value of the weak mesh type may be obtained first. If the weak network degree value is less than or equal to the first degree value, the addresses of the plurality of original image addresses can be respectively adjusted to obtain the target image address. If the weak network degree value is larger than the first degree value and smaller than the second degree value, partial original image addresses can be screened from a plurality of original image addresses for address adjustment. For example, a part of original image addresses can be randomly screened out from a plurality of original image addresses for address adjustment; for another example, the image types of the original images corresponding to the multiple original image addresses respectively may be obtained, and the original image address corresponding to the image type being the preset image type is determined as the original image address to be adjusted, so as to perform address adjustment on the original image address to be adjusted, and obtain the target image address. Wherein, the weak network degree value can be determined by the above mentioned network mode (e.g. the network mode can include 1G network, 2G network, 3G network, 4G network, 5G network), and the first degree value and the second degree value can be preset. For example, if the network mode is the 1G network, the 2G network, and the 3G network are determined to be the weak network type, the first degree value may refer to the network mode being the 2G network, and the second degree value may refer to the network mode being the 4G network. For another example, if the network mode is determined to be the 1G network, the 2G network, the 3G network, and the 4G network as the weak network type, the first degree value may indicate that the network mode is the 2G network, and the second degree value may indicate that the network mode is the 5G network, or the first degree value may indicate that the network mode is the 3G network and the second degree value may indicate that the network mode is the 5G network. The preset image type may refer to the above description, and is not described herein in detail.
S304: and accessing the file server based on the target image address to acquire a target image corresponding to the target image address from the file server, and loading a page by using the target image.
In one implementation, as shown in FIG. 4, the computer device may access the file server based on the target image address to obtain the target image corresponding to the target image address from the file server. After the computer device acquires the target image, the page loading can be performed by using the target image.
In one implementation, it is mentioned in step S303 that in the case that there are a plurality of original image addresses, there may be a portion of the original image addresses without address adjustment, and then, for the original image addresses without address adjustment, the computer device may directly access the file server based on the original image addresses to obtain the original images corresponding to the original image addresses from the file server, so that page loading may be performed based on the original images and the target images.
In one implementation, when the current network type of the current network is not the weak network type, the file server may be directly accessed based on the original image address included in the response data, so as to obtain the original image corresponding to the original image address from the file server, and perform page loading by using the original image.
In the embodiment of the application, a page loading request may be sent to the gateway server, and response data sent by the gateway server may be received, where the response data may include an original image address corresponding to the page loading request. If the current network type is a weak network type, address adjustment can be carried out on the original image address to obtain a target image address, the file server is accessed based on the target image address, and therefore a target image corresponding to the target image address can be obtained from the file server, and page loading is carried out by utilizing the target image. By implementing the method, the compressed data (such as the image with lower quality) can be accessed when the page is accessed under the weak network condition, so that the page is loaded by utilizing the compressed data, the background response speed is greatly improved, the page loading speed is accelerated, and the user weak network experience is improved. Meanwhile, the non-weak network condition and the weak network condition can be processed differently, the request response flow under the non-weak network condition can be consistent with the existing logic, and the target image related to the scheme can be acquired under the weak network condition, so that the intelligence of the computer equipment is improved, and the user experience is improved.
Referring to fig. 5, fig. 5 is a schematic flowchart of a page loading method according to an embodiment of the present application, where the page loading method can be executed by the aforementioned computer device, and the page loading method includes the following steps:
s501: it is determined whether the current network type is a weak network type.
S502: and if the current network type is the weak network type, carrying a first identifier in a request head of the page loading request, and compressing a request body of the page loading request.
In steps S501 and S502, when the computer device performs background access, a current network type of a current network may be determined first, so as to determine whether a page loading request for requesting to acquire loaded page data needs to be compressed according to the current network type, so that a data volume corresponding to the compressed page loading request is smaller than a data volume corresponding to an original page loading request, so as to increase a data transmission speed, and thus, a background response speed may be increased.
Based on this, the computer device may determine whether the current network type is the weak network type, and may compress the page loading request if the current network type is the weak network type. For a request, the request may generally include a request header and a request body, and in a specific implementation, the request body of the page loading request may be compressed, and in order to ensure that when a subsequent gateway server receives the page loading request, it may be determined whether the page loading request is compressed, and perform a subsequent operation, the computer device may carry a first identifier in the request header of the page loading request, where the first identifier may be used to indicate that the request body of the page loading request is compressed.
Optionally, the compression process may be performed by compressing the request object by using an open source Gzip technique, or may be performed by using other techniques, which is not specifically limited in this application. In one embodiment, the compression technology utilized by the compression process and the first identifier may have an association relationship, and the first identifier may be used to indicate the compression technology utilized by the computer device, so that the subsequent gateway server may determine the compression technology corresponding to the request body directly based on the first identifier to decompress the request body by using the decompression technology corresponding to the compression technology. For example, if the computer device employs open-source Gzip technology compression, the first identifier may be Content-Encoding, compression, zip, etc., and it can be seen that through such first identifier, the corresponding compression technology can be determined.
S503: and sending a page loading request consisting of a request head carrying the first identifier and the compressed request body to the gateway server.
In an implementation manner, to better understand the page loading method provided in the embodiment of the present application, the following further describes with reference to the flow shown in fig. 6, as shown in fig. 6, the page loading method involves interaction among a computer device, a gateway server, a service server, and a file server. In the following description of the related implementation, reference may be made to the flow shown in fig. 6. As shown in fig. 6, the computer device may send a page loading request composed of a request header carrying the first identifier and a compressed request body to the gateway server. After receiving the page loading request, the gateway server may forward the page loading request to the service server, and may decompress the page loading request on the premise that the page loading request is compressed. Then, the gateway server may first determine whether an identifier indicating compression processing exists in the page load request, and if such an identifier exists in the page load request, the gateway server needs to perform relevant processing on the page load request, such as decompression processing. In a specific implementation, after receiving the page loading request, the gateway server may first search whether the first identifier exists in the page loading request, for example, may determine whether the first identifier exists in a request header of the page loading request, where the first identifier may be used to indicate that a request body of the page loading request is compressed. Based on this, if the first identifier exists in the request header of the page loading request, the request body in the page loading request may be decompressed to obtain the decompressed page loading request. And then, forwarding the decompressed page loading request to a service server so that the service server responds to the page loading request and obtains corresponding response data.
S504: and receiving response data sent by the gateway server, wherein the response data comprises an original image address corresponding to the page loading request.
In an implementation manner, as shown in fig. 6, after the service server responds to the page loading request to obtain corresponding response data, the response data may be sent to the gateway server, and after the gateway server receives the response data, the gateway server may compress the response data in consideration of that the current network type is the weak network type, so as to increase the transmission speed of the data by using the size of the smaller response data, thereby increasing the page loading speed. In a specific implementation, the gateway server may compress a response body in the response data, and carry a second identifier in a response header of the response data, where the second identifier may be used to indicate that the response body in the response data is compressed, so that after receiving the response data, the subsequent computer device may determine whether to decompress the response data based on whether the second identifier exists in the response data. After the gateway server performs the above processing on the response data, the response data composed of the response header carrying the second identifier and the compressed response body may be sent to the computer device.
Then, after the computer device receives the response data sent by the gateway server, it may further determine whether an identifier indicating that the response body in the response data is compressed exists in a response header of the response data, where the identifier is the second identifier described above. If the second identifier exists in the response header of the response data, decompressing the response body in the response data to obtain a decompressed response body, so that the original image address corresponding to the page loading request can be acquired from the decompressed response body.
S505: and adjusting the address of the original image to obtain the address of the target image.
S506: and accessing the file server based on the target image address to acquire a target image corresponding to the target image address from the file server, and loading a page by using the target image.
For specific implementation of steps S505 and S506, reference may be made to the detailed description of steps S303 and S304 in the above embodiments, and details are not described here again.
In the embodiment of the application, whether the current network type is the weak network type or not can be determined, if the current network type is the weak network type, the first identifier is carried in the request header of the page loading request, and the request body of the page loading request is compressed. And sending a page loading request consisting of a request head carrying the first identifier and the compressed request body to the gateway server. Then, response data sent by the gateway server is received, where the response data may include an original image address corresponding to the page loading request, and further, address adjustment may be performed on the original image address to obtain a target image address, and the file server is accessed based on the target image address, so that a target image corresponding to the target image address may be obtained from the file server, and page loading may be performed using the target image. By implementing the method, when the page is accessed under the weak network condition, the compressed data (such as an image with low quality) can be accessed, so that the page is loaded by utilizing the compressed data; in the data transmission process, the compressed data can be used for data transmission to accelerate the data transmission speed, so that the background response speed is greatly improved, the page loading speed is accelerated, and the user experience of the weak network is improved. Meanwhile, the non-weak network condition and the weak network condition can be processed differently, the request response flow under the non-weak network condition can be consistent with the existing logic, and for the weak network condition, the compression processing of the data related to the scheme (such as the compression processing of a request body in a page loading request and a response body in response data) can be utilized, so that the resource consumption of the gateway server caused by the decompression and compression processing of both the request and the response data under the non-weak network condition is avoided.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a page loading apparatus according to an embodiment of the present disclosure. The page loading device comprises:
a sending unit 701, configured to send a page loading request to a gateway server;
a receiving unit 702, configured to receive response data sent by the gateway server, where the response data includes an original image address corresponding to the page loading request;
an adjusting unit 703, configured to perform address adjustment on the original image address to obtain a target image address if the current network type is a weak network type;
a loading unit 704, configured to access a file server based on the target image address, to obtain a target image corresponding to the target image address from the file server, and perform page loading by using the target image.
In an implementation manner, the sending unit 701 is further configured to:
determining whether the current network type is a weak network type;
if the current network type is the weak network type, carrying a first identifier in a request header of a page loading request, and compressing a request body of the page loading request; the first identification is used for indicating that a request body of the page loading request is compressed;
and sending a page loading request consisting of a request header carrying the first identifier and the compressed request body to the gateway server.
In one implementation manner, the receiving unit 702 is further configured to:
determining whether a second identifier exists in a response header of the response data; the second identification is used for indicating that a response body in the response data is compressed;
if the second identifier exists in the response head of the response data, decompressing the response body in the response data to obtain a decompressed response body;
and determining an original image address corresponding to the page loading request from the decompressed response body.
In an implementation manner, the adjusting unit 703 is specifically configured to:
and acquiring a specified address suffix, and adding the specified address suffix to the original image address to obtain a target image address.
In one implementation, the number of the original image addresses is multiple; the adjusting unit 703 is specifically configured to:
acquiring an image loading sequence of original images corresponding to a plurality of original image addresses respectively;
sequentially carrying out address adjustment on the plurality of original image addresses according to the image loading sequence to obtain a target image address corresponding to each original image address;
the loading unit 704 is specifically configured to: and after a target image address corresponding to the original image address is obtained, accessing the file server based on the target image address, and sequentially accessing the file server according to the obtaining sequence of each target image address.
In one implementation, the number of the original image addresses is multiple; the adjusting unit 703 is specifically configured to:
acquiring a weak network degree value of the weak network type;
if the weak network degree value is smaller than or equal to the first degree value, carrying out address adjustment on a plurality of original image addresses to obtain target image addresses;
if the weak network degree value is larger than the first degree value and smaller than the second degree value, the image types of the original images corresponding to the original image addresses respectively are obtained, the original image address corresponding to the image type which is a preset image type is determined as the original image address to be adjusted, and address adjustment is carried out on the original image address to be adjusted to obtain the target image address.
In an implementation manner, the adjusting unit 703 is further configured to:
acquiring a current network type of a current network, and determining whether the current network type is a preset network type;
and if the current network type is determined to be the preset network type, determining that the current network type is the weak network type.
It can be understood that the functions of the functional units of the page loading apparatus described in the embodiment of the present application may be specifically implemented according to the method in the method embodiment described in fig. 1, and the specific implementation process may refer to the relevant description of the method embodiment of fig. 1, which is not described herein again.
In this embodiment of the present application, the sending unit 701 sends a page loading request to a gateway server; a receiving unit 702 receives response data sent by the gateway server, where the response data includes an original image address corresponding to the page loading request; if the current network type is a weak network type, the adjusting unit 703 adjusts the address of the original image address to obtain a target image address; the loading unit 704 accesses a file server based on the target image address to obtain a target image corresponding to the target image address from the file server, and performs page loading by using the target image. By implementing the method, the page loading speed can be accelerated under the weak network condition.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure. The computer device includes: a processor 801, a memory 802, and a network interface 803. Data may be exchanged between the processor 801, the memory 802, and the network interface 803.
The Processor 801 may be a Central Processing Unit (CPU), and may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 802, which may include both read-only memory and random-access memory, provides program instructions and data to the processor 801. A portion of the memory 802 may also include random access memory. Wherein, the processor 801 is configured to execute, when calling the program instruction:
sending a page loading request to a gateway server;
receiving response data sent by the gateway server, wherein the response data comprise an original image address corresponding to the page loading request;
if the current network type is the weak network type, address adjustment is carried out on the original image address to obtain a target image address;
and accessing a file server based on the target image address to acquire a target image corresponding to the target image address from the file server, and loading a page by using the target image.
In one implementation, the processor 801 is further configured to:
determining whether the current network type is a weak network type;
if the current network type is the weak network type, carrying a first identifier in a request header of a page loading request, and compressing a request body of the page loading request; the first identification is used for indicating that a request body of the page loading request is compressed;
and sending a page loading request consisting of a request header carrying the first identifier and the compressed request body to the gateway server.
In one implementation, the processor 801 is further configured to:
determining whether a second identifier exists in a response header of the response data; the second identification is used for indicating that a response body in the response data is compressed;
if the second identifier exists in the response head of the response data, decompressing the response body in the response data to obtain a decompressed response body;
and determining an original image address corresponding to the page loading request from the decompressed response body.
In one implementation, the processor 801 is specifically configured to:
and acquiring a specified address suffix, and adding the specified address suffix to the original image address to obtain a target image address.
In one implementation, the number of the original image addresses is multiple; the processor 801 is specifically configured to:
acquiring an image loading sequence of original images corresponding to a plurality of original image addresses respectively;
sequentially carrying out address adjustment on the plurality of original image addresses according to the image loading sequence to obtain a target image address corresponding to each original image address;
and after a target image address corresponding to the original image address is obtained, accessing the file server based on the target image address, and sequentially accessing the file server according to the obtaining sequence of each target image address.
In one implementation, the number of the original image addresses is multiple; the processor 801 is specifically configured to:
acquiring a weak network degree value of the weak network type;
if the weak network degree value is smaller than or equal to the first degree value, carrying out address adjustment on a plurality of original image addresses to obtain target image addresses;
if the weak network degree value is larger than the first degree value and smaller than the second degree value, the image types of the original images corresponding to the original image addresses respectively are obtained, the original image address corresponding to the image type which is a preset image type is determined as the original image address to be adjusted, and address adjustment is carried out on the original image address to be adjusted to obtain the target image address.
In one implementation, the processor 801 is further configured to:
acquiring a current network type of a current network, and determining whether the current network type is a preset network type;
and if the current network type is determined to be the preset network type, determining that the current network type is the weak network type.
In a specific implementation, the processor 801 and the memory 802 described in this embodiment of the present application may execute the implementation manner described in the page loading method provided in fig. 1 in this embodiment of the present application, and may also execute the implementation manner of the page loading apparatus described in fig. 7 in this embodiment of the present application, which is not described herein again.
In this embodiment of the present application, the processor 801 may send a page loading request to the gateway server; receiving response data sent by the gateway server, wherein the response data comprise an original image address corresponding to the page loading request; if the current network type is the weak network type, address adjustment is carried out on the original image address to obtain a target image address; and accessing a file server based on the target image address to acquire a target image corresponding to the target image address from the file server, and loading a page by using the target image. By implementing the method, the page loading speed can be accelerated under the weak network condition.
The embodiment of the present application further provides a computer-readable storage medium, in which program instructions are stored, and when the program is executed, some or all of the steps of the page loading method in the corresponding embodiment of fig. 1 may be included.
It should be noted that, for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the order of acts described, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
It is emphasized that the data may also be stored in a node of a blockchain in order to further ensure the privacy and security of the data. The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The page loading method, the page loading device, the computer device and the storage medium provided by the embodiments of the present application are introduced in detail, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the embodiments is only used to help understanding the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A page loading method is characterized by comprising the following steps:
sending a page loading request to a gateway server;
receiving response data sent by the gateway server, wherein the response data comprise an original image address corresponding to the page loading request;
if the current network type is the weak network type, address adjustment is carried out on the original image address to obtain a target image address;
and accessing a file server based on the target image address to acquire a target image corresponding to the target image address from the file server, and loading a page by using the target image.
2. The method of claim 1, wherein before sending the page load request to the gateway server, further comprising:
determining whether the current network type is a weak network type;
if the current network type is the weak network type, carrying a first identifier in a request header of a page loading request, and compressing a request body of the page loading request; the first identification is used for indicating that a request body of the page loading request is compressed;
the sending of the page loading request to the gateway server includes:
and sending a page loading request consisting of a request header carrying the first identifier and the compressed request body to the gateway server.
3. The method of claim 1, wherein after receiving the response data sent by the gateway server, the method further comprises:
determining whether a second identifier exists in a response header of the response data; the second identification is used for indicating that a response body in the response data is compressed;
if the second identifier exists in the response head of the response data, decompressing the response body in the response data to obtain a decompressed response body;
and determining an original image address corresponding to the page loading request from the decompressed response body.
4. The method of claim 1, wherein the performing address adjustment on the original image address to obtain a target image address comprises:
and acquiring a specified address suffix, and adding the specified address suffix to the original image address to obtain a target image address.
5. The method according to claim 1, wherein the number of the original image addresses is plural; the address adjustment of the original image address to obtain the target image address comprises:
acquiring an image loading sequence of original images corresponding to a plurality of original image addresses respectively;
sequentially carrying out address adjustment on the plurality of original image addresses according to the image loading sequence to obtain a target image address corresponding to each original image address;
the accessing a file server based on the target image address comprises;
and after a target image address corresponding to the original image address is obtained, accessing the file server based on the target image address, and sequentially accessing the file server according to the obtaining sequence of each target image address.
6. The method according to claim 1, wherein the number of the original image addresses is plural; the address adjustment of the original image address to obtain the target image address comprises:
acquiring a weak network degree value of the weak network type;
if the weak network degree value is smaller than or equal to the first degree value, carrying out address adjustment on a plurality of original image addresses to obtain target image addresses;
if the weak network degree value is larger than the first degree value and smaller than the second degree value, the image types of the original images corresponding to the original image addresses respectively are obtained, the original image address corresponding to the image type which is a preset image type is determined as the original image address to be adjusted, and address adjustment is carried out on the original image address to be adjusted to obtain the target image address.
7. The method of claim 2, wherein determining whether the current network type is a weak network type comprises:
acquiring a current network type of a current network, and determining whether the current network type is a preset network type;
wherein, still include:
and if the current network type is determined to be the preset network type, determining that the current network type is the weak network type.
8. A page loading apparatus, comprising:
the sending unit is used for sending a page loading request to the gateway server;
a receiving unit, configured to receive response data sent by the gateway server, where the response data includes an original image address corresponding to the page loading request;
the adjusting unit is used for carrying out address adjustment on the original image address to obtain a target image address if the current network type is the weak network type;
and the loading unit is used for accessing a file server based on the target image address so as to acquire a target image corresponding to the target image address from the file server and loading a page by using the target image.
9. A computer device comprising a processor, a memory, wherein the memory is configured to store a computer program comprising program instructions, and wherein the processor is configured to invoke the program instructions to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
CN202111438614.4A 2021-11-29 2021-11-29 Page loading method and device, computer equipment and storage medium Pending CN114090927A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111438614.4A CN114090927A (en) 2021-11-29 2021-11-29 Page loading method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111438614.4A CN114090927A (en) 2021-11-29 2021-11-29 Page loading method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114090927A true CN114090927A (en) 2022-02-25

Family

ID=80305613

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111438614.4A Pending CN114090927A (en) 2021-11-29 2021-11-29 Page loading method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114090927A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115529243A (en) * 2022-09-19 2022-12-27 中国银行股份有限公司 Method and device for optimizing page loading speed

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060067318A1 (en) * 2004-09-28 2006-03-30 Cray Canada Inc. Low latency communication via memory windows
CN101583099A (en) * 2009-07-02 2009-11-18 优视动景(北京)技术服务有限公司 Browsing system for mobile terminal
WO2015062388A1 (en) * 2013-10-31 2015-05-07 优视科技有限公司 Picture loading method and device and video playback method and device
CN105099602A (en) * 2014-04-25 2015-11-25 阿里巴巴集团控股有限公司 File transmission method based on network speed and system
CN105530292A (en) * 2015-12-01 2016-04-27 小米科技有限责任公司 Page image display method and device
CN105760405A (en) * 2014-12-19 2016-07-13 阿里巴巴集团控股有限公司 Methods and devices for obtaining network resource for loading web page and method and device for caching network resource
CN105959502A (en) * 2016-04-27 2016-09-21 北京小米移动软件有限公司 Network picture compression method and device
CN111953666A (en) * 2020-07-27 2020-11-17 厦门安胜网络科技有限公司 Data transmitting and receiving method and device and data transmitting and receiving system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060067318A1 (en) * 2004-09-28 2006-03-30 Cray Canada Inc. Low latency communication via memory windows
CN101583099A (en) * 2009-07-02 2009-11-18 优视动景(北京)技术服务有限公司 Browsing system for mobile terminal
WO2015062388A1 (en) * 2013-10-31 2015-05-07 优视科技有限公司 Picture loading method and device and video playback method and device
CN105099602A (en) * 2014-04-25 2015-11-25 阿里巴巴集团控股有限公司 File transmission method based on network speed and system
CN105760405A (en) * 2014-12-19 2016-07-13 阿里巴巴集团控股有限公司 Methods and devices for obtaining network resource for loading web page and method and device for caching network resource
CN105530292A (en) * 2015-12-01 2016-04-27 小米科技有限责任公司 Page image display method and device
CN105959502A (en) * 2016-04-27 2016-09-21 北京小米移动软件有限公司 Network picture compression method and device
CN111953666A (en) * 2020-07-27 2020-11-17 厦门安胜网络科技有限公司 Data transmitting and receiving method and device and data transmitting and receiving system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115529243A (en) * 2022-09-19 2022-12-27 中国银行股份有限公司 Method and device for optimizing page loading speed

Similar Documents

Publication Publication Date Title
CN104392008B (en) Web data acquisition methods, browser client and CDN server
US20140136952A1 (en) Improving web sites performance using edge servers in fog computing architecture
CN112559927B (en) Webpage loading method and device
CN110096889B (en) File detection method, device, equipment and computer readable storage medium
US9906626B2 (en) Resource demand-based network page generation
CN111756847B (en) Method and device for supporting https protocol by website
CN108322789B (en) Network picture display method and device and mobile terminal
US11816249B2 (en) System and method for dynamic management of private data
US20170155712A1 (en) Method and device for updating cache data
CN111625320A (en) Mirror image management method, system, device and medium
CN114090927A (en) Page loading method and device, computer equipment and storage medium
CN111090621A (en) Log obtaining method, device and storage medium
CN106209584A (en) User profile processing method based on the Internet, client and server
CN114793223A (en) DNS record storage method and device, storage medium and electronic equipment
CN116546039A (en) Virtual machine image uploading method and device, electronic equipment and storage medium
CN112040023B (en) Object access method and device, electronic equipment and machine-readable storage medium
CN114500484A (en) Page rendering method and device, electronic equipment and readable medium
JP6752944B2 (en) Devices and methods for sharing images received from user terminals with other user terminals
CN113595685A (en) Data transmission method and device, storage medium and terminal
CN114168218A (en) Data processing method, data processing device, computer equipment and storage medium
CN113626402A (en) Log data acquisition method and device, electronic equipment and storage medium
EP1170675A1 (en) Presentation of customised data content
CN114827113B (en) Webpage access method and device
CN112822237B (en) Network request transmission method and device
CN113342275B (en) Method, apparatus and computer readable storage medium for accessing data at block link points

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