Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions pages/fundamentals/storage-memory-usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ accurately.

If you want to **estimate** memory usage in `IN_MEMORY_TRANSACTIONAL` storage mode, use the following formula:

$\texttt{StorageRAMUsage} = \texttt{NumberOfVertices} \times 212\text{B} + \texttt{NumberOfEdges} \times 162\text{B}$
$\texttt{StorageRAMUsage} = \texttt{NumberOfVertices} \times 204\text{B} + \texttt{NumberOfEdges} \times 154\text{B}$


<Callout>
Expand All @@ -463,7 +463,7 @@ According to the formula, storage memory usage should be:

$
\begin{aligned}
\texttt{StorageRAMUsage} &= 21,723 \times 260\text{B} + 682,943 \times 180\text{B} \\ &= 5,647,980\text{B} + 122,929,740\text{B}\\ &= 128,577,720\text{B} \approx 125\text{MB}
\texttt{StorageRAMUsage} &= 21,723 \times 252\text{B} + 682,943 \times 172\text{B} \\ &= 5,474,196\text{B} + 117,466,196\text{B}\\ &= 122,940,392\text{B} \approx 117\text{MB}
\end{aligned}
$

Expand Down Expand Up @@ -498,14 +498,16 @@ But, if the database has a lot of concurrent operations, many `Delta` objects
will be created. Of course, the `Delta` objects will be kept in memory as long as
needed, and a bit more, because of the internal GC inefficiencies.

todo

{<h4 className="custom-header"> <code>Delta</code> memory layout </h4>}

Each `Delta` object has a least **56B**.

{<h4 className="custom-header"> <code>Vertex</code> memory layout </h4>}

Each `Vertex` object has at least **88B** + **56B** for the `Delta` object, in
total, a minimum of **144B**.
Each `Vertex` object has at least **80B** + **56B** for the `Delta` object, in
total, a minimum of **136B**.

Each additional label takes **4B**.

Expand All @@ -515,8 +517,8 @@ memory allocation.

{<h4 className="custom-header"> <code>Edge</code> memory layout </h4>}

Each `Edge` object has at least **40B** + **56B** for the `Delta` object, in
total, a minimum of **96B**.
Each `Edge` object has at least **32B** + **56B** for the `Delta` object, in
total, a minimum of **88B**.

{<h4 className="custom-header"> <code>SkipList</code> memory layout </h4>}

Expand Down Expand Up @@ -610,7 +612,7 @@ Let's assume the name on average has $3\text{B}+10\text{B} = 13\text{B}$ (each
name is on average 10 characters long). One the average values are included, the
calculation is:

$19,148 \times (88\text{B} + 13\text{B} + 16\text{B} + 16\text{B} + 56\text{B}) = 19,148 \times 189\text{B} = 3,618,972\text{B}.$
$19,148 \times (80\text{B} + 13\text{B} + 16\text{B} + 16\text{B} + 56\text{B}) = 19,148 \times 181\text{B} = 3,465,788\text{B}.$

The remaining 2,584 vertices are the `ComicSeries` vertices with the `title` and
`publishYear` properties. Let's assume that the `title` property is
Expand All @@ -622,17 +624,17 @@ list occupies $3 \times 2\text{B} \times 2\text{B} = 12\text{B}$. Using the same
formula as above, but being careful to include both `title` and `publishYear`
properties, the calculation is:

$2584 \times (88\text{B} + 13\text{B} + 12\text{B} + 16\text{B} + 16\text{B} + 56\text{B}) = 2584 \times 201\text{B} = 519,384\text{B}.$
$2584 \times (80\text{B} + 13\text{B} + 12\text{B} + 16\text{B} + 16\text{B} + 56\text{B}) = 2584 \times 193\text{B} = 498,712\text{B}.$

In total, $4,138,356\text{B}$ to store vertices.
In total, $3,964,500\text{B}$ to store vertices.

The edges don't have any properties on them, so the formula is as follows:

$\texttt{NumberOfEdges} \times (\texttt{Edge} + \texttt{SkipListNode} + \texttt{next\_pointers} + \texttt{Delta}).$

There are 682,943 edges in the Marvel dataset. Hence, we have:

$682,943 \times (40\text{B}+16\text{B}+16\text{B}+56\text{B}) = 682,943 \times 128\text{B} = 87,416,704\text{B}.$
$682,943 \times (32\text{B}+16\text{B}+16\text{B}+56\text{B}) = 682,943 \times 120\text{B} = 81,953,160\text{B}.$

Next, `Hero`, `Comic` and `ComicSeries` labels have label indexes. To calculate
how much space they take up, use the following formula:
Expand Down