Tip: Make web applications work a lot faster with an easy configuration tweak

Tip: Make web applications work a lot faster with an easy configuration tweak

Web applications will work a lot faster if static files take advantage of caching in browsers and proxies. To allow static files to be cacheable without the headaches of inconsistencies, the Agile Platform can create static files references (js, css, images) in the generated HTML with a cache invalidation suffix. To see if this is set in your environment just view the source of any page and check if the css and javascript url's in the header of the page end with a ? and some numbers:

(This option is turned on by default in new installations, but to avoid any compability issue it was left off for versions where the first install was before If that is your case and you wish to turn it on please contact OutSystems Technical Support.)
If your pages have invalidation suffixes then you can safely make these static files cacheable. To do this just configure IIS to add an expires header (a minimum of one month is recommended):
(Don't worry, these headers will only apply to static files)
This will make your web servers have less requests and your users see the pages a lot faster, since browsers will cache these files correctly. 
You can check the performance gains by timing the page load time after a browser restart with Firebug Net Panel before and after this change. I bet you will be surprised. Try it out and let me know your results.
Bonus tip: The above procedure is even more useful if you are able to use a reverse proxy like Akamai or EdgeCast.

To test the improved performance with firebug you should not use the refresh button on your browser (this will instruct the browser to get the contents anyway) but instead navigate to the URLs normally, as your users would, by typing them in the address bar and pressing enter or by following links.
Here are some cool tools to help out the developer in optimizing code:

Javascript minimizer : http://closure-compiler.appspot.com/home  (They also have an ant add-on that will minify all your javascript automatically when compiling java)
Image Sprites : (Wizard) http://spritegen.website-performance.org/
Hi Tiago,

In my current case, I already see 304 Not Modified responses in Firebug, so these server requests are super-fast. Is there still any advantage to set up the Expires header? 

Hi Pedro,

Sure. Your browser needed to make those calls, even if they were just to be told that the content was not modified.
If these files had an expires header those calls would not be needed in the first place.

So yes, there is definitely an advantage in setting the expires headers - less http calls.

Tiago Simões



An alternative solution to make a web application run a lot faster is by adding static files to a content delivery network.


You will not only make your web application run a lot faster, but at the same time you will help reduce your server load.


NOTE: this solution would be the ideal solution for large enterprise websites.

Content Delivery Network (CDN) providers

Hi Robert,

You're right, using a CDN is in fact the ideal solution for websites.
But bear in mind the fact that even if you use a CDN this might be a good idea, as some CDN's (or more correctly some reverse proxies) will use this headers to know what to cache.

As a sidenote here's how it's done in IIS7:

Click on HTTP Response Headers

Click on Set Common Headers... and set Expire After 31 days.

Tiago Simões

I get asked a lot about the size of js and css in mobile web applications.
But in the end we all want styles, calendars, ajax, validation, etc... in these apps also, so there is not a lot where to trim. 

All modern mobile web browsers (iOS, Android, etc...) now have pretty good caching mechanisms, and as such you should take advantage of that.
So if you are creating mobile applications you should really follow the procedures explained above (these are now also included in the installation checklist). Scripts will be cached the first time you access them and afterwards they'll always be get from the cache.

As a result you'll see your mobile applications loading a lot faster. 

Tiago Simões
Here's a cool article from HighScalability.com that builds upon Tiago's point:
Better Browser Caching Is More Important Than No Javascript Or Fast Networks For HTTP Performance

It's really impressive the difference you get by applying this minor tweak. Try it for yourselves!