17 October

How We Increased Efficiency and Saved Costs Thanks to Caching

Business
Programming
Web apps

min. read

Reading Time: 4 minutes

In computer science, a cache is a part of hardware or software that keeps data to provide it when needed later quickly. The data saved in a cache could be from a previous computation or duplicate data stored in a different place.

This article will explore the topic of caching using our site as an example. 

Here, we will go through a few essential definitions and describe how we managed to increase the performance of our page. 

What is Cloudflare CDN?

Cloudflare is a Content Delivery Network (CDN) dedicated to caching static content in many data centers logistically placed in different geographical areas. This platform operates as a reverse proxy server, and this is a technique used to reduce the loading on internal servers.

Source

What is TTL?

Time To Live having web hosting in mind is when a packet or data unit is expected to exist on a network, system, computer, CDN, or website before it expires and must be replaced by the source content. 

How does it look in practice?

When you open a website, you make many requests to the server. Then, the server responds in a certain way. Each request goes through a cache, which is the concept of content delivery. 

Let’s say we have a user who wants a particular resource. In the traditional model, you send the query directly to the server, and the server responds. The problem arises when there are 1,000 such users at once, so the trouble begins when the server is one and it’s small. The second problem is that one server is too little in the context of the whole world. Let’s take a user from the US, for example, given that our server is in Europe. Some time passes before such a user gets a response from the server.

So firstly, CDN stands as an intermediary, and when a user inquires about a resource, we have two options. This resource can be immediately available, so the user gets it. Since we know the resource existed, the cache saved it to itself within the last 24 hours, for example. If it hasn’t expired, it will be all the time, but from time to time (for example, every 6 hours), as a request comes in, the CDN asks our server again for a particular resource. Now, when we have an example of 1,000 users, they only ask the CDN, not our server. For 6 hours, no query will go out to our server because there is no reason for it. So, if it’s during 24 hours, we will get 4 queries to our server, not 1,000.

So having users from the US, they don’t have to ask our server in Europe, they just ask this cache near them, and it will ask our server in Europe from time to time if the resource exists. We answer and here the latency doesn’t really matter that much, because most of the time the CDN will have the resource it’s looking for. 

Improving performance

As a software house, in Prographers, we provide web application solutions that enable companies to configure their products with high-quality graphics and design. 

However, our growth comes with many challenges, including optimizing loading times on the site because it started to affect the performance of our applications. As we expanded, the pressure on our servers increased, so we decided to consider Cloudflare to manage our apps better. 

  • Saving costs

The solution proved to be robust, scalable and cost-effective, as by using a content delivery network, we were able to reduce server costs significantly. 

  • Shortening loading times

The CDN works by storing cached versions of applications in multiple locations worldwide. This ensures that applications are delivered to end users from the closest possible location instead of directly from our server, significantly reducing loading times and improving the overall user experience.

  • Better security

It’s worth mentioning that with advanced security and performance features, the infrastructure provides an additional layer of protection against potential cyber threats. 

  • Edge computing

It also comes with edge computing capabilities, allowing applications to run directly on the edge network, reducing the need for costly server infrastructure.

Analytics – cache control

It is worth citing the statuses available in the panel regarding cache control. 

Let’s say that of the 1GB of data sent over the last 24 hours, more than 500MB has a HIT status – this means that the Cloudflare server knew that the requested information was there and was correct; it could respond right away without asking our server. About 300MB has a REVALIDATED status – a resource retrieved from our server, where some user requested the resource and the nearest proxy server wasn’t sure – it responded with what it had. Still, it wanted to ensure the resource was there and had stayed the same. If, on the other hand, it has changed, it saves the new version for itself. 

Other statuses worth discussing are: 

MISS – refers to the situation when the proxy does not have the resource, so the query goes directly to the original server that provides the resource. Such an option is a bit longer, but if 90% of the resources are cached anyway, it’s still faster than asking for all the resources. 

EXPIRED – the server used to have a resource, but its time has expired. 

DYNAMIC – proxy validates an asset as ineligible to cache, and the settings don’t clearly instruct the server to cache this asset. This is why the resource is requested from the original server. 

STALE – The cache handled the resource, but it had expired. There was no way for the proxy server to contact the source to retrieve the updated resource.

Conclusions

Working with such a solution has been groundbreaking. It reduces the cost of maintaining servers and increases the speed and performance of applications, leading to enhanced customer satisfaction.

Integration, described in the article, allows us to focus more on delivering high-quality 3D solutions for businesses and streamlining processes.

Let’s test our loading times on the projects’ page and get familiar with 3D web app for real estate.


Let's talk

SEND THE EMAIL

I agree that my data in this form will be sent to [email protected] and will be read by human beings. We will answer you as soon as possible. If you sent this form by mistake or want to remove your data, you can let us know by sending an email to [email protected]. We will never send you any spam or share your data with third parties.

I agree that my data in this form will be sent to [email protected] and will be read by human beings. We will answer you as soon as possible. If you sent this form by mistake or want to remove your data, you can let us know by sending an email to [email protected]. We will never send you any spam or share your data with third parties.