Understanding spike in ram usage serving vaadin UI


We have a hosted app that we are getting ready for customer release and are now focusing on improvements in performance and efficiency. I am hoping for some insights into how the vaadin framework works that might help reduce “ram spikes” I’m seeing:

Our app currently just has one type of vaadin UI component we serve, we use vaadin push, vaadin charts and vaadin 7.3.1. Our app is reasonably heavy at this stage.

When I profile our server code using something like visual vm this is the typical behaviour I see:

  • on starting the app and the server, the heap hovers around 400MB’s and the number of threads is at about 24
  • on requesting the first vaadin UI, the heap jumps up to about 800MB’s then gradually climbs. The number of threads jumps to about 42 most of which come from the atmosphere framework and are parked. Then gradually more atmosphere threads are added.
  • after waiting about 30 minutes, the heap garbage collects down to about 400MB’s and stays there. The ui is still alive and I can interact with it normally and doing so doesn’t cause the ram usage to increase.
  • each subsequent UI I open in different tabs causes the heap to increase by about 100MB’s

I’ve attached a screen shot of the heap and threads.

I would like to understand what is causing this spike and what is being garbage collected, as it doesn’t seem like vaadin needs that ram if it can gc it and everything still functions properly. The main problem with this ram spike is that the web server is hosted on a Heroku 2X dyno which has a ram limit of 1GB, so these temporary spikes cause out of memory errors that could be avoided as the dyno does actually have enough ram to host more ui’s.

Any help is much appreciated, thanks in advance!