Blog Storage and Content Delivery Network (CDN)
What is Blog Storage?
In system design, the storage system used to store and retrieve blog data is referred to as blog storage. We use blog storage generally to store posts, comments, images, videos and other related data. The storage solution needs to be efficient, scalable, and capable of handling large amounts of data as a blog can accumulate a significant number of posts and user interactions over time.
What is Amazon S3?
Amazon S3, or Simple Storage Service, is a cloud-based storage solution provided by Amazon Web Services (AWS). It offers a simple and efficient way to store and retrieve data on the internet. In simple terms, think of it as a massive virtual storage warehouse where you can securely store any type of digital file like documents, images, videos, or backups. So it can be used as Blog Storage.
With Amazon S3, you can create “buckets” to organize your files. Each bucket acts as a container, similar to a folder, where you can store your data. The service is highly scalable, meaning you can store as much data as you need, from a few files to several petabytes or more, without worrying about running out of space.
One of the key advantages of Amazon S3 is its reliability and durability. It stores your data across multiple data centers, ensuring that even if one center experiences an issue, your files remain safe and accessible.
What is Content Delivery Network(CDN)?
A Content Delivery Network (CDN) is a network of servers distributed across different geographic locations that work together to deliver web content to users in the most efficient and fast way possible. In simple terms, it’s like having multiple copies of your website stored in various locations worldwide, closer to the users.
Let’s say a user requests content from Los Angeles, instead of fetching it from the original server(let’s say it is India), the CDN serves the content from a server that is geographically closer to the user(say, New York). This reduces the distance the data needs to travel, resulting in faster load times and improved performance.
Implementing a system using Amazon S3(blog storage) and CDN
Let’s look at an example of blog storage using Amazon S3 for media storage and connecting with a Content Delivery Network (CDN) in designing a system like Amazon/Netflix.
Scenario: Let’s say you want to develop an application like Amazon, where sellers can post their product descriptions, images, and videos. We aim to create a scalable and efficient storage solution for this application, combining it with a Content Delivery Network (CDN) and employing Amazon S3 for media storage.
Amazon S3 Media Storage
We can use Amazon S3 to store photos, videos, and other details related to a product. When a seller adds an image or a media file with the product, the file is safely stored in an Amazon S3 bucket. Each media file in the bucket is given a unique key (e.g., a filename or a generated identity) and can be accessed using an S3 URL.
We can use a database management system (DBMS) like MySQL, PostgreSQL, or MongoDB to store the textual content of a product. The product postings can be saved in a database table as structured data, with columns denoting the product title, product description, product reviews, etc. And if the application we were to design was similar to Netflix the data would be movie titles, casts, movie descriptions, reviews, etc. A product can be accessed based on multiple criteria, such as product title or product description, the DBMS provides efficient indexing and querying capabilities.
Integration with CDN
Let’s say this Amazon application is based out of India, and the application has a server in India serving requests all across the globe. Users requesting from the USA might be having a little delay in the response. So, this is where we can use Content Delivery Network (CDN) to improve the performance and optimize content distribution. So, we may combine our blog storage system with a CDN such as Cloudflare or Amazon CloudFront. The CDN caches static material, including photos and media files hosted in Amazon S3, on its worldwide edge servers. When a user visits a product on the application, the CDN serves static material like images from the closest edge server, decreasing latency and network congestion.
The system works as follows
- When a seller posts a product, the textual information is saved in the database, and any associated media items (such as images/videos) are uploaded to an Amazon S3 bucket.
- Along with the textual content, the product post metadata, including the media file URLs provided by Amazon S3, is kept in the database.
- When a user requests a product, the server retrieves the textual content from the database and generates the HTML markup required to display it.
- The URLs for the media files stored in Amazon S3 are included in the HTML markup as it is created by the server.
- The media file URLs are encountered when the user’s browser receives the HTML response. At this moment, the browser can launch media file requests directly from the CDN’s edge servers(nearest server), boosting performance and decreasing the burden on the backend infrastructure.
- The media assets are cached in the CDN’s edge servers, and subsequent requests for the duplicate media files are served directly from the cache.
- This system design enables efficient and scalable storage and delivery of blog material by employing Amazon S3 for media storage and connecting with a CDN, increasing the overall user experience.
Remember that this is a simplified example, and there may be other issues, such as controlling access permissions, handling file metadata, and implementing caching algorithms, depending on the system’s specific requirements.
Myself Bharath Choudhary, software developer at Oracle.
2021 NIT Warangal graduate.
Saturday – Sunday
10 AM – 5 PM
Follow Us :