Computing stuff tied to the physical world

It gets a lot worse…

In Software on Apr 7, 2009 at 00:01

Yesterday’s post was about web server performance. Here’s the latest build of JeeMon with the same page:

Picture 1.png

That’s nearly 17 seconds to render the page now, versus 5 yesterday… whoops!

Here’s why I call this major progress anyway:

  • The “electricity.html” page no longer contains plot data values and is half its previous size.
  • All plot values are obtained via Ajax calls, running (mostly) in parallel.
  • This opens up the path to unobtrusive refreshes and automatic plot updates.
  • All plots now contain meaningful data, the previous version used some bogus values.

As you can see in the above graph, over 15 seconds is spent in waiting for the server to return all plot data.

And the reason this now takes so long is very simple: all values are calculated on-the-fly by the server from stored 5-minute values. That’s over 100,000 aggregated values to generate a simple 52-week bar graph!

All this should sort itself out once I start caching hourly and daily results in the database. For now, only the raw readings and the 5-minute aggregated counts get stored. The finecky bit is to make all aggregations / calculations consistent across arbitrary JeeMon restarts.

Here’s the latest version of the generated page:

Picture 2.png

  1. Could let’s say rrdtool be an answer?

  2. Just an idea – probably you should try to use only one Ajax call with JSON structure as return for the “live” streams of data. One call every 1sec or less. That will speed up the process and reduce complexity, but it may require to re-code how your graphics are built.

    For the most of the historycal screens best way is to store data inside database and generate graphics on the fly as (html canvas tags) in your case.

    IMO you should try to avoid RRDtools.

  3. Indeed, rrdtool could deal with such issues. But it will take only a few dozen lines of code to solve this and I really don’t want to introduce installation dependencies (JeeMon runs on six seven platforms right now).

  4. Thanks. That’s basically what I’m doing right now. No live refreshes yet, but there’s one Ajax request / JSON reply per graph which is then passed on to Flot for rendering in the browser.

Comments are closed.