11 Replies Latest reply on Oct 7, 2016 8:26 AM by rpallares RSS
    hails.alex91@gmail.com Explorer

    Decrease Combined JS file downnload time

    Hello again everyone ,

     

    I have done some debugging on my PC, and it looks like the Combined.6.0.3-b21.20150715.js file is taking ~20 seconds to download upon initial load. I know that this is more of a platform architecture question, but is it possible to break this file apart and have multiple calls made in parallel to increase performance?

     

    Has anyone had this experience and managed to increase the performance?

      • Re: Decrease Combined JS file downnload time
        paic Collaborator

        This is an item that development is actually looking at to improve.

        • Re: Decrease Combined JS file downnload time
          davem Explorer

          Combining Javascript and CSS is standard practice to improve initial download performance. The time cost of separate requests is well beyond any benefit of parallelism or "lazy loading" strategies. Browser thread limits and blocking dependencies make sep. requests even worse. Compression on combined files make it even better.

           

          The application is the sum of its parts including all widgets, styles, extensions.

           

          You can avoid making more demands on throughput by avoiding individual widget custom styles, especially when used in repeaters. That is one time where things are downloaded as needed, because it applies to individual elements.

           

          @Juri : app is a one time download per browser until you clear cache.

            • Re: Decrease Combined JS file downnload time
              jsaragazki Explorer

              Yeah, download time is one thing, performance specialy rendering performance an another. ThingWorx is not a SPA or am i wrong? Then why do i have to handle (and also download) stuff i dont need on one site?

               

              Are there any tutorials or documents how i can optimize the performance? My aim is to get under 1 second and i'm far away from that. For example i would like to minify my sources at first.

            • Re: Decrease Combined JS file downnload time
              carlesc Ninja

              Hi Juri, what's SPA?

               

              1 second when? first load? you won't get there with Standard TW Mashups, if you need this, you will have to work with TW REST API and build your own Web Interface.

               

              Carles.

              • Re: Decrease Combined JS file downnload time
                davem Explorer

                I agree with Carles- Use the Thingworx API to create a special-purpose SPA (Single Page App) if you have such a performance requirement.

                • Re: Decrease Combined JS file downnload time
                  thearonh Apprentice

                  Depending on server application you are using, there are mechanisms to compress files at the server level. This doesn't help developers who need the uncompressed versions to look at code, but in production environments, it makes a huge difference.

                  In Tomcat, this is pretty easy - here is a simple example: How to Compress HTTP responses at the Tomcat level | Jaspersoft Community

                   

                  Also, when it comes to Widget Extensions, the JS and CSS files get copied directly from the contributing files into the combined files. So, if you are writing the widget, I would encourage doing a minify of the JS and CSS code to help the overall size. Also, If you see specific areas in the combined js and css files that is large and being contributed from other widgets, I would encourage you to get in contact with the extension Author and let them know that is something they could do as an improvement, which would help the community out in general.

                   

                  These are kind of generic suggestions, and are more of a workaround for the problem, but they can make some immediate difference if you are having problems now while Thingworx development works on making this better for the future.

                  • Re: Decrease Combined JS file downnload time
                    rpallares Explorer

                    Hi,

                     

                    Is it possible to activate cache for this Combined file?

                    When I trace the request from my navigator, I see that two HTTP Headers are sent to disable caching:

                    • Pragma: "no-cache"
                    • Cache-Control: "no-cache"

                     

                    In debug mode, It have sense to disable some caching feature, but most of time it cause the very poor performances.

                    In production mode, at least CSS, JS and resources resources (png, jpg, gif) should be cached.