High Wait Time from Time To First Byte with Magento + Nginx Announcing the arrival of Valued...
Is it true that "carbohydrates are of no use for the basal metabolic need"?
Should I call the interviewer directly, if HR aren't responding?
Are my PIs rude or am I just being too sensitive?
Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?
What is the longest distance a 13th-level monk can jump while attacking on the same turn?
Storing hydrofluoric acid before the invention of plastics
Do you forfeit tax refunds/credits if you aren't required to and don't file by April 15?
Diagram with tikz
Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?
Output the ŋarâþ crîþ alphabet song without using (m)any letters
How do I stop a creek from eroding my steep embankment?
Is there any avatar supposed to be born between the death of Krishna and the birth of Kalki?
Why is "Captain Marvel" translated as male in Portugal?
I am not a queen, who am I?
Is there a documented rationale why the House Ways and Means chairman can demand tax info?
Stars Make Stars
If Jon Snow became King of the Seven Kingdoms what would his regnal number be?
Determinant is linear as a function of each of the rows of the matrix.
If 'B is more likely given A', then 'A is more likely given B'
What is the correct way to use the pinch test for dehydration?
If a contract sometimes uses the wrong name, is it still valid?
What are the motives behind Cersei's orders given to Bronn?
Why does Python start at index -1 when indexing a list from the end?
Why are there no cargo aircraft with "flying wing" design?
High Wait Time from Time To First Byte with Magento + Nginx
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Come Celebrate our 10 Year Anniversary!How do I get PHP 5.3.3 working with Nginx on CentOS 5.5?How to make nginx reverse proxy let 503 error pages pass through to client?Blank Page: wordpress on nginx+php-fpmNginx gives 504 Gateway Time-out once moved to liveNGINX don't parse .php5 as .phpLaravel 4.1 on nginx routes error 404nginx rewrite throw 404 with last and breakCodeIgniter nginx rewrite rules for i8ln URL'sHow to configure nginx to serve one site from two different document root and using different php depending on URLNGINX virtual host config for Magento2 in a subfolder
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am having issue with high TTFB time, especially wait time after send.
Webpagetest shows the TTFB is almost 4 seconds.
Pingtom specifies the wait time is the bottleneck here
Here is my setup for Magento + Nginx server, see screenshots for test and configuration http://share.pho.to/#7BuP9
- OS: Ubuntu 14.04 server
- nginx/1.4.6
- PHP 5.5.9
- opcache 7.0.3
- memcached
- PHP-FPM
- Magento 1.9.0.1
- Linode 2GB /2Core Server
Nginx server config
server {
server_name dev.magibooks.com;
return 301 $scheme://www.dev.magibooks.com$request_uri;
}
server {
listen 80;
#listen 443 ssl spdy;
#ssl on;
#ssl_certificate /etc/nginx/ssl/dev/ssl-dev-unified.crt;
#ssl_certificate_key /etc/nginx/ssl/dev/ssl-dev.key;
server_name www.dev.magibooks.com;
root /var/www/www.dev.magibooks.com/web;
## rewrites dev.magibooks.com to www.dev.magibooks.com
#if ($http_host != "www.dev.magibooks.com") {
# rewrite ^ $scheme://www.dev.magibooks.com$request_uri permanent;
#}
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
#auth_basic "Restricted"; ## Message shown in login window
#auth_basic_user_file /var/www/www.dev.magibooks.com/.htpasswd;
#autoindex on;
}
location ~ /.(eot|otf|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
## These locations would be hidden by .htaccess normally
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file /var/www/www.dev.magibooks.com/.htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}
## Disable .htaccess and other hidden files
location ~ /. {
deny all;
access_log off;
log_not_found off;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
expires off; ## Do not cache dynamic content
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
}
nginx.conf
user www-data;
worker_processes 2;
pid /run/nginx.pid;
worker_rlimit_nofile 60000;
events {
worker_connections 10240;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 2;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
#gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
## Detect when HTTPS is used
map $scheme $fastcgi_https {
default off;
https on;
}
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 4 4k;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
I've tried the following
- +/- Cloudflare
- optimized php-fpm pm_* values
- optimized cache including opcache & memcached, these changes speed up on full page & doc load complete time, but no difference made on TTFB time
- +/- nginx logs
- adjust gzip level from 1-6
- CMS page loads a little bit faster, but still has TTFB 1.815s
- A phpinfo() page loads about 40ms
- By tailing the access.log, the request always show up after exact wait time, e.g. when I refresh dev.magibooks.com, it takes 4 seconds on server side to see request showing up on access.log
- I suspect something to do with too many products on homepage, especially configurable products, I removed 12 products, TTFB reduced from 5 seconds to 4 seconds, but still significant high
php slow page shows the following
[17-Sep-2014 21:48:45] [pool www] pid 10333
script_filename = /var/www/www.dev.magibooks.com/web/index.php
[0x00007fc13eb6f8d8] session_start() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:125
[0x00007fc13eb6f798] start() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:168
[0x00007fc13eb6f650] init() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract.php:84
[0x00007fc13eb6f558] init() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session.php:42
[0x00007fc13eb6f428] __construct() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Config.php:1348
[0x00007fc13eb6f310] getModelInstance() /var/www/www.dev.magibooks.com/web/app/Mage.php:463
[0x00007fc13eb6f1e0] getModel() /var/www/www.dev.magibooks.com/web/app/Mage.php:477
[0x00007fc13eb6f088] getSingleton() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Action.php:493
[0x00007fc13eb6ef00] preDispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Adminhtml/Controller/Action.php:160
[0x00007fc13eb6ed08] preDispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Action.php:407
[0x00007fc13eb6eaf8] dispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php:250
[0x00007fc13eb6e9a8] match() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Front.php:172
[0x00007fc13eb6e850] dispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/App.php:354
[0x00007fc13eb6e6b0] run() /var/www/www.dev.magibooks.com/web/app/Mage.php:684
[0x00007fc13eb6e570] run() /var/www/www.dev.magibooks.com/web/index.php:87 11. minified all js and css
nginx magento
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am having issue with high TTFB time, especially wait time after send.
Webpagetest shows the TTFB is almost 4 seconds.
Pingtom specifies the wait time is the bottleneck here
Here is my setup for Magento + Nginx server, see screenshots for test and configuration http://share.pho.to/#7BuP9
- OS: Ubuntu 14.04 server
- nginx/1.4.6
- PHP 5.5.9
- opcache 7.0.3
- memcached
- PHP-FPM
- Magento 1.9.0.1
- Linode 2GB /2Core Server
Nginx server config
server {
server_name dev.magibooks.com;
return 301 $scheme://www.dev.magibooks.com$request_uri;
}
server {
listen 80;
#listen 443 ssl spdy;
#ssl on;
#ssl_certificate /etc/nginx/ssl/dev/ssl-dev-unified.crt;
#ssl_certificate_key /etc/nginx/ssl/dev/ssl-dev.key;
server_name www.dev.magibooks.com;
root /var/www/www.dev.magibooks.com/web;
## rewrites dev.magibooks.com to www.dev.magibooks.com
#if ($http_host != "www.dev.magibooks.com") {
# rewrite ^ $scheme://www.dev.magibooks.com$request_uri permanent;
#}
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
#auth_basic "Restricted"; ## Message shown in login window
#auth_basic_user_file /var/www/www.dev.magibooks.com/.htpasswd;
#autoindex on;
}
location ~ /.(eot|otf|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
## These locations would be hidden by .htaccess normally
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file /var/www/www.dev.magibooks.com/.htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}
## Disable .htaccess and other hidden files
location ~ /. {
deny all;
access_log off;
log_not_found off;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
expires off; ## Do not cache dynamic content
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
}
nginx.conf
user www-data;
worker_processes 2;
pid /run/nginx.pid;
worker_rlimit_nofile 60000;
events {
worker_connections 10240;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 2;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
#gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
## Detect when HTTPS is used
map $scheme $fastcgi_https {
default off;
https on;
}
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 4 4k;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
I've tried the following
- +/- Cloudflare
- optimized php-fpm pm_* values
- optimized cache including opcache & memcached, these changes speed up on full page & doc load complete time, but no difference made on TTFB time
- +/- nginx logs
- adjust gzip level from 1-6
- CMS page loads a little bit faster, but still has TTFB 1.815s
- A phpinfo() page loads about 40ms
- By tailing the access.log, the request always show up after exact wait time, e.g. when I refresh dev.magibooks.com, it takes 4 seconds on server side to see request showing up on access.log
- I suspect something to do with too many products on homepage, especially configurable products, I removed 12 products, TTFB reduced from 5 seconds to 4 seconds, but still significant high
php slow page shows the following
[17-Sep-2014 21:48:45] [pool www] pid 10333
script_filename = /var/www/www.dev.magibooks.com/web/index.php
[0x00007fc13eb6f8d8] session_start() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:125
[0x00007fc13eb6f798] start() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:168
[0x00007fc13eb6f650] init() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract.php:84
[0x00007fc13eb6f558] init() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session.php:42
[0x00007fc13eb6f428] __construct() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Config.php:1348
[0x00007fc13eb6f310] getModelInstance() /var/www/www.dev.magibooks.com/web/app/Mage.php:463
[0x00007fc13eb6f1e0] getModel() /var/www/www.dev.magibooks.com/web/app/Mage.php:477
[0x00007fc13eb6f088] getSingleton() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Action.php:493
[0x00007fc13eb6ef00] preDispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Adminhtml/Controller/Action.php:160
[0x00007fc13eb6ed08] preDispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Action.php:407
[0x00007fc13eb6eaf8] dispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php:250
[0x00007fc13eb6e9a8] match() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Front.php:172
[0x00007fc13eb6e850] dispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/App.php:354
[0x00007fc13eb6e6b0] run() /var/www/www.dev.magibooks.com/web/app/Mage.php:684
[0x00007fc13eb6e570] run() /var/www/www.dev.magibooks.com/web/index.php:87 11. minified all js and css
nginx magento
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
3
Welcome to Magento.
– Michael Hampton♦
Sep 18 '14 at 2:31
Same template hosted on joomlart has pretty good page response time e.g. link has only 91ms wait time link with a lot of more content than my store, this makes me wondering if I have something configured incorrectly.
– Tom
Sep 18 '14 at 2:36
I agree with Michael.. Magento is horrible but make sure all the caching is enabled in magento also.
– Mike
Sep 18 '14 at 6:36
1
There's nothing at all wrong with Magento. It can and will deliver 0.2s TTFB on a properly configured server. Running Magento in an improperly configured server is like moaning that a Ferrari has a poor 0-60 time when you fill the fuel tank with soil. Caching is categorically not necessary and has absolutely nothing to do with performance. The OP just needs a proper hosting provider instead of DIY and needs to profile his code thereafter.
– Ben Lessani - Sonassi
Sep 30 '15 at 17:22
add a comment |
I am having issue with high TTFB time, especially wait time after send.
Webpagetest shows the TTFB is almost 4 seconds.
Pingtom specifies the wait time is the bottleneck here
Here is my setup for Magento + Nginx server, see screenshots for test and configuration http://share.pho.to/#7BuP9
- OS: Ubuntu 14.04 server
- nginx/1.4.6
- PHP 5.5.9
- opcache 7.0.3
- memcached
- PHP-FPM
- Magento 1.9.0.1
- Linode 2GB /2Core Server
Nginx server config
server {
server_name dev.magibooks.com;
return 301 $scheme://www.dev.magibooks.com$request_uri;
}
server {
listen 80;
#listen 443 ssl spdy;
#ssl on;
#ssl_certificate /etc/nginx/ssl/dev/ssl-dev-unified.crt;
#ssl_certificate_key /etc/nginx/ssl/dev/ssl-dev.key;
server_name www.dev.magibooks.com;
root /var/www/www.dev.magibooks.com/web;
## rewrites dev.magibooks.com to www.dev.magibooks.com
#if ($http_host != "www.dev.magibooks.com") {
# rewrite ^ $scheme://www.dev.magibooks.com$request_uri permanent;
#}
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
#auth_basic "Restricted"; ## Message shown in login window
#auth_basic_user_file /var/www/www.dev.magibooks.com/.htpasswd;
#autoindex on;
}
location ~ /.(eot|otf|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
## These locations would be hidden by .htaccess normally
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file /var/www/www.dev.magibooks.com/.htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}
## Disable .htaccess and other hidden files
location ~ /. {
deny all;
access_log off;
log_not_found off;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
expires off; ## Do not cache dynamic content
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
}
nginx.conf
user www-data;
worker_processes 2;
pid /run/nginx.pid;
worker_rlimit_nofile 60000;
events {
worker_connections 10240;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 2;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
#gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
## Detect when HTTPS is used
map $scheme $fastcgi_https {
default off;
https on;
}
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 4 4k;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
I've tried the following
- +/- Cloudflare
- optimized php-fpm pm_* values
- optimized cache including opcache & memcached, these changes speed up on full page & doc load complete time, but no difference made on TTFB time
- +/- nginx logs
- adjust gzip level from 1-6
- CMS page loads a little bit faster, but still has TTFB 1.815s
- A phpinfo() page loads about 40ms
- By tailing the access.log, the request always show up after exact wait time, e.g. when I refresh dev.magibooks.com, it takes 4 seconds on server side to see request showing up on access.log
- I suspect something to do with too many products on homepage, especially configurable products, I removed 12 products, TTFB reduced from 5 seconds to 4 seconds, but still significant high
php slow page shows the following
[17-Sep-2014 21:48:45] [pool www] pid 10333
script_filename = /var/www/www.dev.magibooks.com/web/index.php
[0x00007fc13eb6f8d8] session_start() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:125
[0x00007fc13eb6f798] start() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:168
[0x00007fc13eb6f650] init() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract.php:84
[0x00007fc13eb6f558] init() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session.php:42
[0x00007fc13eb6f428] __construct() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Config.php:1348
[0x00007fc13eb6f310] getModelInstance() /var/www/www.dev.magibooks.com/web/app/Mage.php:463
[0x00007fc13eb6f1e0] getModel() /var/www/www.dev.magibooks.com/web/app/Mage.php:477
[0x00007fc13eb6f088] getSingleton() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Action.php:493
[0x00007fc13eb6ef00] preDispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Adminhtml/Controller/Action.php:160
[0x00007fc13eb6ed08] preDispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Action.php:407
[0x00007fc13eb6eaf8] dispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php:250
[0x00007fc13eb6e9a8] match() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Front.php:172
[0x00007fc13eb6e850] dispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/App.php:354
[0x00007fc13eb6e6b0] run() /var/www/www.dev.magibooks.com/web/app/Mage.php:684
[0x00007fc13eb6e570] run() /var/www/www.dev.magibooks.com/web/index.php:87 11. minified all js and css
nginx magento
I am having issue with high TTFB time, especially wait time after send.
Webpagetest shows the TTFB is almost 4 seconds.
Pingtom specifies the wait time is the bottleneck here
Here is my setup for Magento + Nginx server, see screenshots for test and configuration http://share.pho.to/#7BuP9
- OS: Ubuntu 14.04 server
- nginx/1.4.6
- PHP 5.5.9
- opcache 7.0.3
- memcached
- PHP-FPM
- Magento 1.9.0.1
- Linode 2GB /2Core Server
Nginx server config
server {
server_name dev.magibooks.com;
return 301 $scheme://www.dev.magibooks.com$request_uri;
}
server {
listen 80;
#listen 443 ssl spdy;
#ssl on;
#ssl_certificate /etc/nginx/ssl/dev/ssl-dev-unified.crt;
#ssl_certificate_key /etc/nginx/ssl/dev/ssl-dev.key;
server_name www.dev.magibooks.com;
root /var/www/www.dev.magibooks.com/web;
## rewrites dev.magibooks.com to www.dev.magibooks.com
#if ($http_host != "www.dev.magibooks.com") {
# rewrite ^ $scheme://www.dev.magibooks.com$request_uri permanent;
#}
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
#auth_basic "Restricted"; ## Message shown in login window
#auth_basic_user_file /var/www/www.dev.magibooks.com/.htpasswd;
#autoindex on;
}
location ~ /.(eot|otf|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
## These locations would be hidden by .htaccess normally
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file /var/www/www.dev.magibooks.com/.htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}
## Disable .htaccess and other hidden files
location ~ /. {
deny all;
access_log off;
log_not_found off;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
expires off; ## Do not cache dynamic content
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
}
nginx.conf
user www-data;
worker_processes 2;
pid /run/nginx.pid;
worker_rlimit_nofile 60000;
events {
worker_connections 10240;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 2;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
#gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
## Detect when HTTPS is used
map $scheme $fastcgi_https {
default off;
https on;
}
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 4 4k;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
I've tried the following
- +/- Cloudflare
- optimized php-fpm pm_* values
- optimized cache including opcache & memcached, these changes speed up on full page & doc load complete time, but no difference made on TTFB time
- +/- nginx logs
- adjust gzip level from 1-6
- CMS page loads a little bit faster, but still has TTFB 1.815s
- A phpinfo() page loads about 40ms
- By tailing the access.log, the request always show up after exact wait time, e.g. when I refresh dev.magibooks.com, it takes 4 seconds on server side to see request showing up on access.log
- I suspect something to do with too many products on homepage, especially configurable products, I removed 12 products, TTFB reduced from 5 seconds to 4 seconds, but still significant high
php slow page shows the following
[17-Sep-2014 21:48:45] [pool www] pid 10333
script_filename = /var/www/www.dev.magibooks.com/web/index.php
[0x00007fc13eb6f8d8] session_start() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:125
[0x00007fc13eb6f798] start() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:168
[0x00007fc13eb6f650] init() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session/Abstract.php:84
[0x00007fc13eb6f558] init() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Session.php:42
[0x00007fc13eb6f428] __construct() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/Config.php:1348
[0x00007fc13eb6f310] getModelInstance() /var/www/www.dev.magibooks.com/web/app/Mage.php:463
[0x00007fc13eb6f1e0] getModel() /var/www/www.dev.magibooks.com/web/app/Mage.php:477
[0x00007fc13eb6f088] getSingleton() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Action.php:493
[0x00007fc13eb6ef00] preDispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Adminhtml/Controller/Action.php:160
[0x00007fc13eb6ed08] preDispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Action.php:407
[0x00007fc13eb6eaf8] dispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php:250
[0x00007fc13eb6e9a8] match() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Controller/Varien/Front.php:172
[0x00007fc13eb6e850] dispatch() /var/www/www.dev.magibooks.com/web/app/code/core/Mage/Core/Model/App.php:354
[0x00007fc13eb6e6b0] run() /var/www/www.dev.magibooks.com/web/app/Mage.php:684
[0x00007fc13eb6e570] run() /var/www/www.dev.magibooks.com/web/index.php:87 11. minified all js and css
nginx magento
nginx magento
edited Nov 3 '15 at 8:14
huzefam
1072
1072
asked Sep 18 '14 at 2:30
TomTom
613
613
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
3
Welcome to Magento.
– Michael Hampton♦
Sep 18 '14 at 2:31
Same template hosted on joomlart has pretty good page response time e.g. link has only 91ms wait time link with a lot of more content than my store, this makes me wondering if I have something configured incorrectly.
– Tom
Sep 18 '14 at 2:36
I agree with Michael.. Magento is horrible but make sure all the caching is enabled in magento also.
– Mike
Sep 18 '14 at 6:36
1
There's nothing at all wrong with Magento. It can and will deliver 0.2s TTFB on a properly configured server. Running Magento in an improperly configured server is like moaning that a Ferrari has a poor 0-60 time when you fill the fuel tank with soil. Caching is categorically not necessary and has absolutely nothing to do with performance. The OP just needs a proper hosting provider instead of DIY and needs to profile his code thereafter.
– Ben Lessani - Sonassi
Sep 30 '15 at 17:22
add a comment |
3
Welcome to Magento.
– Michael Hampton♦
Sep 18 '14 at 2:31
Same template hosted on joomlart has pretty good page response time e.g. link has only 91ms wait time link with a lot of more content than my store, this makes me wondering if I have something configured incorrectly.
– Tom
Sep 18 '14 at 2:36
I agree with Michael.. Magento is horrible but make sure all the caching is enabled in magento also.
– Mike
Sep 18 '14 at 6:36
1
There's nothing at all wrong with Magento. It can and will deliver 0.2s TTFB on a properly configured server. Running Magento in an improperly configured server is like moaning that a Ferrari has a poor 0-60 time when you fill the fuel tank with soil. Caching is categorically not necessary and has absolutely nothing to do with performance. The OP just needs a proper hosting provider instead of DIY and needs to profile his code thereafter.
– Ben Lessani - Sonassi
Sep 30 '15 at 17:22
3
3
Welcome to Magento.
– Michael Hampton♦
Sep 18 '14 at 2:31
Welcome to Magento.
– Michael Hampton♦
Sep 18 '14 at 2:31
Same template hosted on joomlart has pretty good page response time e.g. link has only 91ms wait time link with a lot of more content than my store, this makes me wondering if I have something configured incorrectly.
– Tom
Sep 18 '14 at 2:36
Same template hosted on joomlart has pretty good page response time e.g. link has only 91ms wait time link with a lot of more content than my store, this makes me wondering if I have something configured incorrectly.
– Tom
Sep 18 '14 at 2:36
I agree with Michael.. Magento is horrible but make sure all the caching is enabled in magento also.
– Mike
Sep 18 '14 at 6:36
I agree with Michael.. Magento is horrible but make sure all the caching is enabled in magento also.
– Mike
Sep 18 '14 at 6:36
1
1
There's nothing at all wrong with Magento. It can and will deliver 0.2s TTFB on a properly configured server. Running Magento in an improperly configured server is like moaning that a Ferrari has a poor 0-60 time when you fill the fuel tank with soil. Caching is categorically not necessary and has absolutely nothing to do with performance. The OP just needs a proper hosting provider instead of DIY and needs to profile his code thereafter.
– Ben Lessani - Sonassi
Sep 30 '15 at 17:22
There's nothing at all wrong with Magento. It can and will deliver 0.2s TTFB on a properly configured server. Running Magento in an improperly configured server is like moaning that a Ferrari has a poor 0-60 time when you fill the fuel tank with soil. Caching is categorically not necessary and has absolutely nothing to do with performance. The OP just needs a proper hosting provider instead of DIY and needs to profile his code thereafter.
– Ben Lessani - Sonassi
Sep 30 '15 at 17:22
add a comment |
2 Answers
2
active
oldest
votes
I've done the following to successfully reduced page load time from 6sec to 1sec by
- disable newrelic
- disable longview
To be done
1. I am in process of upgrading to 4core 4GB memory system, I will post the result here
2. I am going to consult a full page cache solution.
add a comment |
Magento is exceptionally fast as standard, it will load pages in 0.5s with all caches off and 0.2s with all caches on.
So you don't need strictly to make make Magento faster, you need to remove/change whatever is making it slow.
There's 2 bottlenecks for performance.
- Poor hosting
- Poor code
Addressing those is superbly simple,
- Use a hosting provider that specialises in high performance Magento hosting that can provide store-level support to help you scale and guide you on performance improvement
- Profile your code, and remove/re-factor poorly performing code
You'll know if your hosting provider is your bottleneck simply by installing a demo store with sample data. If it takes more than 0.5s to load with all the caches off, then there's your issue.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f629380%2fhigh-wait-time-from-time-to-first-byte-with-magento-nginx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I've done the following to successfully reduced page load time from 6sec to 1sec by
- disable newrelic
- disable longview
To be done
1. I am in process of upgrading to 4core 4GB memory system, I will post the result here
2. I am going to consult a full page cache solution.
add a comment |
I've done the following to successfully reduced page load time from 6sec to 1sec by
- disable newrelic
- disable longview
To be done
1. I am in process of upgrading to 4core 4GB memory system, I will post the result here
2. I am going to consult a full page cache solution.
add a comment |
I've done the following to successfully reduced page load time from 6sec to 1sec by
- disable newrelic
- disable longview
To be done
1. I am in process of upgrading to 4core 4GB memory system, I will post the result here
2. I am going to consult a full page cache solution.
I've done the following to successfully reduced page load time from 6sec to 1sec by
- disable newrelic
- disable longview
To be done
1. I am in process of upgrading to 4core 4GB memory system, I will post the result here
2. I am going to consult a full page cache solution.
answered Sep 19 '14 at 20:08
TomTom
613
613
add a comment |
add a comment |
Magento is exceptionally fast as standard, it will load pages in 0.5s with all caches off and 0.2s with all caches on.
So you don't need strictly to make make Magento faster, you need to remove/change whatever is making it slow.
There's 2 bottlenecks for performance.
- Poor hosting
- Poor code
Addressing those is superbly simple,
- Use a hosting provider that specialises in high performance Magento hosting that can provide store-level support to help you scale and guide you on performance improvement
- Profile your code, and remove/re-factor poorly performing code
You'll know if your hosting provider is your bottleneck simply by installing a demo store with sample data. If it takes more than 0.5s to load with all the caches off, then there's your issue.
add a comment |
Magento is exceptionally fast as standard, it will load pages in 0.5s with all caches off and 0.2s with all caches on.
So you don't need strictly to make make Magento faster, you need to remove/change whatever is making it slow.
There's 2 bottlenecks for performance.
- Poor hosting
- Poor code
Addressing those is superbly simple,
- Use a hosting provider that specialises in high performance Magento hosting that can provide store-level support to help you scale and guide you on performance improvement
- Profile your code, and remove/re-factor poorly performing code
You'll know if your hosting provider is your bottleneck simply by installing a demo store with sample data. If it takes more than 0.5s to load with all the caches off, then there's your issue.
add a comment |
Magento is exceptionally fast as standard, it will load pages in 0.5s with all caches off and 0.2s with all caches on.
So you don't need strictly to make make Magento faster, you need to remove/change whatever is making it slow.
There's 2 bottlenecks for performance.
- Poor hosting
- Poor code
Addressing those is superbly simple,
- Use a hosting provider that specialises in high performance Magento hosting that can provide store-level support to help you scale and guide you on performance improvement
- Profile your code, and remove/re-factor poorly performing code
You'll know if your hosting provider is your bottleneck simply by installing a demo store with sample data. If it takes more than 0.5s to load with all the caches off, then there's your issue.
Magento is exceptionally fast as standard, it will load pages in 0.5s with all caches off and 0.2s with all caches on.
So you don't need strictly to make make Magento faster, you need to remove/change whatever is making it slow.
There's 2 bottlenecks for performance.
- Poor hosting
- Poor code
Addressing those is superbly simple,
- Use a hosting provider that specialises in high performance Magento hosting that can provide store-level support to help you scale and guide you on performance improvement
- Profile your code, and remove/re-factor poorly performing code
You'll know if your hosting provider is your bottleneck simply by installing a demo store with sample data. If it takes more than 0.5s to load with all the caches off, then there's your issue.
answered Sep 30 '15 at 17:24
Ben Lessani - SonassiBen Lessani - Sonassi
4,8601135
4,8601135
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f629380%2fhigh-wait-time-from-time-to-first-byte-with-magento-nginx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Welcome to Magento.
– Michael Hampton♦
Sep 18 '14 at 2:31
Same template hosted on joomlart has pretty good page response time e.g. link has only 91ms wait time link with a lot of more content than my store, this makes me wondering if I have something configured incorrectly.
– Tom
Sep 18 '14 at 2:36
I agree with Michael.. Magento is horrible but make sure all the caching is enabled in magento also.
– Mike
Sep 18 '14 at 6:36
1
There's nothing at all wrong with Magento. It can and will deliver 0.2s TTFB on a properly configured server. Running Magento in an improperly configured server is like moaning that a Ferrari has a poor 0-60 time when you fill the fuel tank with soil. Caching is categorically not necessary and has absolutely nothing to do with performance. The OP just needs a proper hosting provider instead of DIY and needs to profile his code thereafter.
– Ben Lessani - Sonassi
Sep 30 '15 at 17:22