Wednesday, July 25, 2012

Improving the performance of a Vaadin OpenLayers Map

The problem 


I am using Vaadin with it's openlayers addon
I am showing a map with about 10000 points and lines between them.
Vaadin started getting very sluglish

The Solution

Kiren Pillay suggested that I use JProfiler
So that is what I did.
I finally saw what in Vaadin was taking all the time.
getApplication() on the Panel was being called more than 50,000 times
isEnabled() was also being called on the same panel about the same amount of time.

These calls were very fast, but because of the shear number of requests, it was slowing my application down to a crawl.

So with the combination of  JProfiler and JRebel I could apply these changes without a restart!


// Snip
  
   Application app;
   public MyPanel( Application app){
       this.app = app;
   }

   @Override
    public boolean isEnabled(){
        return true;
    }

   @Override
    public Application getApplication(){
        return app;
    } 
 

The end result ?

A dramatic improvement in handing in the browser!


No comments:

Post a Comment