Most people use cloud storage apps, such as Object Storage Service (OSS), for images or other large files. However, cloud storage is not intrinsically limited to a single use case but merely provides a platform for us to solve a wide range of problems. In this article, we will explain how to use Alibaba Cloud OSS to solve the problem of insufficient HTML cache space.
Caching is crucial for websites and can solve most complex performance issues. There are many types of cache, the most common ones being the memory cache and the disk cache (page cache). Memory cache is quicker and is typically used to store critical and hot content, but it cannot be used to store large amounts of data. Disk cache on the other hand is much slower because it employs disk I/O. However, the disk cache can be used for performing complex database queries, processing business logic, and accelerating page loading.
In this example, several hundred GBs of HTML page file cache data is generated every day. What will happen if we put all of these files directly onto a hard drive?
We can use OSS to store these small HTML page files. The advantages of using OSS are:
Step 1: Activate OSS
Before using Alibaba Cloud OSS service, ensure that you have registered for an Alibaba Cloud account and completed real-name authentication. If you do not have an Alibaba Cloud account yet, the system will prompt you to register for an account when you activate OSS.
Process
Step 2: Create a bucket
After you activate Alibaba Cloud OSS service, you need to use the OSS console to create a bucket for storing files.
Process
Public Read: Only the creator of the bucket can perform write and delete operations on the objects in the bucket. Any users (including anonymous users) can read the objects in the bucket.
Private: Only the creator of the bucket can perform read, write, and delete operations on the objects in the bucket. Other users cannot access the objects in the bucket without authorization.
Step 3: Upload a file
After you create a bucket, you can upload all types of files to the bucket. Using the OSS console, you can upload files smaller than 5 GB. For details about how to upload files larger than 5 GB, refer to Multipart Upload in the Alibaba Cloud OSS Developer Guide.
Process
Step 4: Delete an object
If you do not need to store an uploaded object any longer, you can delete it to avoid further charges. You can delete a single object or delete multiple objects in batches in the OSS console.
Process
In this article, we introduced the problems with conventional caching methods and discussed the method of using OSS to cache HTML files. With OSS, you do not have to worry about disk space limitations or high server loads from deleting multiple expired files. At less than five Chinese yuan a day, OSS is a cost effective solution to all your file storage needs. Try it today!
How Does Alibaba Cloud Power the Biggest Online Shopping Festival?
2,599 posts | 762 followers
FollowAlibaba Cloud Native Community - September 20, 2023
Alibaba Clouder - February 20, 2020
Alibaba Clouder - December 18, 2017
Alibaba Clouder - January 25, 2018
Alibaba Clouder - October 29, 2018
Alibaba Clouder - January 3, 2018
2,599 posts | 762 followers
FollowTair is a Redis-compatible in-memory database service that provides a variety of data structures and enterprise-level capabilities.
Learn MoreAn encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MorePlan and optimize your storage budget with flexible storage services
Learn MoreA cost-effective, efficient and easy-to-manage hybrid cloud storage solution.
Learn MoreMore Posts by Alibaba Clouder