Page caching - Leveraging Page Caching with Varnish in Rails Applications

Varnish can cache whole Rails pages in memory and serve them without touching the application, but only if Rails tells it which pages are safe to share. In this article, we’ll let Rails mark public pages with Cache-Control, configure Varnish to honour those headers without leaking one user’s page to another, and add PURGE/BAN invalidation.

 ·  · 7 min · 1314 words · Bá Tới

Page caching - Strategies for Web Performance Optimization

Page caching is a technique used to improve the performance of web applications by storing the entire HTML output of a page and serving it directly from the cache for subsequent requests. This eliminates the need to generate the page dynamically on each request, reducing server load and improving response times. In this article, we’ll explore the concept of page caching, the HTTP caching basics it relies on, and the main places a full page can be cached, plus related techniques that cache smaller pieces.

 ·  · 6 min · 1074 words · Bá Tới

Using Redis in Rails Applications

Redis is an in-memory data structure store known for its speed and flexibility. It serves as a high-performance database, cache, and message broker, offering data structures such as strings, hashes, lists, sets, and sorted sets. This article covers how Rails applications use Redis for caching, sessions, background jobs and counters, how to set up Rails’ built-in Redis cache store, and when Rails 8’s database-backed defaults make Redis optional.

 ·  · 4 min · 798 words · Bá Tới

Understanding A/B Testing: Enhancing Decision-Making in Web Development

A/B testing, also known as split testing, is a method used to compare two or more versions of a web page or application to determine which one performs better in achieving a predefined goal. In this article, we’ll look at the concept, how to implement it in Ruby on Rails with the Split gem, and how to read the results without fooling yourself.

 ·  · 6 min · 1061 words · Bá Tới

Understanding Load Balancing at Different Network Layers: A Comprehensive Overview

In modern web application environments, load balancing plays a critical role in distributing traffic across multiple servers to ensure optimal performance, reliability, and scalability. Load balancing techniques and tools are deployed at various network layers, each with its own set of advantages and disadvantages. In this article, we’ll explore different types of load balancing at different network layers and provide examples.

 ·  · 3 min · 622 words · Bá Tới

Understanding Nginx Real IP Module: Importance and Configuration

In the realm of web servers, accurate logging of client IP addresses is crucial for security, analytics, and compliance purposes. However, when Nginx is deployed behind a reverse proxy, load balancer, or CDN, the IP addresses logged may not reflect the actual client IP addresses. This is where the Nginx Real IP module comes into play.

 ·  · 7 min · 1374 words · Bá Tới

Understanding Sidekiq: A Powerful Background Job Processing Solution

In today’s web development landscape, handling background job processing efficiently has become crucial for building robust and scalable applications. Sidekiq stands out as a popular choice among developers due to its simplicity, performance, and powerful features. This article covers how it works, how to set it up in Rails, and how to tune it.

 ·  · 7 min · 1443 words · Bá Tới

Continuous Integration/Continuous Deployment (CI/CD) in Software Development

Continuous Integration (CI) and Continuous Deployment (CD) are two essential practices in modern software development. These practices, often abbreviated as CI/CD, play a crucial role in ensuring the efficiency, reliability, and speed of the software development lifecycle.

 ·  · 4 min · 800 words · Bá Tới

Understanding CSRF in Ruby on Rails

CSRF (Cross-Site Request Forgery) is a type of attack where an attacker tricks a user into performing unintended actions on a web application in which the user is authenticated. This article explains what CSRF is, how Rails’ authenticity tokens, Origin check and SameSite cookies protect against it, and when it is safe to skip the check.

 ·  · 5 min · 1030 words · Bá Tới

Understanding Promise and Deferred in JavaScript

In JavaScript, Promise and Deferred are essential concepts used to handle asynchronous operations, such as fetching data from a server or performing time-consuming tasks. They provide a more readable and manageable way to work with asynchronous code, making it easier to handle asynchronous tasks and their results.

 ·  · 4 min · 706 words · Bá Tới