How to implement high-concurrency image Upload through the built-in GD, write a PHP Upload program, found the following problems: 1. eat memory, upload a 2 m image will consume about 60 m of memory; 2. CPU usage: One person uploads a large image (3 MB), and the CPU usage of the PC reaches 50%. 3. the cutting speed is slow, it takes 11 seconds for windows + apache to scale a 3 M image into four images. & nbsp; the result of the above problem is that when multiple users upload images, the image will often fail, how does the service implement high-concurrency image upload?
Through the built-in GD, I wrote a PHP Upload program and found the following problems:
1. memory consumption: uploading a 2 m image consumes about 60 m of memory;
2. CPU usage. one person uploads a large image (3 MB), and the CPU usage of the PC reaches 50%;
3. the cutting speed is slow. it takes 11 seconds for windows + apache to scale a 3 M image into four images;
The result of the above problem is that when multiple users upload images, the image will often fail, and the server CPU and memory consumption is high;
During the test, three people upload files at the same time are basically useless. I don't know if it has something to do with writing;
It is recommended that imagemagic be used before. I have tried it myself and it consumes a lot of resources.
How can I achieve high concurrent image Upload efficiency? I hope you can give me some comments;
(Note: you can give me any comments. it is better to give me some information. this problem is a headache)
------ Solution --------------------
The IIS single machine in Windows is better than APACHE, and multiple machines have no chance to use it, so I don't know.
------ Solution --------------------
The general model configuration is as follows:
Frequency: 2.6
Memory: 2 GB
Set display
4 Mbps bandwidth
Windows XP + Apache2.2 can take up to 2-3 seconds
0-3 seconds for Fedora15 + Apache2.2
Image pixel 2592*1936 1.82 M
------ Solution --------------------
You can run the convert command of imagemagick in the command line to see how it works.