Optimize Sitecore Media Library and Improve performance

Often i get a question asking How do we optimize the Sitecore media library Items and improve the performance of the website. Follow the simple checklist and ensure it is applied to all the media items.

Optimize Sitecore Media Library and Improve performance

  1. Ensure the cache size is sufficient, else there will be a performance hit on the site. Make sure you have specified proper prefetch cache size.(data/item/prefetch).
  2. Optimize all the images using TinyPng. This will reduce the image size and helps the site to load faster.
  3. Crop the images in proper dimensions and optimize it.
  4. Make sure the media library structure is well architected. This helps in reducing the clutter and improves the accessibility.
  5. Leverage CDN like cloudflare, AKAMAI etc in order to reduce the server load.
  6. Enable output caching in the code. This reduces fetching the resource file each and every time from server.
  7. Change Media link prefix from ~/media to -/media.

By default media link prefix is tilde(~) sign, since we are using windows server there might be an issue with the permission on the resource files. Hence change it to underscore( _ ) or hyphen (-) in the web.config file as shown below.

set the value of the “Media.MediaLinkPrefix” to alternative prefix: >

<setting name="Media.MediaLinkPrefix" value="-/media" /> 

add the following line to the customHandlers section, don’t remove the existing one mapped to “~/media”:

<customHandlers> 
  <handler trigger="-/media/" handler="sitecoremedia.ashx" /> 
  <handler trigger="~/media/" handler="sitecoremedia.ashx" />
  …
  </customHandlers>

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Sign Up for Our Newsletters

Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.

You May Also Like