Good server spec for image resizing in PHP
I have a site that allows users to upload images that are then scaled down to 4 different sizes.
I am moving to a new host and I was wondering what is a good specification to handle this task, or if any server specification can handle the task. Should I be looking at more RAM or better processor, etc ...
Images are currently limited to 2mb, but I would like to enlarge them.
Is there something in between these (for this task)?
Option 1. * Processor: Pentium 4 3GHZ Hyperthreaded * Memory: 2GB DDR SDRAM * Hd1: 120GB 7200RPM SATA / 8MB cache * Hd2: 120GB 7200RPM SATA / 8MB cache * OS: Linux - CentOS 5 (+32 bit)
Option 2 * Processors: 2.2 GHz Intel Core 2 Duo dual-core processor * Memory: 1 GB RAM * Hard disk: 1x 160GB 7,200 rpm * OS: Linux - CentOS 5.2
change
- I am using http://pear.php.net/package/Image_Transform with GD2
- The volume is very low, but some JPG files fail even when they are <2mb
- Current hosting is VPS with 768mb dedicated bar (find about cpu)
source to share
Definitely stick with VPS (vs. shared hosting), because the image handling in PHP is all about setting up the php.ini file.
There are many reasons why a PHP script might not be able to handle the download:
- The download is too big. The upload size is controlled by several directives: post_max_size, upload_max_filesize, memory_limit. If all of the above directives are not configured properly, the defaults will close you around 2MB.
- Memory does not work with the image. The memory_limit directive affects this. Also make sure your code is freeing resources as soon as possible and not waiting for the script to complete.
- The operations took too long. max_input_time and max_execution_time control how long the script takes to execute (max_input_time controls HTTP I / O, max_execution_time controls the actual execution of the script). Large images take longer.
Figure out what conditions are failing and then scale your server to accommodate those conditions. If you switch hosts based on performance issues, you might want to do that first. You may find that the switch is not being used.
source to share
IF you are just doing development / testing and maybe just soft launching - if that goes well. If you plan to live live, you will need to keep track of your server load and the number of processes you create, as well as how long your actual resizing times are for images.
If you plan on handling serious volumes in the near future, you will definitely need a dual-core system. Image resizing is very intensive. Further down the road, you may need additional machines to handle image processing and another to handle the site.