Skip to contentমূল লেখায় যান

Topic 09 · Architectureটপিক 09 · Architecture

CDN for Static Content

Think of a bakery with one kitchen in the capital. If every customer must travel to that kitchen, the trip is long and the kitchen is crowded. So the bakery opens small shops in every town, and each shop keeps the popular loaves. A CDN does the same for files. It keeps copies of images, videos, CSS, and JavaScript in many places, so each user gets them from a place near them.

6 min read6 মিনিটে পড়া যায় · 6 sections6টি সেকশন · 6 sources6টি সোর্স · updated Nov 2026আপডেট: Nov 2026

A CDN: far origin, near edgeCDN: দূরের origin, কাছের edge

Ask for a file from far away, then from a nearby edge, and compare distance and time.দূর থেকে একটি file চান, তারপর কাছের edge থেকে চান, আর দূরত্ব ও সময় মেলান।

2 min2 মিনিট6 steps6টি ধাপ
  • Distanceদূরত্ব8000 km
  • Timeসময়160 ms
  • Origin requestsorigin-এ request1
8000 km · 160 ms8000 km · 160 msUserব্যবহারকারীOriginঅরিজিন

You’ll learnআপনি শিখবেন

  • Why a far origin is slowদূরের origin কেন ধীর✓
  • What an edge server isEdge server কী
  • Cache miss versus cache hitCache miss বনাম cache hit
  • What Cache-Control setsCache-Control কী ঠিক করে

In plain words

What a CDN is. A CDN (content delivery network) is a network of connected servers that makes web pages load faster Source 1সোর্স 1. Its main job is to reduce latency, which is the delay before data arrives Source 1সোর্স 1. The CDN has a point of presence (POP) in many places. A POP is a group of edge servers, which are CDN servers close to the users Source 1সোর্স 1.

The origin. The original file stays on the origin. The origin is your own server, or object storage such as Amazon S3, where you keep the original files Source 5সোর্স 5. The first time a user asks for a file, the request goes to the origin. The origin sends the file to the user and also sends a copy to the nearest POP Source 1সোর্স 1. After that, the next user in that area gets the file from the CDN, not from the origin Source 1সোর্স 1.

Static content. A CDN works best for static content. Static content is data that does not change from user to user, such as logos, header images, and fonts Source 1সোর্স 1. Dynamic content, such as login status or chat messages, is different for each user Source 1সোর্স 1. Because the CDN answers many requests, the origin gets less traffic and uses less bandwidth Source 1সোর্স 1. If some CDN servers go offline, other servers can take their place Source 1সোর্স 1.

Cache-Control. The origin tells the CDN what it can keep with the Cache-Control HTTP header. This header controls caching in browsers and in shared caches such as CDNs Source 2সোর্স 2. For example, max-age=N says that a copy stays fresh for N seconds Source 2সোর্স 2. HTTP decides if a copy is fresh by its age, the time since the response was made. This age is like the TTL (time to live) of other caches Source 3সোর্স 3.

Diagram: users in different regions get images, videos, CSS, and JavaScript from a nearby CDN edge server. On a cache miss, the edge server fetches the file from the origin, which is object storage or the backend, and keeps a copy.Open the image in full sizeছবিটি পূর্ণ আকারে খুলুন

সহজ English

A CDN (content delivery network) is a network of connected servers that makes web pages load faster Source 1সোর্স 1. Its main job is to reduce latency, the delay before data arrives Source 1সোর্স 1. A CDN has a point of presence (POP) in many places. A POP is a group of edge servers, which are CDN servers close to the users Source 1সোর্স 1.

The original file stays on the origin: your own server, or object storage such as Amazon S3 Source 5সোর্স 5. The first request for a file goes to the origin. The origin sends the file to the user and a copy to the nearest POP. The next user in that area gets the file from the CDN Source 1সোর্স 1.

A CDN works best for static content, such as logos and fonts, which is the same for every user. Dynamic content, such as chat messages, is different for each user Source 1সোর্স 1. With a CDN, the origin gets less traffic Source 1সোর্স 1.

The Cache-Control HTTP header tells the CDN what it can keep. For example, max-age=N says that a copy stays fresh for N seconds Source 2সোর্স 2.

বাংলা ব্যাখ্যা

CDN (content delivery network) হলো একে অপরের সাথে যুক্ত server-এর একটি network, যা web page দ্রুত load করতে সাহায্য করে Source 1সোর্স 1। এর মূল কাজ latency কমানো, অর্থাৎ data পৌঁছানোর আগের দেরি কমানো Source 1সোর্স 1। অনেক জায়গায় CDN-এর point of presence (POP) থাকে। একটি POP হলো কয়েকটি edge server-এর একটি group, আর edge server হলো user-দের কাছাকাছি থাকা CDN server Source 1সোর্স 1।

মূল file থাকে origin-এ। Origin হলো আপনার নিজের server, অথবা Amazon S3-এর মতো object storage, যেখানে আপনি মূল file-গুলো রাখেন Source 5সোর্স 5। কোনো user প্রথমবার একটি file চাইলে request-টি origin-এ যায়। Origin file-টি user-কে পাঠায় এবং একটি copy সবচেয়ে কাছের POP-এ পাঠায় Source 1সোর্স 1। এরপর সেই এলাকার পরের user file-টি origin থেকে নয়, CDN থেকে পান Source 1সোর্স 1।

CDN সবচেয়ে ভালো কাজ করে static content-এর জন্য, যেমন logo, header image ও font, যেগুলো user ভেদে বদলায় না Source 1সোর্স 1। Login status বা chat message-এর মতো dynamic content প্রতিটি user-এর জন্য আলাদা Source 1সোর্স 1। CDN অনেক request-এর উত্তর দেয় বলে origin-এ traffic কমে এবং bandwidth কম লাগে Source 1সোর্স 1। কিছু CDN server offline হলে অন্য server তাদের জায়গা নিতে পারে Source 1সোর্স 1।

Origin Cache-Control HTTP header দিয়ে CDN-কে জানায়, CDN কী রাখতে পারবে। এই header browser-এ এবং CDN-এর মতো shared cache-এ caching নিয়ন্ত্রণ করে Source 2সোর্স 2। যেমন, max-age=N মানে একটি copy N সেকেন্ড পর্যন্ত fresh থাকে Source 2সোর্স 2। HTTP একটি copy-র age, অর্থাৎ response তৈরি হওয়ার পর থেকে কত সময় গেছে, তা দেখে বোঝে copy-টি fresh কি না। এই age অন্য cache-এর TTL (time to live)-এর মতো Source 3সোর্স 3।

When you need it

  • The system serves a lot of static content.
  • Videos, images, PDFs, or JS and CSS bundles are large or are requested often.
  • Your users live in many different regions.
  • Static file traffic overloads the backend server.
  • You want pages to load faster.

সহজ English

You need a CDN in these cases:

  • The system serves a lot of static content.
  • Videos, images, PDFs, or JS and CSS bundles are large, or users ask for them often.
  • Your users live in many different regions.
  • The traffic for static files overloads the backend server.
  • You want pages to load faster.

বাংলা ব্যাখ্যা

এই অবস্থাগুলোতে আপনার একটি CDN দরকার হয়:

  • System অনেক static content serve করে।
  • Video, image, PDF, অথবা JS ও CSS bundle বড়, অথবা সেগুলোর জন্য প্রায়ই request আসে।
  • আপনার user-রা অনেক আলাদা region-এ থাকেন।
  • Static file-এর traffic backend server-এর ওপর অতিরিক্ত চাপ দেয়।
  • আপনি চান, page আরও দ্রুত load হোক।

A real-life example

An LMS (learning management system) has course thumbnails, recorded class videos, certificate PDFs, and JavaScript bundles. The backend API should not send these files itself.

A better design keeps these files in object storage and serves them through a CDN. The backend can then focus on business logic, such as enrollment and payments, and the CDN carries the file traffic.

সহজ English

Think of an LMS (learning management system). It has course thumbnails, recorded class videos, certificate PDFs, and JavaScript bundles. The backend API should not send these files itself.

A better design works like this:

  • The files stay in object storage.
  • A CDN sends them to users.
  • The backend handles business logic, such as enrollment and payments.

This way, the CDN carries the file traffic.

বাংলা ব্যাখ্যা

ধরুন, একটি LMS (learning management system)-এ course thumbnail, recorded class video, certificate PDF এবং JavaScript bundle আছে। Backend API-এর নিজে এই file-গুলো পাঠানো উচিত নয়।

ভালো design হলো file-গুলো object storage-এ রাখা এবং CDN-এর মাধ্যমে serve করা। তখন backend enrollment ও payment-এর মতো business logic-এ মন দিতে পারে, আর CDN file-এর traffic বহন করে।

Common mistakes

  • Caching personal data in the CDN. A shared cache keeps one copy and gives it to many users Source 2সোর্স 2. If a response with personal content does not have the private directive, the CDN can give one user's data to another user Source 2সোর্স 2. Use private, or no-store, which tells all caches not to store the response Source 2সোর্স 2.
  • Private files on public CDN links. A paid course video must not be open to everyone who has the link. CloudFront, for example, serves private content through signed URLs or signed cookies Source 5সোর্স 5. AWS also recommends that users cannot reach the origin directly, so they cannot bypass those checks Source 5সোর্স 5.
  • Forgetting to refresh the cache. After you change a file, the old copy can stay at the edge until it expires Source 4সোর্স 4. An invalidation removes the copy, and the CDN fetches the latest file from the origin on the next request Source 4সোর্স 4. But a user can still see the old file from a browser or proxy cache Source 4সোর্স 4.
  • Changing JS or CSS but keeping the same file name. If the JavaScript and CSS versions that a browser uses are out of sync, the page display breaks Source 3সোর্স 3. Put a version number or a hash in the file name, and never change the file at that name. MDN calls this the cache-busting pattern Source 2সোর্স 2. AWS also recommends versioned file names for files that you update often Source 4সোর্স 4.
  • Ignoring CDN or origin failure. Plan what happens when the origin is down. CloudFront can switch to a second origin when the first one fails Source 6সোর্স 6. The stale-if-error directive lets a cache send an old copy when the server returns a 500, 502, 503, or 504 error Source 2সোর্স 2.

সহজ English

  • Caching personal data. A shared cache gives one copy to many users. A personal response without the private directive can go to the wrong user. Use private or no-store Source 2সোর্স 2.
  • Private files on public CDN links. A paid course video must not be open to everyone who has the link. CloudFront, for example, uses signed URLs or signed cookies. AWS also recommends that users cannot reach the origin directly Source 5সোর্স 5.
  • Forgetting to refresh the cache. A changed file can stay old at the edge until it expires. An invalidation removes the old copy, but a browser or proxy cache can still show it Source 4সোর্স 4.
  • Changing JS or CSS but keeping the same file name. If the JS and CSS versions in a browser do not match, the page display breaks Source 3সোর্স 3. Put a version or a hash in the file name Source 2সোর্স 2.
  • Ignoring CDN or origin failure. CloudFront can switch to a second origin if the first one fails Source 6সোর্স 6. With stale-if-error, a cache can send an old copy on a 500, 502, 503, or 504 error Source 2সোর্স 2.

বাংলা ব্যাখ্যা

এই সাধারণ ভুলগুলোর দিকে খেয়াল রাখুন:

  • CDN-এ personal data cache করা। একটি shared cache একটি copy রাখে এবং সেটি অনেক user-কে দেয়। Personal content-সহ কোনো response-এ private directive না থাকলে CDN একজন user-এর data অন্য user-কে দিতে পারে। private ব্যবহার করুন, অথবা no-store, যা সব cache-কে response-টি store না করতে বলে Source 2সোর্স 2।
  • Public CDN link-এ private file। একটি paid course video, link থাকলেই যে কেউ খুলতে পারবে, এটি চলবে না। যেমন, CloudFront signed URL বা signed cookie দিয়ে private content serve করে। AWS আরও পরামর্শ দেয়, user-রা যেন সরাসরি origin-এ পৌঁছাতে না পারেন, যাতে তাঁরা এই check এড়িয়ে যেতে না পারেন Source 5সোর্স 5।
  • Cache refresh করতে ভুলে যাওয়া। File বদলানোর পরও পুরনো copy expire না হওয়া পর্যন্ত edge-এ থেকে যেতে পারে। Invalidation copy-টি সরিয়ে দেয়, আর পরের request-এ CDN origin থেকে নতুন file আনে। তবে browser বা proxy cache থেকে user তখনও পুরনো file দেখতে পারেন Source 4সোর্স 4।
  • JS বা CSS বদলানো, কিন্তু file name একই রাখা। Browser যে JavaScript ও CSS version ব্যবহার করে, সেগুলো মিল না খেলে page-এর display ভেঙে যায় Source 3সোর্স 3। File name-এ একটি version number বা hash দিন, এবং সেই name-এর file আর কখনো বদলাবেন না। MDN একে cache-busting pattern বলে Source 2সোর্স 2।
  • CDN বা origin failure উপেক্ষা করা। Origin down হলে কী হবে, তার পরিকল্পনা করুন। প্রথম origin fail করলে CloudFront দ্বিতীয় একটি origin-এ যেতে পারে Source 6সোর্স 6। Server 500, 502, 503, বা 504 error দিলে stale-if-error directive একটি cache-কে পুরনো copy পাঠাতে দেয় Source 2সোর্স 2।

What a tester can check

Tutorial advice

These test ideas are the tutorial's own advice.

  • Cache headers. Open the network tab and check the Cache-Control header of a static file and of a logged-in API response. A personal response must not say public.
  • Two users, one URL. Log in as user A and load a personal page through the CDN. Then load the same URL as user B. User B must never see user A's data.
  • Private file links. Copy the link of a paid video or a certificate PDF. Open it in a private window with no login, and after the signed link expires. You must get an error, not the file.
  • New release, new files. Deploy a JS or CSS change. Check that the file name changes and that a normal reload shows the new version with no broken layout.
  • Origin down. In a test environment, stop the origin or object storage. Check what users see: a cached copy, a clear error page, or a blank page.

সহজ English

These test ideas are the tutorial's own advice.

  • Cache headers. Open the network tab. Check the Cache-Control header of a static file and of a logged-in API response. A personal response must not say public.
  • Two users, one URL. Log in as user A and load a personal page through the CDN. Then load the same URL as user B. User B must never see the data of user A.
  • Private file links. Copy the link of a paid video or a certificate PDF. Open it in a private window with no login. Also open it after the signed link expires. You must get an error, not the file.
  • New release, new files. Deploy a JS or CSS change. Make sure that the file name changes. Make sure that a normal reload shows the new version with no broken layout.
  • Origin down. In a test environment, stop the origin or object storage. Check what users see: a cached copy, a clear error page, or a blank page.

বাংলা ব্যাখ্যা

নিচের test ধারণাগুলো এই tutorial-এর নিজস্ব পরামর্শ।

  • Cache header। Network tab খুলুন। একটি static file এবং একটি logged-in API response-এর Cache-Control header দেখুন। কোনো personal response-এ public লেখা থাকা চলবে না।
  • দুই user, একটি URL। User A হিসেবে log in করে CDN-এর মাধ্যমে একটি personal page load করুন। এরপর একই URL user B হিসেবে load করুন। User B যেন কখনোই user A-এর data দেখতে না পান।
  • Private file link। একটি paid video বা certificate PDF-এর link copy করুন। Login ছাড়া একটি private window-এ link-টি খুলুন। Signed link expire হওয়ার পরও আবার খুলুন। আপনাকে অবশ্যই error পেতে হবে, file নয়।
  • নতুন release, নতুন file। একটি JS বা CSS পরিবর্তন deploy করুন। দেখুন, file name বদলায় কি না, এবং সাধারণ reload-এ layout না ভেঙে নতুন version দেখা যায় কি না।
  • Origin down। একটি test environment-এ origin বা object storage বন্ধ করুন। User-রা কী দেখেন, তা দেখুন: একটি cached copy, একটি পরিষ্কার error page, নাকি একটি blank page।

Key words

WordMeaning
CDNContent delivery network: servers in many places that keep copies of files near users
Edge serverA CDN server close to the user
POPPoint of presence: a CDN location with a group of edge servers
OriginThe server or storage that holds the original file
Static contentData that is the same for every user, such as images and CSS
Cache-ControlThe HTTP header that says who can keep a copy and for how long
InvalidationA request to remove a file from the CDN cache before it expires
Cache bustingPutting a version or hash in a file name so a changed file gets a new URL
Signed URLA special link with a signature that gives access to a private file

Reels on this topicএই টপিকের রিলস

Short videos from other creators, picked for this topic. They are not part of this page's fact-checked text. Nothing loads from YouTube until you press Play.অন্য ক্রিয়েটরদের বানানো ছোট ভিডিও, এই টপিকের জন্য বাছাই করা। এগুলো এই পেজের ফ্যাক্ট-চেক করা লেখার অংশ নয়। চালান বাটন চাপার আগে YouTube থেকে কিছুই লোড হয় না।

  1. [1]
    What is a CDN (Content Delivery Network)?

    Amazon Web Services · accessed 2026-10-20দেখা হয়েছে: 2026-10-20

  2. [2]
    Cache-Control header

    MDN Web Docs · accessed 2026-10-20দেখা হয়েছে: 2026-10-20

  3. [3]
    HTTP caching

    MDN Web Docs · accessed 2026-10-20দেখা হয়েছে: 2026-10-20

  4. [4]
    Invalidate files to remove content

    Amazon CloudFront Developer Guide · accessed 2026-10-20দেখা হয়েছে: 2026-10-20

  5. [5]
    Serve private content with signed URLs and signed cookies

    Amazon CloudFront Developer Guide · accessed 2026-10-20দেখা হয়েছে: 2026-10-20

  6. [6]
    Optimize high availability with CloudFront origin failover

    Amazon CloudFront Developer Guide · accessed 2026-10-20দেখা হয়েছে: 2026-10-20