Search code examples
gwtgwt-celltable

Gwt performance issue : huge data and celltable


I have a server-side service that sends me huge DTOs. I need to put them in a CellTable. It's like 10-200 lines, and i need to see everything at the same time.

I have a server-side log that traces the last "man-made" line of code of my service (just before the return).

Best case scenario, there's a 2 min gap between this log and the table fully loaded. Most of the time, something breaks along the process, and it leaves me hanging.

What are my options ?

Thanks

Edit : I tried the idea of Andrei, differentiating the lenght of the data download (rpc callback) and the lenght of the celltable loading.

I wanted to be sure so here's what i did in my callback :

@Override
public void onSuccess(ResponseBean result) {
  Window.alert("success " + new Date().toString());

  resultPanel.updateResults(result);

  Window.alert("celltable " + new Date().toString());
}

The first alert occurs after ~10sec. But the second one is never called.

This is the method behind updateResults :

public void updateResults(ResponseBean response) {
  dataProvider.getList().clear();
  dataProvider.getList().addAll(response.beans());
  myCellTable.setPageSize(response.beans.size());
}

EDIT 2 : I tried a number of things. The problem occurs when i try to fill the celltable with my data. In Chrome, the chrome version of the BSOD appears. In Firefox, it breaks silently, but the remaining js instructions are not executed. If i try to read the console in firebug, my firefox freezes using ~2.5GB ram. If i use the gwt-runner, it freezes also.

In my example, there are only 4 rows (4 objects with multiple dependancies) !

How can i find WHAT breaks and WHERE ?

Thanks for helping :)

FINALLY : Ok, so i'm apparently a moron. Somewhere in the getValues() there was a piece of "business logic" that should not have been there, and that caused OutOfMemory errors.

The takeways though :

  • Trace the last call server-side and the first line of the onSuccess client-side to see if the problem is RPC related
  • If your celltable breaks but there are only a few lines, you did something you won't be proud of
  • Scheduler.get().scheduleDeffered allows you to render the page, then do your business logic. So that's cool.

Thanks guys


Solution

  • Normally I would bet my money on the RPC serialization being the bottleneck rather than the CellTable rendering.
    However you are saying that the first alert appears after 10 sec which would speak against that.

    Rendering 200 DTO's should be fast enough with a CellTable.
    Also sending 200 DTO's over the wire shouldn't be no problem.

    I have used CellTable and sent around 5000 DTO's over the wire without any performance issue (though I only display 50 at a time and use paging).

    A couple of thoughts:

    • Dev Mode is much slower than production mode (especially regarding de-serialization). So test performance also in Production mode.
    • To find out what is exactly causing your problem, use Chrome Dev Tools. You can profile your code and see what is causing delays.
    • Can you create 200 Dummy DTO's manually in your code and pass it to your updateResults function and see how the performance compares.
    • How many columns do you display? If you display many columns, reduce it to only one and see how it affects performance.
    • Does any getter which is used in a CellTable column have expensive business logic?