You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
6 Hrs
15 Min
44 Seg

Explicación de Caching

27/33
Resources

What is caching in computer science?

The concept of caching is fundamental in computer science and affects both computers and applications. From RAM to mobile and web applications, caches are present at various levels and their crucial function is to speed up data access. In the context of a web application, caching significantly improves efficiency and performance.

How is caching implemented in a web application?

In a web application, the caching process starts from the browser. Let's explore how this process is carried out and how it benefits applications in production.

Caching in the browser

When a user enters a URL, the browser makes a call to this address. If no cache existed, the browser would have to access the server's file system directly to obtain, for example, a JavaScript file. This type of access is costly in terms of time compared to data stored in memory.

Using CDNs as a cache tier

Applications in production use Content Delivery Networks (CDN) as the first level of caching. A CDN is a service that specializes in distributing files such as JavaScript, CSS or HTML across globally distributed servers. This allows content to be delivered quickly and efficiently. First accesses may require a server query, but once stored in the CDN cache, subsequent access is much faster.

Caching on the server

After the CDN, the request can be directed to an intermediate web server such as Apache or Nginx, which may be configured to have their own internal cache. This capability allows servers to store and deliver files faster without having to recalculate or re-access the original source on each request.

Caching in the application

Within the application itself, there are multiple levels to implement caching. A common example is caching a complex computation, such as generating a JavaScript file that requires data from the database. When calculating it for the first time, it can be stored in RAM and then the file can be provided from the cache, thus optimizing response time.

What technologies make it possible to improve caching?

In addition to the methods mentioned above, advanced caching technologies are used to further enhance application efficiency.

RAM memory usage

RAM is a valuable resource for caching because of its speed compared to traditional database access. Classically, data and calculated results can be stored in RAM.

External caches: Redis and Memcached

Redis and Memcached are specialized external cache management solutions that significantly increase performance. They store data in memory, which allows extremely fast accesses. These technologies are popular because of their ability to reduce latency in applications by caching critical information and frequent queries.

Integration into web applications

Frameworks such as Rails allow you to easily integrate external caches such as Redis or Memcached, configuring them to store frequent API queries. This integration is essential for web applications that require optimal performance, allowing users to have a smooth and enhanced experience.

Caching transforms the way web applications manage data access, making initially costly operations fast and efficient. Understanding and correctly applying caching techniques not only improves the user experience, but also optimizes server resources, becoming a key competency in software development.

Contributions 2

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?

La chache en Ruby on Rails

En informática, una caché es un componente de hardware o software que almacena datos para que las solicitudes futuras de esos datos se puedan atender con mayor rapidez.

Hay dos argumentos principales para utilizar el almacenamiento en caché:

  • La aplicación se vuelve más rápida para el usuario. Una página web más rápida.
    ayuda a tener usuarios más felices, lo que resulta en una mejor tasa de conversión.
  • Necesita menos hardware para el servidor web porque necesita menos
    Recursos de CPU y RAM para procesar las consultas.

Algunos métodos de almacenamiento en caché:

  • Almacenamiento en caché de HTTP: Este es el martillo de los métodos de almacenamiento en caché y El arma de máximo rendimiento.
  • Almacenamiento en caché de páginas: este es el destornillador entre los métodos de almacenamiento en caché, puede sacar mucho rendimiento del sistema, pero no es tan bueno como almacenamiento en caché HTTP.
  • Fragmento de caché: esta es la pinza entre los métodos de caché, Pero no lo subestimes!

Conceptos extraídos de

¿Es más eficiente utilizar $redis como DB en caché o usar los sessions en rails?