Skip to content

Commit 8d33f67

Browse files
committed
fix shared map doc
1 parent 29f9ac9 commit 8d33f67

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

Directives.md

+5
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,11 @@ generate hash code. The key/value of shared hash map can be `int`,`long`,`String
10161016

10171017
**limitation**
10181018

1019+
type | entry structure size(Bytes)| table structure size(Bytes)| space limit |entries limit| key limit| value limit|
1020+
------------ | -----------|-----------|-------------|------------|--------------------|---------------------
1021+
tiny map |24 |entries x 4| 4G or 2G (32-bit)| 2^31=2.14Billions | 16M | 4G or 2G (32-bit) |
1022+
hash map |40 or 28(32bit)|entries x 8 or 4 (32-bit) |OS limit| 2^63 or 2^31 (32-bit)| OS limit | OS limit |
1023+
10191024
But note that if needed memory size is less than half of OS page size the real allocated size of nginx slab only can be
10201025
2^3 = 8, 2^4 = 16, 2^5 = 32,..., 2^(ngx_pagesize_shift - 1).So on 64-bit OS entry structure size of tiny map really
10211026
uses 32Bytes hash map uses 64Bytes. We'll do some optimize work in the future versions.

Directives.md.html

+33
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,39 @@ <h2>
10031003
So far it has two implementations: tiny map &amp; hash map both of which use MurmurHash3 32-bit to
10041004
generate hash code. The key/value of shared hash map can be <code>int</code>,<code>long</code>,<code>String</code>, <code>byte array</code>.</p>
10051005
<p><strong>limitation</strong></p>
1006+
<table>
1007+
<thead>
1008+
<tr>
1009+
<th>type</th>
1010+
<th>entry structure size(Bytes)</th>
1011+
<th>table structure size(Bytes)</th>
1012+
<th>space limit</th>
1013+
<th>entries limit</th>
1014+
<th>key limit</th>
1015+
<th>value limit</th>
1016+
</tr>
1017+
</thead>
1018+
<tbody>
1019+
<tr>
1020+
<td>tiny map</td>
1021+
<td>24</td>
1022+
<td>entries x 4</td>
1023+
<td>4G or 2G (32-bit)</td>
1024+
<td>2^31=2.14Billions</td>
1025+
<td>16M</td>
1026+
<td>4G or 2G (32-bit)</td>
1027+
</tr>
1028+
<tr>
1029+
<td>hash map</td>
1030+
<td>40 or 28(32bit)</td>
1031+
<td>entries x 8 or 4 (32-bit)</td>
1032+
<td>OS limit</td>
1033+
<td>2^63 or 2^31 (32-bit)</td>
1034+
<td>OS limit</td>
1035+
<td>OS limit</td>
1036+
</tr>
1037+
</tbody>
1038+
</table>
10061039
<p>But note that if needed memory size is less than half of OS page size the real allocated size of nginx slab only can be
10071040
2^3 = 8, 2^4 = 16, 2^5 = 32,..., 2^(ngx_pagesize_shift - 1).So on 64-bit OS entry structure size of tiny map really
10081041
uses 32Bytes hash map uses 64Bytes. We'll do some optimize work in the future versions.</p>

directives.html

+33
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,39 @@ <h2>
11051105
So far it has two implementations: tiny map &amp; hash map both of which use MurmurHash3 32-bit to
11061106
generate hash code. The key/value of shared hash map can be <code>int</code>,<code>long</code>,<code>String</code>, <code>byte array</code>.</p>
11071107
<p><strong>limitation</strong></p>
1108+
<table>
1109+
<thead>
1110+
<tr>
1111+
<th>type</th>
1112+
<th>entry structure size(Bytes)</th>
1113+
<th>table structure size(Bytes)</th>
1114+
<th>space limit</th>
1115+
<th>entries limit</th>
1116+
<th>key limit</th>
1117+
<th>value limit</th>
1118+
</tr>
1119+
</thead>
1120+
<tbody>
1121+
<tr>
1122+
<td>tiny map</td>
1123+
<td>24</td>
1124+
<td>entries x 4</td>
1125+
<td>4G or 2G (32-bit)</td>
1126+
<td>2^31=2.14Billions</td>
1127+
<td>16M</td>
1128+
<td>4G or 2G (32-bit)</td>
1129+
</tr>
1130+
<tr>
1131+
<td>hash map</td>
1132+
<td>40 or 28(32bit)</td>
1133+
<td>entries x 8 or 4 (32-bit)</td>
1134+
<td>OS limit</td>
1135+
<td>2^63 or 2^31 (32-bit)</td>
1136+
<td>OS limit</td>
1137+
<td>OS limit</td>
1138+
</tr>
1139+
</tbody>
1140+
</table>
11081141
<p>But note that if needed memory size is less than half of OS page size the real allocated size of nginx slab only can be
11091142
2^3 = 8, 2^4 = 16, 2^5 = 32,..., 2^(ngx_pagesize_shift - 1).So on 64-bit OS entry structure size of tiny map really
11101143
uses 32Bytes hash map uses 64Bytes. We'll do some optimize work in the future versions.</p>

0 commit comments

Comments
 (0)