Debugging Time Out Issue In Magento

To prevent Magento API time outs, this page shows some sizing suggestions for Magento sites. Sizing depends on the size of the catalog and the number of sessions.

Sizing up your own requirements

As a rule of thumb, it is possible to

  • Directly correlate your traffic levels to your CPU requirements
  • Directly correlate your CPU requirements to RAM requirements
  • Directly correlate your MySQL storage to RAM requirements

CPU Selection

First start by sizing up your traffic.

A standard Magento demo store is capable of delivering roughly 230 uniques per GHz, per hour.

A typical web store, with admin user activity, development activity, product addition/deletion can see this degrade by around 100%, to 115 uniques per GHz, per hour.

A store with a poorly built/heavy template can further reduce the figure by another 100-200%, to 50 uniques per GHz, per hour.

Using these numbers, you can work out exactly what you need in terms of CPU resource.

Eg. If you have 4,025 sustained unique visitors/day - you need 28GHz total CPU resource (ie. 8 Cores @ 3.5GHz, or 12 Cores @ 2.3GHz)

The other important detail is the speed of the CPU, it is possible to have:

A slow page load time and low concurrency support (low clock speed CPU (GHz), few cores)

A fast page load time, but low concurrency support (high clock speed CPU (GHz), few cores)

A slow page load time, but high concurrency support (low clock speed CPU (GHz), lots of cores)

A fast page load time and high concurrency support (high clock speed CPU (GHz), lots of cores)

RAM Selection

For a standalone server (the best configuration for Magento), the rule here is 2GB RAM/CPU Core. So if you have 8 cores, then 16GB RAM should be the minimum.

To work out what you need in addition to this, you need to factor in the size of your catalogue. Doing this is easy, multiply your number of store views against the total catalogue size.

Eg. In your case, 1 store view * 10,000 products = 10,000

					<1,000    = 8GB   RAM
					<50,000   = 16GB  RAM
					<100,000  = 32GB  RAM
					<100,000  = 32GB  RAM
					<250,000  = 48GB  RAM
					<500,000  = 64GB  RAM
					<750,000  = 96GB  RAM
					>999,999  = 128GB RAM   

You want to take the higher of the two numbers (ie. from the CPU Core:RAM ratio and catalogue requirements), or a sensible mix of the two.

 

HDD Selection

Lets make something clear, for the average Magento store (ie. <50k unique visitors/day), Magento is not bound by I/O - SSDs will not make your Magento store faster; it won't improve concurrency and it won't improve TTFB. Similarly, using striped RAID levels (eg. RAID10) will also provide no advantage (as almost every file on disk is going to be smaller than the stripe size anyway, so only a single disk will be used).

The only time storage is a bottleneck is on contended services (ie. cloud/VPS).

However, there are certainly advantages to fast I/O beyond the store operation itself. With SSDs, file operations (eg. Git/SVN status, backup/restore, copying directories etc.) are substantially faster. Your developer's life will be substantially easier (with routine tasks being much quicker).

Also note that not all disk drives are created equal.

  • Cheap/desktop-grade SSDs will perform slower than conventional HDDs
  • Cheap/desktop-grade HDDs will perform slower than enterprise HDDs
  • Cheap/desktop-grade HDDs will have poor NRE rates (usually 10^14) compared to enterprise disks (usually 10^16)

So be sure to actually pick disk drives that deserve to be in a server, Ie. the Intel DC S3700.

Picking capacity is easy, you just need two commands,

For the Magento document root

		
				cd /path/to/magento/installation 
				du -hsL . \
				--exclude="/var/log" \
				--exclude="/var/session" \
				--exclude="/var/cache" \
				--exclude="/var/full_page_cache" \
				--exclude="/var/report" \
				--exclude="/var/tmp" \
				--exclude="/includes/src/" 
		
		

For the MySQL DB

				SELECT 
				IFNULL(B.engine,'Total') "Storage Engine", 
				CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),',',''),17,' '),' ',SUBSTR(' KMGTP',pw+1,1),'B') "Data Size", 
				CONCAT(LPAD(REPLACE(FORMAT(B.ISize/POWER(1024,pw),3),',',''),17,' '),' ',SUBSTR(' KMGTP',pw+1,1),'B') "Index Size", 
				CONCAT(LPAD(REPLACE(FORMAT(B.TSize/POWER(1024,pw),3),',',''),17,' '),' ',SUBSTR(' KMGTP',pw+1,1),'B') "Table Size" 
				FROM (SELECT engine,SUM(data_length) DSize,SUM(index_length) ISize,SUM(data_length+index_length) TSize 
				FROM information_schema.tables 
				WHERE table_schema NOT IN ('mysql','information_schema','performance_schema') 
				AND engine IS NOT NULL 
				GROUP BY engine 
				WITH ROLLUP) B,(SELECT 3 pw) A 
				ORDER BY TSize;
		

To learn more, please see the rest of these guidelines in Ben Lessani's post on Magento StackExchange.