Using the default media link prefix ("~/media") that contains a tilde character (~) may lead to the performance degradation when the Sitecore website is experiencing high load.
The issue may be caused by the tilde character in the URL that may cause unnecessary delays at the Windows Kernel level in the time it takes to process the web request.
More specifically, before such a request reaches Sitecore application, it is processed by IIS which performs ACL check on the file system. If the path in the URL contains the tilde, these ACL checks are more expensive that usual ones and may become a performance bottleneck for the server.
Change the media prefix to use dash instead of tilde to optimize performance:
<setting name="Media.MediaLinkPrefix" value="-/media" />
<customHandlers> <handler trigger="-/media/" handler="sitecore_media.ashx" /> <handler trigger="~/media/" handler="sitecore_media.ashx" /> … </customHandlers>