Tuesday, April 19, 2011

Design patterns

Creational patterns
Abstract Factory
Factory Method
Singleton

Structural patterns
Decorator
Facade

Behavioral patterns
Chain of responsibility
Command
Iterator
Observer
Template

Monday, April 18, 2011

Important JVM settings

-Xss : The stack size for each thread
Each thread in the VM get's a stack. The stack size will limit the number of threads that you can have, too big of a stack size and you will run out of memory as each thread is allocated more memory than it needs. If stack size is too small, you can get exception stack over flow. And 2048k is an appropriate value for most situations.
Ex: Limit thread stack size on Linux
ulimit -s 2048

-Xms : Min heap size
-Xmx : Max heap size
Simply tip of performance: IBM, for example, recommends setting the minimum to the lowest heap size needed so that garbage collection happens often, but runs quickly. Some individuals errantly recommend setting the minimum to the same as the max heap size, which causes garbage collection to run only after the heap is full (and therefore garbage collection is terribly inefficient)

-XX:MaxPermSize : Max Permanent generation size

Example: -Xms128m -Xmx512m -XX:MaxPermSize=512m -Xss1024k

Wednesday, April 13, 2011

OpenID and CAS, what is best choice?

CAS and OpenID solve, roughly, two different problems:
* Single Sign On
* User account management

CAS for user-centric. Examples of user-centric scenarios would be Google Apps for Domains: One account for all these services.

OpenID for application-centric. Users will only use one or few applications you offer, and you can thusly simplify the process for them, by cutting the amount of username/password credentials your users have to maintain drastically.