Thursday, December 6, 2012

My thought on battle for platform



A decade back OS (operating system) was the platform for IT companies. So Microsoft, IBM, HP, Sun all wanted to capture the OS market. Idea was- one that controls the platform will control the business app as well.
But as Linux/Open Source matured with time, control of OS became irrelevant. Now anybody could have or build an OS. Android is an example.

 I sincerely believe the new battle for platform will be for search engine/search technology. 
(I consider Google and Facebook as a new platform and more significant than OS in today's context)

In a nut shell- There is enough content already available and daily/hourly new contents getting generated;  need is to SEARCH, CO-RELATE, ANALYZE  and DELIVER the content to relevant seekers.
Please note content could be anything, even a business app, code, API, product review, hotel room, image, pet and even your life partner ;) could be content and the seeker does not necessarily need to be a human, even a system/software or business could be seeker.

The battle for new platform has already started. I could count three as of now:)
Google, Facebook and Microsoft ;)

Friday, November 9, 2012

Tuning JDBC- Part 1

Before we start please note all R&D should be done in integration environment and not in production , expectation is all bugs/app leaks are closed before you move to production.
Sometime (particularly when you have too large DB/too many DB connected to a single jBoss instance) jBoss throws   No Managed Connections available and timeout error.
This means that all connections to the database are saturated or a thread has timed-out waiting for a connection to open up. Now this could happen due to multiple reasons.
1.  Predominantly we forget to close connection in code 
Solution- Stop leaking any open database connection in app. Go to $deploy/jbossjca-service.xml
and add  <attribute name="Debug">true</attribute>, this will allow jBoss to throw a message like
“Closing a statement you left open, please do your own housekeeping”

2.   Connection pool size
Solution- Increase your connection pool size in datasource file
<max-pool-size>20</max-pool-size>
(Default is 20)

3.  Thread time out
Solution- Increase thread wait time just add below script in  your datasource file
<blocking-timeout-millis>xxx</blocking-timeout-millis>
Note: xxx should be much more than timeout value

4.  Old JDBC Driver
Solution- update driver, it is a JAR file, download and copy into  JBoss  jboss-as/server/myinstance/lib
Happy Tuning

Sunday, October 28, 2012

Open File Descriptor- Happy Tuning

What is a File Descriptor in Linux?
As per dictionary.com literal meaning of descriptor is an element or term that has the function of describing something specific.
In Linux Operating System a file descriptor stand for an interaction between a process and an opened file, while an open file object has information related to that interaction.
Numerous processes could simultaneously open the same file. In that scenario, the filesystem assigns a separate file descriptor to each file, along with a separate open file object.
Under Linux OS-  fd indicates the file descriptor of the opened file. There is a default limit for maximum number of file descriptors that an individual process could open and in Linux it is 1024.
Kind of less :(
At times this max limit could be a bottle neck for some java apps so we use ulimit to tune it.

ulimit -aS displays the soft limit, and ulimit -aH displays the hard limit

Example:

# su - httpd

# ulimit -Hn

# ulimit -Sn


Tuning Open file descriptor max limits

# echo “fs.file-max=95000″ >> /etc/sysctl.conf

# sysctl –p

 # echo “* hard nofile 95000″ >> /etc/security/limits.conf

# echo “* soft nofile 1024″ >> /etc/security/limits.conf

# echo “session required /lib/security/pam_limits.so” >> /etc/pam.d/login

#ulimit -n unlimited

:) Happy Tuning

Sunday, October 14, 2012

Appdynamics Lite- A free APM

Kind of smitten by Appdynamics Lite, cool features and
it is absolutely free of cost. I just tested Java transactions
for a simple webapp and very much impressed and voila
Appdynamic Lite has a .Net version(Free) as well.
Appdynamic Lite Introduction, it has 2% CPU overhead,
10 MB memory footprint and <5 ms latency for user requests.
 
I need to explore this product more and will share finding.
Watch out for next.
 
 

Thursday, October 11, 2012

Java Thread dump and Heap dump


I found many people in industry assume Java Thread dump and Heap dump as same.

A thread dump is a complete list of Java threads that are presently active in a JVM. This is good for understanding behaviour of a Java application at a given time. Most of the time app developers will request app infra team to get a thread dump for their analysis. (e.g. deadlock).

 

How to take thread dump?

#jstack <pid> >> threaddumps.log

A heap dump is a dump of the Java heap memory. This is useful for analysing what use of memory that Java app is making in JVM, help in diagnosing some memory issues. (e.g. memory leaks)

 

How to take heap dump?

#jmap -dump:format=b pid

 

Oracle JDK on Tata instacompute cloud

Other day I was trying to test the new Iaas cloud offering from Tata Communication- Instacompute.
 After I registered, I launched the cloud console, coming from AWS/Rackspace background I found it quite simple.









I added an UBUNTU10.04 LTS X64 template (kind of old huh!) instance and enabled SSH.
I wanted to deploy a basic java shopping cart app and hit it with Jmeter. But alas there was no
JDK available in the that particular Ubuntu template. I guess instacompute folks have used a strip
down version of Ubuntu. Anyway I used following code to fix the issue.
#add-apt-repository "deb http://archive.canonical.com/ lucid partner"
#apt-get update
#apt-get install oracle-java7-installer
Note that once Oracle JDK 7 installed you don't need to manually perform
update-alternatives, this will be done automatically.


Then I checked the installation 
root@ubuntu:~# java -version

java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)



root@ubuntu:~# jps -l
7639 sun.tools.jps.Jps


My environment looks ready now.