Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Storing Gurux Objects In a Database To Reduce Memory Footprint ?

Storing Gurux objects in a database to reduce memory footprint ?

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By mansour , 26 July, 2019
Forums
Gurux DLMS for Java

Hi Mikko,

We are using the Gurux library to make a meters simulator used for testing purpose. We have around a hundred COSEM objects per meter including some from "Profile Generic" family (Class_id: 7) with a data history of several weeks in buffers.
The problem is that all this server instances with their COSEM objects takes a lot of space in JVM memory (~ 600KB per instance of GXDLMSServer and we have max 1000 counters, so we finally exceed 512MB Heap !
I want to have your advice in order to reduce the memory footprint and if you have already been faced with this problem for example when you want to deploy on a raspberry or device with small configuration ?

We have some ideas like storing some meters data in the database (eg sqlite) instead of heap memory.

Thanks in advance.
Best Regards
Mansour

Profile picture for user Kurumi

Kurumi

6 years 10 months ago

Hi Mansour,

Hi Mansour,

Create objects once and share those objects for all meters.
So you have only one instance from the objects and 1000 instances from the counters.

You can also release profile generic data after reading in PostRead method.

BR,

Mikko

mansour

6 years 10 months ago

Hi Mikko,

Hi Mikko,

Thank you very much for your strategy advices !

Can you please telle me if i have understood correctly :
Solution 1 :
1 instance of gurux server for all meters, there are juste some constraints if we share all objects, some of them contains specific datas (eg : identifiers, security keys, ...) or when some object is set for 1 meter it will be updated for all meters ?

Solution 2 :
The reading method for objects (other than profile generic) stay the same (objects live always in memory)
I have never used the PreRead/PostRead method, I am interested if you have an example of how to use it with profile generic data.
"PreRead can be used if values are not in memory"
"PostRead is called after value is retrieved. Here server can close connections, release memory, etc."
1) I will check in "PreRead" method if it is a profile generic object and if yes i will initialize data for this object
2) After profile generic data reading, in "PostRead" I clean data from memory

Best Regards,
Mansour

Profile picture for user Kurumi

Kurumi

6 years 10 months ago

Hi Mansour,

Hi Mansour,

Create 1000 instances from the server, but create objects, like clock only once.
I believe that now you create 1000 instances from clock object.

Create objects and give objects to the created server as a parameter.
Something like this:

//Only one instance.
GXDLMSClock clock1 = new GXDLMSClock();
for (int i = 0; i != 1000; i++)
{
GXDLMSServer s = new GXDLMSServer();
s.Items.Add(clock1);
}

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin