We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Useful minify app for mac: http://smallerapp.com
      Sterc Internet & Marketing | MODX Founding Partner | Chairman of the MODX Advisory Board

      In need of a MODX consult? Try our MODX Developers Experts!
    • Quote from: manfred62 at Nov 18, 2012, 09:48 AM

      nice online solution with very good compression: http://tinypng.org/
      Great! Thank you - this will be very helpful to me right now smiley
      • I would be careful with phpthumbof as the more work you have it do the more intensive it can be on the server (which slows things down). That's not to say it's a bad thing just be careful when using it.

        Compression Continued

        On the other hand you can also reduce filesizes using GZIP for faster transfer:

        <ifmodule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
        </ifmodule>


        If you have locally hosted webfonts you could do (webfonts only):

        <ifmodule mod_deflate.c>
        <ifmodule mod_mime.c>   #Checks if your server supports Addtype
        Addtype font/opentype .otf
        Addtype font/eot .eot
        Addtype font/truetype .ttf
        </ifmodule>
        AddOutputFilterByType DEFLATE font/opentype font/truetype font/eot
        </ifmodule>
        


        Putting it all together you can use it on everything:

        <ifmodule mod_deflate.c>
        <ifmodule mod_mime.c>   #Checks if your server supports Addtype
        Addtype font/opentype .otf
        Addtype font/eot .eot
        Addtype font/truetype .ttf
        </ifmodule>
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript application/javascript text/text font/opentype font/truetype font/eot
        </ifmodule>
        


        Additionally you can include images to save even more, however the server will take more of a hit generating the compressed files.

        Offloading Common Files

        Another secret to speeding your website is using JS CDN Libraries, such as the popular Google Hosted Libraries (https://developers.google.com/speed/libraries/). The slightly less common library, but actually faster (in my limited testing) is the one run by CloudFlare (http://cdnjs.com/) and this one has the added benefit of including more files! So you can offload more than just jQuery and such. Heck they even have some of the common css libraries (960gs or 1140 anyone?)

        Avoid Blocking

        If you have a lot of resources on your site (css, js, img, etc) you will also run into a blocking issue. Basically you need to wait for other resources to download before downloading even more resources. You can counter this issue by using alternative addresses, and stagger their usage.

        You could setup four subdomains (static, img1, img2, img3) all pointed to the assets folder. Once setup you would use ___.domain.com/images/____ or ___.domain.com/template/default/____ addresses (substituting your subdomain and the required file.

        This allows your browser to download more files at the same time for a faster overall load time. Granted this does have it's downsides in that you are increasing http requests which does slow your load time some, so there are trade offs using this method.
          Patrick | Server Wrangler
          About Me: Website | TweetsMODX Hosting
        • Quote from: gallenkamp at Nov 12, 2012, 06:52 AM
          Dear MODX people,

          in the past days, I've struggled with a new site of mine. Revo 2.2.4, successfully upgraded to 2.2.5 now. I ran some test to look for hints, to make it faster, as it was slow as hell. Well - it's still not fast, but I managed to decrease the pageload time from about 10 seconds in the beginning to under 3 seconds now - with the same content.

          Guido

          I create this tips and trick "Improve Static Files Performance when Friendly URL Enabled (.htaccess)" : http://forums.modx.com/thread/80511/improve-static-files-performance-when-friendly-url-enabled-htaccess

          Hope improve your page load.

          Cheers,
            zaenal.lokamaya
          • I'm usually combined the 3th and 4th solution of "Improve Static Files Performance when Friendly URL Enabled (.htaccess)".

            As for the 4th solution, serving static file from other domain/subdomain, here the working process:


            • Install MODx as usual at www.mydomain.com
            • Create another subdomain: static.mydomain.com
            • Create symlink of assets, images, themes (and other static folder) from www.mydomain.com to subdomain static.mydomain.com
            • Edit the template and make all static files pointed to static.mydomain.com
            • If you want to make all media automagically pointed to static.mydomain.com (for example when inserting images on resource), you should modify Media Source.
              Go to "Tools" > "Media Source". Here we can modify the default media source or create a new one. Then set baseUrl to new subdomain http://static.mydomain.com/assets/resources/ and set baseUrlRelative to NO.

            Cheers
              zaenal.lokamaya
            • from two weeks i use xfpc and my site really work fast! BUT i get this error in log:

              [2013-01-03 19:18:34] (ERROR @ /index.php) [OnWebPageComplete]

              <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/user/public_html/core/model/modx/modresponse.class.php:189) in <b>/home/user/public_html/core/cache/includes/elements/modplugin/16.include.cache.php</b> on line <b>106</b>

              do you have some ideas?
                palma non sine pulvere
              • Hm... what is your plugin with the id 16?
                  • 3749
                  • 24,544 Posts
                  That can usually be fixed by finding places where the plugin calls exit() or die() and adding the following line just above each call:

                  session_write_close();
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                  • Quote from: gallenkamp at Jan 06, 2013, 05:26 AM
                    Hm... what is your plugin with the id 16?

                    with id 16 is xFPC



                    Quote from: BobRay at Jan 07, 2013, 06:30 AM
                    That can usually be fixed by finding places where the plugin calls exit() or die() and adding the following line just above each call:

                    session_write_close();

                    i get more same errors in the log when add session_write_close(); after exit(); or die();

                    [2013-01-10 21:12:37] (ERROR @ /index.php) [OnWebPageComplete]

                    <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/user/public_html/core/model/modx/modresponse.class.php:189) in <b>/home/user/public_html/core/cache/includes/elements/modplugin/16.include.cache.php</b> on line <b>106</b>


                    [2013-01-10 21:12:42] (ERROR @ /index.php) [OnWebPageComplete]

                    <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/user/public_html/core/model/modx/modresponse.class.php:189) in <b>/home/user/public_html/core/cache/includes/elements/modplugin/16.include.cache.php</b> on line <b>106</b>


                    [2013-01-10 21:13:05] (ERROR @ /index.php) [OnWebPageComplete]

                    <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/user/public_html/core/model/modx/modresponse.class.php:189) in <b>/home/user/public_html/core/cache/includes/elements/modplugin/16.include.cache.php</b> on line <b>106</b>


                    [2013-01-10 21:13:07] (ERROR @ /index.php) [OnWebPageComplete]

                    <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/user/public_html/core/model/modx/modresponse.class.php:189) in <b>/home/user/public_html/core/cache/includes/elements/modplugin/16.include.cache.php</b> on line <b>106</b>


                      palma non sine pulvere
                      • 3749
                      • 24,544 Posts
                      The session_write_close() has to be called *before* the die() or exit().
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting