Vyacheslav Koptilin created IGNITE-28066:
--------------------------------------------

             Summary: Caching a topology snapshot in a heap
                 Key: IGNITE-28066
                 URL: https://issues.apache.org/jira/browse/IGNITE-28066
             Project: Ignite
          Issue Type: Improvement
            Reporter: Vyacheslav Koptilin


Currently, `LogicalTopologyImpl` always reads a topology snapshot from the 
storage:

{code:java|title=LogicalTopologyImpl}
    @Override
    public LogicalTopologySnapshot getLogicalTopology() {
        return readLogicalTopology();
    }

    private LogicalTopologySnapshot readLogicalTopology() {
        byte[] bytes = storage.get(LOGICAL_TOPOLOGY_KEY);

        return bytes == null ? LogicalTopologySnapshot.INITIAL
                : VersionedSerialization.fromBytes(bytes, 
LogicalTopologySnapshotSerializer.INSTANCE);
    }
{code}

Reading from disk and then deserializing the object can be slow. So, it makes 
sense to cache this value in a heap and read only once during class 
initialization.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to