Wednesday, June 15, 2011

Solution for too many open files of Tomcat in Ubuntu

Open: sudo gedit /etc/sysctl.conf
add/edit system-level variable: fs.file-max=200000

Open: sudo gedit /etc/security/limits.conf
add/edit shell-level variable:
* soft nofile 2048
* hard nofile 2048

Restart OS.
Check values by command:

cat /proc/sys/fs/file-max
and
ulimit -n

Tuesday, June 7, 2011

Cloud concepts: SaaS - IaaS - PaaS

SaaS - Software as a Service
IaaS - Infrastrure as a Service
PaaS - Platform as a Service, sometimes reffered to Hardware as as Service (HaaS)

Wednesday, June 1, 2011

Principles of OOP

Class Design Principles
# (OCP) The Open-Closed Principle
# (LSP) The Liskov Substitution Principle
# (DIP) The Dependency Inversion Principle
# (ISP) The Interface Segregation Principle

Principles of Package Cohesion
# (REP) The Reuse/Release Equivalency Principle
# (CCP) The Common Closure Principle
# (CRP) The Common Reuse Principle

Principles of Package Coupling
# (ADP) The Acyclic Dependencies Principle
# (SDP) The Stable Dependencies Principle
# (SAP) The Stable Abstraction Principle

Share protocol

Network File System(NSF) for Unix
SMB for Windows
Direct Attached Storage(DAS)
Network Attached Storage(NAS)
Storage Area Network(SAN)

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