The current architecture of the project is LNMP. The main function is for users to upload large images (5-30M) to the server, and the server will then cut the large image into hundreds of small images. Load the thumbnail after front-end access.
I have no experience in using CDN and OSS. I only know about Qiniu’s image storage, which is used by companies in the same industry. In the past few days, a certain work in the project was forwarded a lot on WeChat and the number of visits was relatively large (10W PV that day) , causing a bottleneck in the server bandwidth, I am temporarily using Alibaba Cloud's CDN to accelerate static images. Since I did not consider using independent storage to process images in the early planning, I now want to separate the images.
There are currently 3 bottlenecks:
1. CPU: When cutting a large picture into small pictures, the CPU usage is very high. If more than 20 users are cutting pictures at the same time, the CPU will basically reach 80%. The CPU is currently 8-core from Alibaba Cloud, and the memory is 16G, which is enough memory. According to our current user base, there will be no more than 20 users cutting pictures online at the same time.
2. Storage: Since users can upload large images without restrictions, it is also a problem to store images on a single machine. Currently, it is a 1T ordinary hard drive
3. Bandwidth: Currently, the fixed bandwidth is 10M, which is enough under normal traffic conditions , if a work is sent to WeChat Moments by a user and a large number of reposts occur, the bandwidth will not be enough under high concurrency conditions.
Solution:
1. Use Qiniu's picture storage. The only troublesome thing about using Qiniu is the synchronization of pictures. Pictures uploaded by users may be modified and deleted, and they need to be synchronized to Qiniu immediately. I don’t know if there will be slow synchronization or other unknown problems.
2. Use Alibaba’s OSS CDN. Since the server is now also an Alibaba product, image synchronization can be done through the intranet, and the speed should be better. However, I saw some information saying that Alibaba’s fees are much more expensive than Qiniu. I haven’t compared them, so I don’t know how big the gap is.
Which of these two options is reasonable? Is there any better option? Thanks!
The current architecture of the project is LNMP. The main function is for users to upload large images (5-30M) to the server, and the server will then cut the large image into hundreds of small images. Load the thumbnail after front-end access.
I have no experience in using CDN and OSS. I only know about Qiniu’s image storage, which is used by companies in the same industry. In the past few days, a certain work in the project was forwarded a lot on WeChat and the number of visits was relatively large (10W PV that day) , causing a bottleneck in the server bandwidth, I am temporarily using Alibaba Cloud's CDN to accelerate static images. Since I did not consider using independent storage to process images in the early planning, I now want to separate the images.
There are currently 3 bottlenecks:
1. CPU: When cutting a large picture into small pictures, the CPU usage is very high. If more than 20 users are cutting pictures at the same time, the CPU will basically reach 80%. The CPU is currently 8-core from Alibaba Cloud, and the memory is 16G, which is enough memory. According to our current user base, there will be no more than 20 users cutting pictures online at the same time.
2. Storage: Since users can upload large images without restrictions, it is also a problem to store images on a single machine. Currently, it is a 1T ordinary hard drive
3. Bandwidth: Currently, the fixed bandwidth is 10M, which is enough under normal traffic conditions , if a work is sent to WeChat Moments by a user and a large number of reposts occur, the bandwidth will not be enough under high concurrency conditions.
Solution:
1. Use Qiniu's picture storage. The only troublesome thing about using Qiniu is the synchronization of pictures. Pictures uploaded by users may be modified and deleted, and they need to be synchronized to Qiniu immediately. I don’t know if there will be slow synchronization or other unknown problems.
2. Use Alibaba’s OSS CDN. Since the server is now also an Alibaba product, image synchronization can be done through the intranet, and the speed should be better. However, I saw some information saying that Alibaba’s fees are much more expensive than Qiniu. I haven’t compared them, so I don’t know how big the gap is.
Which of these two options is reasonable? Is there any better option? Thanks!
In fact, Qiniu will be better. The problems you are worried about can be solved. Many times the problems arise because the designers are taking advantage of them. For example, do you want to modify the picture? Just delete the new ones and create new ones. If the names have changed, they will not be affected by the cache.
As for the problem of cutting pictures you mentioned... why do you need to cut pictures online? Can't you cut it yourself? Do I have to cut the original image? Cutting a 30M original image and cutting a 600K thumbnail definitely occupy different resources. Do you enlarge the 30M original image to 100% for users to cut?
Alibaba’s price should be cheaper than Qiniu’s. Alibaba Baichuan previously had 100GB of free storage space
Users directly transfer to Qiniu. Please refer to the official documentation for details. There is a demo