In our application we often need to do ad-hoc snapshot data queries. For that we create OmmConsumerConfig, read dictionary file (from local filesystem), pass config to w newly created OmmConsumer, then use consumer to subscribe for data, collect it, then unregister the handler. Finally we uninitialize() the consumer and then all references to it (and to config) are cleared (they are both local variables in the method).
This method is called several times a day and we noticed problem with memory usage of our application. We observed it with VisualVM and it was clear to us, that our method was causing it.
Weird thing was that string values from the Dictionary file were appearing there in VisualVM as many times as the method was called, which lead us to thinking some references were not cleared and GC not happend for the whole Consumer/Config structure.
We implemented a pool of consumers now and since then the memory usage is no longer increasing per method call (which indicates problem within the OmmConsumer/OmmConsumerConfig and not in our code which uses it).
Has anyone tried creating many consumers and deleting them during a single app lifecycle? (with loading of dictionary file from local filesystem - this may play a role, or not - I don't know).
Is there anything we need to do apart from calling uninitialize() on the consumer and clearing references to consumer and the config?
I have provided the following answers to the client in the case's email:
Q1: Has anyone tried creating many consumers and deleting them during a single app lifecycle? (with loading of dictionary file from local filesystem - this may play a role, or not - I don't know).
A1: Does your application allow multiple users to access/request data simultaneously?
If yes, many consumers(OmmConsumer instances) are required because one consumer allow only one user to login and request data. Hence, the application should create many consumers to serve all users and can deleting them during a single app life cycle.
If no, only a single consumer(OmmConsumer instance) is required:
Q2: Is there anything we need to do apart from calling uninitialize() on the consumer and clearing references to consumer and the config?
A2: No. Calling uninitialize() on an OmmConsumer object causes the application to log out and disconnect from the connected server. This is to destroy the OmmConsumer Object. Your application clears references to consumer and the config as well. Hence, these should be enough.
Normally Developer Community Forum is for how-to/general questions but your question seems to be complex and requires a deep investigation e.g. review your source code, configuration, try to reproduce the problem from Elektron API specialist team(my team).
If you would like to be a premium user, please send an email to email@example.com After you are a premium user, please submit your problem to my team directly via Premium Support . For any difficulties submitting the query to us, please contact firstname.lastname@example.org
Do you have an example on how to use : " rtmesBuffer" ? RMTES Decoder EMA provides a built in RMTES decoder. If desired, application may cache RmtesBuffer objects and apply all the received changes to them