Design your application to scale database horizontally

Database scalability is one of the critical factor in designing scalable web application. All the four major cloud vendors (Amazon, Microsoft, Google and Oracle) offers relational database as service which abstracts several complexities for developers to setup and manage database servers that helps developers focus on pure application development. Even with cloud vendors service based offering scaling database horizontally still a challenge which developers need to resolve at application level. In this article I would like to talk about the challenges and possible solution for same.

Read more of this post

Advertisements

Monitoring HttpSession memory leak during JavaEE development

In my previous post I have provided a sample servlet filter to monitor non-serializable objects in HttpSession to make the JavaEE application compatible for clustered environment. We have enhanced the same servlet filter to log HttpSession object size which is helping us to find the memory leak during the development.

Here is the Java code
Read more of this post

Java: Sample Active Directory authentication code

Here is a sample Java code to authenticate against Windows Active Directory server.

  • The code finds all available active directory servers in your network.
  • It uses one of the available active directory server for authentication.
  • If an active directory server is down then it starts using next available server if any.
  • This class is thread-safe, you can create one instance and re-use them multiple times.
  • I tested this code from Linux and Windows box.

You can find the below source code in GitHub as well.
ActiveDirectoryAuthentication.java
Read more of this post

Some statistics on programming language

Some interesting statistics on open source programming language based on TIOBE Programming Community Index.

Programming Language First
Released
Ratings
Oct 2013
C

1972

17.25%

Java

1995

16.11%

C++

1980

8.66%

PHP

1995

6.09%

Python

1991

3.11%

JavaScript

1995

2.04%

Perl

1987

1.61%

Ruby

1993

1.25%

Groovy

2003

0.66%

Scala

2003

0.35%

Haskell

1990

0.25%

Source:

http://www.tiobe.com/tpci.htm

http://en.wikipedia.org/wiki/History_of_programming_languages

JavaEE – Clustering support in JSF, Wicket, ZK, etc.

When a seasoned MVC framework developer starts writing code in component based framework like JSF, Wicket, ZK, etc. they fail to understand the basic differences between MVC and component based framework because they could write code which can work in non-clustered environment i.e. in single JVM deployment. When the same application is deployed in a clustered environment they start realizing the difference which will require lots of effort revisit all the code and make it compatible for clustering. I am going to talk about a few guidelines on making development (on top of component based framework ) cluster aware.
Read more of this post

Simple vs. Complex design

Some of my favorite quotes and comments about simple vs. complex design.

  • achieving a simple, elegant design is very hard work but
  • since the design is so simple and elegant it looks like it should be easy.
  • so you get less credit than if you design something that looks complicated

Read more of this post

Capture Heap dump from Tomcat Windows Service

Add the following options into Tomcat >> Java >> Java Options

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

  • Goto JAVA_HOME/bin directory and launch jconsole.exe application
  • In the remote process box enter localhost:8086 and click Connect button
  • Switch to the MBeans tab
  • select com.sun.management – HotSpotDiagnostic – Operations – dumpHeap in the tree on the left
  • Pressing the dumpHeap button creates the heap dump. The parameter called p0 allows you to specify into which target file the heap is dumped.