Saturday, February 4, 2012

Web application performance tips and tricks


I was interested in web application performance improvement topic earlier. When we (Myself and TechLead) discussed on this regard, he advised me to go through Yahoo Developer website on Web application Performance Improvement article (http://developer.yahoo.com/performance/rules.html). It adds more interests to go through similar topics earlier. After doing further Google search, found an interesting article from Balusc blog (http://balusc.blogspot.com/2009/09/webapplication-performance-tips-and.html) where he recommends few more option to enhance the web application performance, on top of the options mentioned in the above Yahoo developer Group website. It sounds more interesting.

So you might think, what am I trying to convey to my developer? J Did further search and come up with few more details on how we can design web application with the improved performance.

My analysis after referring an existing travel agent website below:

1) Use Of Content Delivery Network:

Reference#1 Yarta.Com (Website: http://uk.yatra.com/)

Style sheets downloaded from: http://css3.yatra.com

eg: http://css3.yatra.com/UK/include/css/uk-india-uk.css

Java script down laded from: http://js1.yatra.com

Eg: http://js1.yatra.com/UK/include/js/homepage.js

Images down loaded from: http://img1.yatra.com

Eg: http://img1.yatra.com/images/UK/AIR/continue_but.gif

Separate CNS referred to deliver specific content instead of delivering to Static content alone. This has been mentioned in my below diagram.



2. Points noticed during our analysis:

Direct access to these contents restricted, If we attempt to access it redirects to Home page

  1. All the images are gif format. It is very less in size. They tried to minimize total no of images in a page as much as possible
  2. Many of them embedded images along with Style sheet
  3. Same application used for both http & https. Based on the protocol type actions were defined
  4. A CSS Sprite (http://spritegen.website-performance.org/section/what-are-css-sprites) is a combination of smaller images into one big image. So that we can reduce total no of http requests
  5. Don’t have spaces as much as possible in CSS/JS. Static file download time is directly related to size of the files

This chuck of CSS:

.some-class {

  color: #ffffff;
  line-height: 20px;
  font-size: 9px;
}

can be converted to:

.some-class{color:#fff;line-height:20px;font-size:9px;}

…and it’ll work just fine.

  1. Try to have many forms as much as possible. In other words, our form should not have complex/more inputs

3) Web Page performance measurement Tools:

http://getfirebug.com/

http://sixrevisions.com/tools/faster_web_page/

4) Available tools to help us the web page optimization:

CSS:

http://sixrevisions.com/css/css_code_optimization_formatting_validation/

Image:

Digg (shown above http://digg.com), you can see individual icons for user interaction. To reduce server requests, Digg combined several icons in one big image and then used CSS to position them appropriately.

JavaScript:

JSMIN - http://www.crockford.com/javascript/jsmin.html

YUI Compressor - http://developer.yahoo.com/yui/compressor/

Java Script code improver - http://jcay.com/id-190119110113039.html

5) Reference:

http://sixrevisions.com/web-development/10-ways-to-improve-your-web-page-performance/

Hope this will add more interest to you as well! Happy learning!


-NJN

Password Encryption using Java

Hi Guyz,

My Business Unit is in the process of creating a new development process tool something like Teamtracker for Internal purpose. I was identified as a secondary developer to complete the tool three weeks back. Almost 70% of the development activities have been completed so far. Within an application, we have list of users and their credential details, roles and projects etc.. and those details were stored in database as a plain text.

Early this week I got a requirement from my BA to replace the exiting “plain text” passwords to “hash codes“ and he gave me only 2 hrs to complete the requirement. I was afraid to take that task when I heard it from him. Since the application is built with Spring framework, I thought I can apply ACEGI framework to apply security with in the application. Considering the fact TIME (Existing application code rewrite and the estimation – always worrying factor), thought of do some Google Search and see if I can find anything exciting.

I found a very interesting article on Password Encryption using java code (http://www.devbistro.com/articles/Java/Password-Encryption). Beauty of this article is it is self explanatory, it doesn't require any third party jar files. With in 15 mins of time, I was able to complete the requirement.

Thought of sharing my learning’s to my readers as well. Hope you also enjoy! Happy programming.


Cheers

Nanjudan Chinnasamy

Monday, January 16, 2012

Way to Prevent Duplicate Request from Form in J2EE applications - 3

To fix duplicate form submission issue, you essentially need to implement the Synchroniser Token pattern.

This Synchroniser Token pattern is a common technique as follows:

  • Your application generates a unique token (based upon date, time and session id maybe) with each request or submits from the browser and embeds it in each HTML page returned to the browser as a hidden field.
  • When the user hits a submit button, at the server you check that the token in the page matches the token on the server.
  • If it does, you carry on.
  • If it doesn't, you don't accept the submitted data (you either fail or just show the user the last page with an error/warning).
  • Once the token is checked you immediately create a new unique token.

Now, if the same page is submitted again (by pressing the refresh button) or an old page is submitted (by the user pressing Back) the tokens will no longer match, as the server token was changed, so you can reject the submission.


-Happy Programming,

-NjN

Wednesday, January 11, 2012

Steps to enable SSL in Tomcat server

Tomcat SSL connection:

Refer the following web links to understand the details.

http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html
http://www.globalsign.com/support/faq/tomcat/09.php



Tomcat Server - conf/server.xml file SSL settings & to generate a keystore, follow the steps mentioned in Tomcat support document.


For JBOSS application server lovers, it will be very similar to Tomcat.



-NJN

Web link for JSF specific updates

I can strongly recommend the link for JSF specific updates. Share your comments here!

Cheers

-NJN

Create your own JSF component in1.2 implementation

Have not tried your own JSF component in 1.2 version? Recommend you to have a look into below links to get to know about the component creation in JSF. After going through these links, I am sure you can able to create your own JSF component.

http://www.theserverside.com/news/1364786/Building-Custom-JSF-UI-Components

http://www.exadel.com/tutorial/jsf/HowToWriteYourOwnJSFComponents.pdf

http://www.ibm.com/developerworks/java/library/j-jsf4/


Cheers,

-NJN

Tuesday, January 10, 2012

Recommended website for J2EE framework website

This week, I was going through the recent J2EE technologies and framework updates from web. I was admired by seeing the website http://www.mkyong.com/ . It has very good J2EE framework updates for the experienced candidates who are keen to update their knowledgebase specifically in JSON, JSF2.0, Struts2.0 etc.


I am very happy and more delight to recommend the above mentioned information in my technical blog.


Happy reading!

Cheers,

-NJN

Pega Decisioning Consultant - Mission Test Quiz & Answers

The Pega Certified Decisioning Consultant (PCDC) certification is for professionals participating in the design and development of a Pega ...