cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Decrease Combined JS file downnload time

hails.alex91@gm
7-Bedrock

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?

11 REPLIES 11

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

jsaragazki
1-Visitor
(To:paic)

Hi,

i have the same issue. The performance ist really bad. We have a couple of customized widgets in our application and the filesize of js and css grows.
Is it possible minify the files? Some other performance tipps?

Best regards

Well, dividing the js/css in multiple files will end up on a worst performance, it's better to download one big file than a lot of small ones.

I don't know, but maybe the server doesn't has compact files enabled, as HTTP servers can serve pages compacted ( zip ) then transfer will be faster.

Carles.

Hi Carles,

if i do understand that right there is always a big combined js/css file with code from all widgets regardless of the widget is used on this page or not. So if you have 20 customized widgets, you will always download this big file on every page. Ok, next time it will be cached.

Performance is not equal to download time. The size of css and js is crucial for rendering performance.

Correct me if i'm wrong.

Hi Juri,

In that part I don't have much expertise now, sorry I can't say more ( my last big development in js was on 1999/2000... ).

Carles.

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.

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.

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.

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

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.

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.

Announcements


Top Tags