views:

449

answers:

3

I have a site that enables users to upload images which are then re-sized into 4 different sizes.

I'm moving to a new host and I wondered what makes a good spec for handling this task - or should any server spec be able to handle this task. Should I look at more RAM or a better CPU etc...

Images are currently restricted to 2mb but I'd like to increase that.

Is there anything to choose 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: Dual Core Intel Core 2 Duo 2.2GHz * Memory: 1GB RAM * Hard Disk: 1x 160GB 7,200rpm * OS: Linux - CentOS 5.2

edit:

+3  A: 

You don't say how many you are doing per time period, what you are using (GD? ImageMagick? Something else) or the spec and performance of your current server.

However unless you are doing a lot, both of those servers should be way more than fine.

benlumley
A: 

IF you're just doing development/testing, and maybe just a soft launch - one if fine. If you expect to go live you're going to need to keep tabs on your server load and how many processes you are spawning, as well as how long your actual resize time is for images.

If you expect to handle serious volume in the near future, you'll definitly want the dual core system. Resizing images is very intensive. Further down the road, you may need additional machines just to handle image processing and one to handle the site.

+2  A: 

Definitely stick with a VPS (vs. shared hosting) because working with images in PHP is all about tuning your php.ini file.

There are a ton of reasons why a PHP script would fail to process an upload:

  1. Upload 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 cap you around 2MB.
  2. Ran out of memory working with the image. The memory_limit directive affects this. Also make sure your code is releasing resources as soon as possible instead of waiting for script termination.
  3. Operations took too long. max_input_time and max_execution_time control how long the script gets to execute (max_input_time controls HTTP I/O, max_execution_time controls actual script execution). Bigger images take longer to process.

Figure out which conditions are failing, and then scale your server up to resolve those conditions. If you are switching hosts based on performance issues, you might want to do this first. You might find that the switch is unneeded.

Nathan Strong