首页 > 解决方案 > Memory consumption in Apache Ignite - BinaryObject vs concrete class vs SQL

问题描述

I'm wondering how to save data in Ignite. To my understanding there are three methods:

  1. Using a data grid with BinaryObject as value - the main advantage is that the object can be dynamic.
  2. Using a data grid with a concrete class (e.g. Employee) as value.
  3. Using the SQL interface, and using predefined schemas.

Do you know if there are any differences in terms of memory consumption between these methods? I suspect that at least when using BinaryObject, the system must save the keys (some serialized representation), so it may take more memory than the other methods.

What is the most cost-effective method?

Thanks! Gal

标签: databaseignitein-memory-database

解决方案


There is no difference between these methods in terms of occupied space. Any of the mentioned approaches can be used to access the same data, since all of them operate over BinaryObject format. But they are different in other ways.

When using POJO classes, serialization and deserialization into binary format happens on every data access or modification. This method leads to higher CPU usage and heap memory consumption. Note, that stored memory stays the same, but the footprint grows.

BinaryObject approach is more effective in terms of performance, because it doesn't require serialization. BinaryObject interface works directly with the serialized representation.

SQL also operates over BinaryObjects without deserialization, so there is not much difference between approaches 1 and 3. SQL has a few points, that should be taken into account though. See https://apacheignite-sql.readme.io/docs/performance-and-debugging


推荐阅读