I received an email notification that our cloud account has almost reached the limit of our plan, even though it's not the smallest one. There weren't too many visitors, only about 10,000 in a couple of days, and suddenly it's like all the space, all our traffic, is gone, it's over 200 gigabytes. I'm interested in how this could have happened and how to solve this problem. Right now, we will investigate and make a small post about it.
It seems we have encountered an issue with reaching the storage and traffic limits on our cloud account. There are several steps we can take to address this problem:
1. Check Activity Logs / Reports : Review the activity logs in your cloud account to understand which files or operations may have led to reaching the limit. This can help you pinpoint what caused the issue.
https://autov.be/stock/pagination/1.html
Each request consists of approximately 1.5 megabytes of data, and you had a total of 400,000 requests (10,000 visitors, each making 40 requests). Let's calculate the total data usage:
1.5 megabytes per request * 400,000 requests = 600,000,000 megabytes
To convert this into gigabytes, you need to divide by 1024 (since 1 gigabyte = 1024 megabytes):
600,000,000 megabytes / 1024 = 585,937.5 gigabytes
So, you used approximately 586 gigabytes of data for these past few days with 10,000 visitors, each making 40 requests, and each request containing 1.5 megabytes of data.
2. Optimize Traffic: If you have a high number of visitors, there may be ways to optimize data transfer, such as using caching and file compression to reduce traffic.
Enhance Your Media
Automate optimizations by using 'f_auto' for automatic format selection, 'q_auto' for automatic quality adjustment, and 'c_scale,w_' for straightforward image scaling.
Upon initial URL access, a derivative asset is created and cached across multiple CDNs, ensuring efficient delivery to your users from the nearest location.
I hope these tips help you address the issue.
For example:
https://res.cloudinary.com/dhnd7npcs/image/upload/c_scale,w_360/f_auto/q_auto/v1/media/vehicle_stock/mercedes-benz_e-220_2014/images/bf277dfe-5040-4dce-bb71-c7ca04efa0f8_cfc3713a-242f-47da-a05d-295f2f558479_l8mwre
In Django templates?
{% load cloudinary %}
{% cloudinary test_model_instance.image.name width=100 height=100 %}
Or URL optimization within the property, for instance, for more tailored solutions.
@property
def img(self):
url_front = "https://res.cloudinary.com/"
url_default = url_front + settings.CLOUDINARY_STORAGE["CLOUD_NAME"] + "/image/upload/v1/media/"
url_optimizated = url_front + settings.CLOUDINARY_STORAGE["CLOUD_NAME"] + "/image/upload/c_scale,w_360/f_auto/q_auto/v1/media/"
if self.vehicle_img.first():
url = self.vehicle_img.first().img.url.replace(url_default, url_optimizated)
else:
url = None
return url
In this way, we've reduced 1.5 megabytes to 14 kilobytes, which appears to be a thousandfold optimization.
Now, let's see, in a few days, whether we'll need to upgrade our account or if our traffic remains consistently optimized.
Furthermore, on the detailed page, we can apply similar properties or tags to ensure that images are downloaded in optimized formats rather than the original ones, with variations for different applications as well.
Comments
Post a Comment