Jacob
2006-11-15, 02:30 PM
Also available on the Wiki....Thanks Clint
http://www.sugarcrm.com/wiki/index.php?title=Performance_Tuning_for_HTTPS
Q: Why does loading images take so long over HTTPS?
A: HTTPS is an encrypted connection. Setting up the connection requires multiple round trips between the web server and the browser.
Q: Can we load images through HTTP instead of https when the connection is HTTPS?
A: We cannot use HTTP for images (to answer your earlier question) becuase the end user will get a security warning saying they are being redirected to a non-secure site.
Q: Why is the system slow the first few times that I click through the application?
A: The reason that the initial pages loads are slow is because the system is loading and caching all kinds of things (mostly images and javascript).
I see the browser requesting hundreds of things every day when I first use the application, is there any way to prevent this?
Depending on how long it has been since you have used the images for any given application or website, the browser will check to see if the images have been modified. Explicitly using the webserver to tell the browser how long an image should be cached can greatly increase the time between checks. For Apache, mod_expires and appropriate rules can quickly tell the system to cache *.png, *.jpg for a week.
Possible remedies for slow images:
* Use Server side cache settings to decrease the frequency of checks to see if the images has been modified.
* Connect over HTTP for the first time.
* Create a page that loads all of the images at once, to just get it out of the way. It should load the generic images and all of the theme specific images (for at least the theme being used). We could create a page that says "Loading Cache..." and gives an incremental progress bar of image downloads.
The section below explains mod_deflate and mod_expires. This was copied from a post by:
stevec
http://www.sugarcrm.com/forums/showthread.php?t=8189
Jacob
Some other things to try....
The compression by enabling zlib compression in php.ini is for php code only, you can also enable compression of everything. For apache, install the mod_deflate module:
http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
Also a big help is getting the browser to cache as much as possible (though this will mean users will need to refresh/clear the cache if you edit code or upgrade). This is really useful as a good part of the download for each page is identical javascript. For apache, install the mod_expires modules:
http://httpd.apache.org/docs/2.0/mod/mod_expires.html
and set the config appropriately:
EG. for apache2, modify the site config file in a manner similar to:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript application/x-javascript text/css
ExpiresByType text/html "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType application/x-javascript "access plus 7 days"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
</Directory>
Don't forget to restart apache
http://www.sugarcrm.com/wiki/index.php?title=Performance_Tuning_for_HTTPS
Q: Why does loading images take so long over HTTPS?
A: HTTPS is an encrypted connection. Setting up the connection requires multiple round trips between the web server and the browser.
Q: Can we load images through HTTP instead of https when the connection is HTTPS?
A: We cannot use HTTP for images (to answer your earlier question) becuase the end user will get a security warning saying they are being redirected to a non-secure site.
Q: Why is the system slow the first few times that I click through the application?
A: The reason that the initial pages loads are slow is because the system is loading and caching all kinds of things (mostly images and javascript).
I see the browser requesting hundreds of things every day when I first use the application, is there any way to prevent this?
Depending on how long it has been since you have used the images for any given application or website, the browser will check to see if the images have been modified. Explicitly using the webserver to tell the browser how long an image should be cached can greatly increase the time between checks. For Apache, mod_expires and appropriate rules can quickly tell the system to cache *.png, *.jpg for a week.
Possible remedies for slow images:
* Use Server side cache settings to decrease the frequency of checks to see if the images has been modified.
* Connect over HTTP for the first time.
* Create a page that loads all of the images at once, to just get it out of the way. It should load the generic images and all of the theme specific images (for at least the theme being used). We could create a page that says "Loading Cache..." and gives an incremental progress bar of image downloads.
The section below explains mod_deflate and mod_expires. This was copied from a post by:
stevec
http://www.sugarcrm.com/forums/showthread.php?t=8189
Jacob
Some other things to try....
The compression by enabling zlib compression in php.ini is for php code only, you can also enable compression of everything. For apache, install the mod_deflate module:
http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
Also a big help is getting the browser to cache as much as possible (though this will mean users will need to refresh/clear the cache if you edit code or upgrade). This is really useful as a good part of the download for each page is identical javascript. For apache, install the mod_expires modules:
http://httpd.apache.org/docs/2.0/mod/mod_expires.html
and set the config appropriately:
EG. for apache2, modify the site config file in a manner similar to:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript application/x-javascript text/css
ExpiresByType text/html "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType application/x-javascript "access plus 7 days"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
</Directory>
Don't forget to restart apache