Learn How Caching Affects EPMV



Caching (or cache) is a kind of intermediate buffer in which data is stored. Thanks to caching, the site page is not recreated for each user. Caching allows you to work with a large amount of data in the shortest possible time and with limited resources (server and user).

Types of caching

1. Browser caching or client caching

It is instructing the browser to use an existing cached copy. The work of such caching is based on the fact that on a second visit, the 304 Not Modified header is given to the browser, and the page or picture itself is loaded from the local user cache. It turns out that the site owner saves on traffic between the visitor's browser and the site's hosting. Accordingly, the site page starts loading faster.

1.1. Caching files and images.

Browser caching is the best suited for sites containing a large number of images: the picture is not downloaded every time the site is opened, but simply loaded through the browser cache. This is the first level of caching, which is to return the expired header and the 304 Not Modified header. The most effective caching is considered to be for two weeks.

However, in this case, there is one important nuance: if the image on the site changes, then the browser will not know about it immediately, but only if you wait for expiry or reset the cache in the browser itself. It is not very effective if the file is constantly changing and it is necessary to constantly return its current version.

1.2. Https caching

Special headers like strict-security. Allows the browser to always refer to the selected domain via https. It keeps this state rather rigid and, if this type of cache is canceled, the browser will still try to load the page via https for quite a long time, while ignoring the current headers.

1.3. Certification Authority Caching

The so-called certification authority stamp.

This type of caching is considered mandatory if the website owner does not want the users of his website to wait for the certification authority (and this is a certain server that is responsible for the validity of the certificate) to process the request from the user's browser and confirm that the resource is indeed confirmed by him.

1.4. Page caching

When the page is already generated, you need to constantly monitor its relevance. To do this, you need to use a server cache with tracking the time of changes in individual parts of the page (if the page is built from a set of dynamically generated blocks). With this approach, in each response from the server, special headers are installed that indicate the time the page was changed, which are then sent by the user's browser when the site page is re-accessed. When receiving such headers, the server can analyze the current state of the page (perhaps even render it), but instead of the page content, give the header 304 Not Modified, which for the user browser will mean that the page can be shown from its (user's browser) cache.

Of course, it is possible to send the appropriate headers without using the server-side tracking cache, but in this case, most users will receive the page content update quite late. With this approach, the browser sometimes polls the server to receive updates, but the frequency and rules for each browser are configured by its developer, so there is no reason to hope that users will receive updates on time.

Typically, the cache is categorized by the type of user:

  • for authorized;
  • for unauthorized.

This division is due to the uniqueness of the content for each authorized user and the generality of the content for the guest users. In most sites, an unauthorized user cannot change the content of the site, and therefore influence its content.

Browser cache allows you to save traffic and time spent on loading pages. But to achieve the saving effect, the user must visit the resource page at least once, which means that the load on server resources will decrease, but not significantly.

2 Server caching

Server caching refers to all types of caching in which data is stored on the server side. This data is not available to client browsers. The cache is created and stored on a one-to-many basis (many, in this case, are client devices).

2.1. Full page caching

Most efficient cache. Its greatest advantage is that the page is returned almost at the time of access, as a result, it is the ability to process millions of requests even on the weakest server with the speed of memory and with little CPU usage.

This type of cache also has its drawbacks: for example, the inability to cache pages for an authorized user, or for a user whose page content depends on the current user variables.

Use this cache if the server knows all the static states of the external data, that is, in fact, this is the ideal page state for guest users. It should be borne in mind that with such caching, the architecture of a site or application must always process incoming requests in the same way and give the same type of responses. Such a state exists in any application or site, it only needs to be tracked and applied to the cache.

Caching of entire pages, most often, is used in some kind of emergency, while the page cache is stored for a predetermined time (from 2 minutes), during which the responses from the server are of the same type.

2.2. PHP compilation caching

A distinction is made between pure compilation of the code and its optimization during compilation (substitution of scripts).

2.3. Caching individual blocks of a page

This is the most interesting and at the same time the most difficult type of caching. Nevertheless, it can also be effective; it is the easiest way to explain the principles of caching in general using its example.

It is necessary to monitor: the state of the tables, the state of the user session, whether to turn off caching during POST or GET requests, the dependence on the current address, persistence of caching (if the previous conditions change) or its dynamic adjustment.

Caching individual page blocks is better than other types of caching if you need, for example, to reduce the number of requests to the database from real (authorized) users.

2.4. PHP caching based on unshared resources

best suited for standardizing requests, retrieving data from shared resources, having internal variables that php resources access multiple times during page generation.

2.5. PHP caching based on shared resources

This caching is used to store serialized data. For example, a configuration file, table states, file system lists.

2.6. Mysql Caching Based on Query Cache

This is a fairly well-known and well-known topic. Nevertheless, I would like to consider the specifics of working with timestamp and how you can avoid constantly flushing the query cache.

WHERE show_ts <= UNIX_TIMESTAMP ()

If you use a constantly changing timestamp in such queries, then the sql cache will not only be useless, but even harmful, since most of the cached queries will accumulate, the data of which is outdated at the time the cache was created.

As a rule, any material is published at certain points in time. For example, 00:00. All you need to do is create a query that will evaluate the table by the maximum date, while less than the current one.

SELECT SQL_NO_CACHE VAX (show_ts) WHERE show_ts <= UNIX_TIMESTAMP ();

This query will not be cached, but all queries to this table will be cached if their number is more than one.

2.7. Mysql caching of output, aggregating tables

There is a rule: there should be significantly fewer data updates than reads in order to return them.

DNS caching: the best performing website caching

However, the best type of caching possible is DNS caching, that saves the webserver from unnecessary page preparation for static pages, and brings content copies closer to the user, thus making the site delivery faster.

DNS caching might get expensive, but can be implemented on your websites for free by using technologies such as the  Ezoic platform ‌  that optimizes websites content.

Big data analytics and statistics by page caching

That is, it makes no sense to aggregate what will change at the same moment, while the relevance of the aggregated data is important.

What to choose for aggregation? Usually this is some kind of statistical information about the number of records, the date of the last update, the author of the last update, and the like.

To find out how caching affects EPMV, the website owner should follow these steps:

  1. Log in to your Ezoic account;
  2. In the left side menu, select the Site speed setting;
  3. In the drop-down menu, click on the Caching option.

The user is taken to a page that displays analytical data. One part of the data is displayed in the form of a graph, and the second - in the form of a table, in which the analytical data is described in more detail.

Overview of graph and table data

It should be noted right away that the data that will be given in this article is valid only for one specific site. If you are the owner of your own website, and you also need to get access to such analytics, then you need to register in the Ezoic system.

Once in the Caching option, the site owner will see a graph and a table below it. The following data will be displayed in the table for this type of analytics:

  1. Ezoic cache level;
  2. Browsing pages;
  3. Average page load time;
  4. Page engagement rate;
  5. Average time to first byte;
  6. Average interaction time;
  7. Average host response time;
  8. Bounce rate;
  9. Exit percentage;
  10. Caching RPM (Revenue Per Mille).

Cache hit.

A cache hit is the first level of the cache in Ezoic. Let's take a closer look. Page views - 2,002,169, of the total number of views, this is 69.96%. The average page load time for this cache level was 00:36, while the average for this metric was 00:38. The page engagement rate is 49.02%, the average for this criterion is 50.52 percent. The average time to first byte is 1,470.92 ms, the total is 1,906.62 ms.

The average interaction time for this cache level is 2,469.89 ms, while the total is 2,959.37 ms. The average host response time is 20.70 ms, with a total of 262.14 ms. The bounce rate is 28.96%, the overall bounce rate is 28.47%. The exit percentage is 84.73%, the total percentage is 84.52%.

The RPM for a given cache tier is $ 5.32, and the total for all cache tiers is $ 5.29.

Not hitting the cache.

Not hitting the cache is the second level of caching in Ezoic. Let's take a closer look. Page views 727,702, of the total number of views, this is 24.43%. The average page load time for this cache level was 00:41, while the average for this metric was 00:38. The page engagement rate is 54.52%, the average for this criterion is 50.52 percent. The average time to the first byte is 2,558.18 ms, the total is 1,906.62 ms.

The average interaction time for this cache level is 3.677.07 ms, while the total is 2.959.37 ms. The average host response time is 415.68 ms, with a total of 262.14 ms. The bounce rate is 26.98%, the overall percentage is 28.47%. The exit percentage is 83.99%, the total percentage is 84.52%.

The RPM for a given cache tier is $ 5.23, and the total for all cache tiers is $ 5.29.

The cache is disabled.

Cache Off - This is the third level of caching in Ezoic. Let's take a closer look. Page views 132,113, of the total number of views, this is 4.62%. The average page load time for this cache level was 00:36, while the average for this metric was 00:38. The page engagement rate is 51.20%, the average for this criterion is 50.52 percent. The average time to first byte is 4,695.58 ms, the total is 1,906.62 ms.

The average interaction time for this cache level is 6.169.49 ms, while the total is 2.959.47 ms. Average host response time is 3.075.51 ms, with an overall average of 262.14 ms. The bounce rate is 29.55%, the overall percentage is 28.47%. The exit percentage is 84.70%, the total percentage is 84.52%.

The RPM for a given cache tier is $ 5.17, and the total for all cache tiers is $ 5.29.

Big data analytics from Ezoic

Big data analytics from Ezoic is a relatively young product in the market for similar services from this company. It should be noted that it is very popular with website owners, and there are several reasons for this.

One of the first ones that attract attention - after registering on their resource, the owner can get a huge array of information, which is very well visualized and easy to understand even among those who are new to this business.

Another reason is the user-friendly interface of the product. This means that even a non-advanced user will be able to understand the functionality, understand where what is and how to look at it.

There are many different criteria available in big data analytics that you can use to examine asset analytics. For example, at any time you can see how much money a resource is generating at a given moment, or how to see the profitability of pages depending on the influence of their age.






Comments (0)

Leave a comment