The growth and power of mobile devices

The following is the recent statistics of my agriculture based website http://market.grassfield.org

It is amazing to see, Internet Explorer is in the fourth place, and the third place goes to mobile browsers.

Image

The following graph shows the split up of the mobile devices.

Image

mmm. interesting!!

Advertisements

Monitoring JEE applications

Development of Java enterprise applications had evolved over a period of time, We can say we are in a legacy period now with the help of modern frameworks and packages. I could see lot of developers start talking about Grails, many of them started learning Groovy scripting. It is amazing to feel we can make a Java enterprise web application with all modern libraries and UI frameworks integrated in just 10 minutes!!! Thanks to Grails. Application become less error-prone and development becomes an enjoyable one with the modern frame works. Lazy developers like me are so happy to know he is not going to write javascript for UI, SQL queries for backend access. While we giving importance to rapid component development and integrations, these libraries become inevitable.

On the otherside, one should worry about performance. It is painful to think about the CPU consumption of the browser while loading packed AJAX libraries, the number of SQL queries being fired to complete a simple task, the number of connections opened/closed to execute those queries, the load applied on JVM in terms of high CPU consuming threads or concurrent processing without threads getting blocked. When multiple tiers involved, debugging becomes a pain. While we don’t have sufficient time for development, we can’t afford for the resources to spend much time debugging each and every tier. A simple slow down at my DB backend, slows down my enterprise application. But my developer finds it after 5 working days because, he already spend one day each for user interface, Spring beans, ORM integraton and finally Hibernate tiers!! Monitoring them as silos din’t work out. All our admins tries to prove their box is doing good! It is worth to search for a tool which can monitor all of them as a service.

Here is a case study.
We take a simple web application running in Tomcat 6.
It uses Struts 2 for View, Spring 3.1 for Model, Hibernate 3 for Spring ORM with MySQL backend. We run one Apache web server where Phpmyadmin is running for the same database using by java application.

The application was running without any issue in the beginning. We used to upgrade it as we add new modules. Recently we found the application is not responding for logins. We could see the when we try login, the request is on progress for ever. We could see ‘Waiting for…’ without time-out! As any critical issue, this one also din’t have any trace in application process log, tomcat log. It happens sometimes 🙂 Without waiting for me, the server dies in another 3 or 4 hours!


A good idea is post it in the forums, But where? Java? Struts? Spring? Hibernate? Mysql? I have no trace with me! As a lonely programmer, I need to find out where I shoud start now. I added all the components in my monitoring solution and restarted Tomcat. I got the results when the problem occured again.  All the requests are pending in ‘user login’ block. I have an audit code, which will write success & failure login attempts to database, It is waiting for SQL connection for hours!! All the login requests are pending as ‘Waiting’ threads.

See the graph given for two days. You could see the blocked thread count increased from 10 to 212 on periodic intervals.

  • Red dots indicates the time at which the application stops responding to the users.
  • Yellow dots represent the appliation crash time.
  • The sudden drop shows the manual restart of the application.

Very many threads are in blocking state with the following trace.

Stack Trace     :
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:810)
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:490)
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)
org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:261)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy17.add(Unknown Source)
org.grassfield.common.interceptor.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)

Now we got a handle from which we need to start.

I got an immediate reply from spring community – it is connection pool
http://forum.springsource.org/showthread.php?p=347479

  • Transactions are not implemented properly. Since DataSource is directly injected, spring dint care about releasing the connections.
  • Need to make all my service methods @transactional, DB retrievals made as read-only in addition to few other changes to DAO configuration which I preferred.
  • I was checking the connections consumed or the session details at MySQL, I dont see any abnormalities.
  • The fault was with my blind guessing about default active/maximum connections of commons-dbcp. I thought default connections will be sufficient for me. But I found I din’t give the minimum, maximum and active SQL connection count where default values 8 connections. But I need 5 ~ 12 connections

Hence this solves the issue. The abstractions of the frameworks reduce the time being spent in development. At the same time, We need to be in a position to analyse the different tiers integrated together.

Representing ThreadDump details is basic thing with java monitor, but representing the details so that it can reduce our diagnosing time is highly important. Monitoring JTA becomes a valuable point in any java monitoring product. Still searching for better way of monitoring Struts/Spring/Hibernate layers individually. Hope we will get it soon!

IBM developerWorks seminar on ‘Leverage the power of smart SOA’ – Report

A full day seminar on ‘Leverage the power of smart SOA’ was conducted by IBM developerWorks forum today, 12th Mar 2009, at Image Auditorium, MRC Nagar, Chennai. I registered myself for this last week, got the confirmation over phone a day before.

The arrangements were good. Though, the preparations were not so planned as that of IBM conference held at Tidel park or the Websphere week celebrations held early this half year, I would say it was decent enough at this point of time. Yes, Organizing an event within a facility like WOW & Tidel park is relatively much easier than that of engaging a full-fledged conference.

ibmWe had been requested to be there at registration counter by 8-30AM, to get a suprise gift! I’ve seen many professionals across the companies came on time. That’s a good sign. I could see sweating Bharati Muthu, (Program Manager – Skill development for developerWorks, India/South Asia) was working behind the screen to make this event successful.IBM experts delivered useful and interactive sessions on SOA, web2.0, cloud computing etc.

The questions were enormous because all questions got goodies :). I would say some of the doubts were worthless!

The program started with a movie demonstrating IBM developerWorks followed by Bharati’s keynote. Let me brief about the rest of the sessions below.

1. Smart SOA – Ram Viswanathan, IBM

SOA is already on the full swing, a hot topic among the techies. This session was about optimizing it furthur, to suit the current economic trend, changing customers requirements etc. He insisted the need for bringing business and IT together to drive any company. He justified his view from various surveys and reports. SOA is to be implemented efficiently so that it can make the processes more agile, (change friendly), which will make the company to survive, He said.

2. Cloud computing – Ram Viswanathan, IBM

cloud

This is the recent buzz in the industry. I had attended a session conducted by Sun last week, which motivated me to give a serious look into this. I will write about this session slightly later.Ram presented the Cloud Computing at a macro level, followed by an interactive Q&A session. He explained about the need for Cloud, different clouds available now, the pros and cons of the same. I could remember some interesting questions were asked like, difference between grid computing and cloud computing, relationship between SOA, Cloud computing and SAAS etc.

3. SOA Next Steps: Entry points through reuse and connectivity. – Vignesh V, IBM

entry points

Image courtesy:  ibm.com

Vignesh followed Ram to deliver a speech in detail on SOA and looking for possibilities in implementing the same. He issued tips to developers/managers to possibility of implementing SOA at customer place, rephrasing it, key points to convince the client to SOA, and how IBM has tools to support one’s decision. He listed out several entry points among which reuse and connectivity is given preference in his speech.

I should mention an interesting video about IBM ESB, he played. IBM knows how to market it! Here is the youtube video. http://www.youtube.com/watch?v=1yUvonES0Gk

4.  SOA Technologies: Web 2.0 – Naren Krishnan, IBM

This session was interesting to me, because I’ve been working in this for a while. Naren was talking about the need for Web2.0, what are the technologies supporting web2.0 and the IBM tools that helps the developers to create applications based on the same.

5. SOA life cycle, Service Oriented Modeling and Architecture (SOMA) – Vignesh, IBM

lifecycle

Image courtesy:  ibm.com

This was a detailed session about the life cycle of SOA. I thought it might have been better if it was delivered before the entry points to SOA. Vignesh pointed out the various phases in SOA like model, assemble, deploy and manage/monitor and explained the role of IBM tools in each and every phase. Finally he explained SOMA, which is a part of model in SOA lifecycle.

6. IBM developerWorks: Learn, Share, Connect – Himanshu Goyal, IBM

ibm developerWorks

This was purely marketing lecture to developerWorks portal. Himanshu being the head, he delivered his lecture in an interesting manner. But Bharati provided more information about the portal in a session I attended couple of months ago in Week of Websphere!

7. SOA Technologies: SOA and zSeries – Ramakrishnan Kannan, IBM

This is an interesting session on Main frames. Kannan explained the complex SOA concepts with simple real life examples and covered the topic in a decent manner. His talk was about modernization, how to integrate z OS with SOA. Good session followed by q&a. Being a pure java guy, I am not able to grasp everything he told.

8. Managing Business Process as Entry Point to SOA – some IBM vendor

This session was not so interesting to me, I got bored with repeated information and the way the speaker presented his views. Unfortunately I got a call from my office and I need to quit in halfway.

9. JAM – UnConference

This is an interesting part of the agenda, Just-A-Minute/Unconference. Participants were encouraged to present their own topics of interest within the given time of 10 mins. Laptops were arranged for JAM speakers to design their slideshow (I hate the word PPT, so MS-centric!). Proactive policies were declared to choose the speaker and topic. (democracy as Bharati told!!) I missed to see who won that ipod shuffle for his successful JAM session. I came to know that many participate actively and truly to bring “community knowledge haring” to full!

My view . .

dw logo

Image courtesy:  ibm.com

This is an interesting change, Corporates are creating developer communities. Of course, they try to form a forum, pushing the technology, which helps them to market their ideas and products. I just think about how Linux User Groups (LUGs) evolved over a period of time across the globe. Corporates follows the same strategy and they are coming to public domain.

Most of the giants are creating their own cloud, their own developer forums. IBM’s developerWorks, Sun’s Kenai are all trying to pull or encourage or help developers with their products. I will write more about this individual topics when I found time.

Let me end this report with a line what Himanshu pointed out.

I don’t know what I don’t know!

Thanks to IBM for the goodies delivered, the green planet revolution and the nice lunch!

For more info : http://www.ibm.com/developerworks/