Professional Documents
Culture Documents
You may have noticed that when a Kentico site is deployed on to a server, when we browse
the site pages for the first time, it takes much time to load the pages. Once it is cached at
server side, then the performance of pages improves.
Solution
The solution to avoid the above problem would be; if we can visit all the pages with-in the site then
server side cache will be generated and performance of the pages will improve. If we have only a few
number of pages we can do it easily. But, if we have large number of pages then visiting all the pages
may become a difficult task for the client. In order to avoid this kind of problems we need to automate
the visiting of all pages using a program/tool.
We have created a CMSUtility program/tool to visit all the pages with-in the site using casperJS.
CasperJS is an open source navigation scripting & testing utility written in Javascript for the PhantomJS
WebKit headless browser and SlimerJS (Gecko). It eases the process of defining a full navigation scenario
and provides useful high-level functions, methods & syntactic sugar for doing common tasks such as:
Design:
Use casperJS to read the sitemap.xml of the site. casperJS runs on the PhantomJS environment.
For each page listed in the sitemap.xml, do a GET request for the page.
This will make the server cache the page for faster response for subsequent requests.
The tool will maintain a log for all the pages with-in the site.
The tool would maintain a log of the pages visited and its status including reponse time, in the
local directory where the tool is run from.
Example: www.raybiztech.com/blog
We've browsed the site and it cached at server side. After server side caching it took 4.31s to
load the page.
After browser caching it took 1.26s to load the page to load the page.
`
http://casperjs.org/
http://phantomjs.org/
https://code.google.com/p/phantomjs/wiki/PhantomJS