8000 Feature/planning issue 188 (#2547) · arangodb/arangodb@9edb884 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9edb884

Browse files
mchackifceller
authored andcommitted
Feature/planning issue 188 (#2547)
* add warmup documentation - #188 * warn when relinking build directory * add warmup documentation - #188 * warn when relinking build directory * Renamed warmup to loadIndexesInMemory which is a better name for the current implementation of this feature. * Adapted WebUI to state 'load indexes in memory' instead of 'warmup' * Added loadIndexesInMemory documentation. * Renamed loadIndexesInMemory => loadIndexesIntoMemory
1 parent e04991c commit 9edb884

25 files changed

+506
-373
lines changed

Documentation/Books/HTTP/Collection/Modifying.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Modifying a Collection
77
<!-- js/actions/api-collection.js -->
88
@startDocuBlock JSF_put_api_collection_unload
99

10+
<!-- js/actions/api-collection.js -->
11+
@startDocuBlock JSF_put_api_collection_load_indexes_in_memory
12+
1013
<!-- js/actions/api-collection.js -->
1114
@startDocuBlock JSF_put_api_collection_properties
1215

Documentation/Books/Manual/Indexing/WorkingWithIndexes.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,40 @@ Same as above. Instead of an index an index handle can be given.
139139
@endDocuBlock col_dropIndex
140140

141141

142+
### Load Indexes into Memory
143+
<!-- arangod/V8Server/v8-vocindex.cpp -->
144+
145+
146+
Loads all indexes of this collection into Memory.
147+
`collection.loadIndexesIntoMemory()`
148+
149+
This function tries to cache all index entries
150+
of this collection into the main memory.
151+
Therefore it iterates over all indexes of the collection
152+
and stores the indexed values, not the entire document data,
153+
in Memory.
154+
All lookups that could be found in the cache are much faster
155+
than lookups not stored in the cache so you get a nice performance boost.
156+
It is also guaranteed that the cache is consistent with the stored data.
157+
158+
For the time beeing this function is only useful on RocksDB storage engine,
159+
as in MMFiles engine all indexes are in memory anyways.
160+
161+
On RocksDB this function honors all memory limits, if the indexes you want
162+
to load are smaller than your memory limit this function guarantees that most
163+
index values are cached.
164+
If the index is larger than your memory limit this function will fill up values
165+
up to this limit and for the time beeing there is no way to control which indexes
166+
of the collection should have priority over others.
167+
168+
@startDocuBlockInline LoadIndexesIntoMemory
169+
@EXAMPLE_ARANGOSH_OUTPUT{loadIndexesIntoMemory}
170+
~db._drop("example");
171+
~db._createEdgeCollection("example");
172+
db.example.loadIndexesIntoMemory();
173+
~db._drop("example");
174+
@END_EXAMPLE_ARANGOSH_OUTPUT
175+
@endDocuBlock loadIndexesIntoMemory
142176

143177
Database Methods
144178
----------------
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
@startDocuBlock JSF_put_api_collection_loadindexesintomemory
3+
@brief Load Indexes into Memory
4+
5+
@RESTHEADER{PUT /_api/collection/{collection-name}/loadIndexesIntoMemory, Load Indexes into Memory}
6+
7+
@RESTURLPARAMETERS
8+
9+
@RESTURLPARAM{collection-name,string,required}
10+
11+
@RESTDESCRIPTION
12+
This route tries to cache all index entries
13+
of this collection into the main memory.
14+
Therefore it iterates over all indexes of the collection
15+
and stores the indexed values, not the entire document data,
16+
in Memory.
17+
All lookups that could be found in the cache are much faster
18+
than lookups not stored in the cache so you get a nice performance boost.
19+
It is also guaranteed that the cache is consistent with the stored data.
20+
21+
For the time beeing this function is only useful on RocksDB storage engine,
22+
as in MMFiles engine all indexes are in memory anyways.
23+
24+
On RocksDB this function honors all memory limits, if the indexes you want
25+
to load are smaller than your memory limit this function guarantees that most
26+
index values are cached.
27+
If the index is larger than your memory limit this function will fill up values
28+
up to this limit and for the time beeing there is no way to control which indexes
29+
of the collection should have priority over others.
30+
31+
On sucess this function returns `true`
32+
33+
@RESTRETURNCODES
34+
35+
@RESTRETURNCODE{200}
36+
If the indexes have all been loaded
37+
38+
@RESTRETURNCODE{400}
39+
If the *collection-name* is missing, then a *HTTP 400* is
40+
returned.
41+
42+
@RESTRETURNCODE{404}
43+
If the *collection-name* is unknown, then a *HTTP 404* is returned.
44+
45+
@EXAMPLES
46+
47+
@EXAMPLE_ARANGOSH_RUN{RestCollectionIdentifierLoadIndexesIntoMemory}
48+
var cn = "products";
49+
db._drop(cn);
50+
var coll = db._create(cn);
51+
var url = "/_api/collection/"+ coll.name() + "/loadIndexesIntoMemory";
52+
53+
var response = logCurlRequest('PUT', url, '');
54+
55+
assert(response.code === 200);
56+
57+
logJsonResponse(response);
58+
db._drop(cn);
59+
@END_EXAMPLE_ARANGOSH_RUN
60+
61+
@endDocuBlock
62+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
arangosh&gt; db.example.loadIndexesIntoMemory();

arangod/Cluster/ClusterMethods.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ int warmupOnCoordinator(std::string const& dbname,
665665
"", coordTransactionID, "shard:" + p.first,
666666
arangodb::rest::RequestType::GET,
667667
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/collection/" +
668-
StringUtils::urlEncode(p.first) + "/warmup",
668+
StringUtils::urlEncode(p.first) + "/loadIndexesIntoMemory",
669669
std::shared_ptr<std::string const>(), headers, nullptr, 300.0);
670670
}
671671

arangod/V8Server/v8-collection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3337,7 +3337,7 @@ void TRI_InitV8Collections(v8::Handle<v8::Context> context,
33373337
JS_UpdateVocbaseCol);
33383338
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("version"),
33393339
JS_VersionVocbaseCol);
3340-
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("warmup"),
3340+
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("loadIndexesIntoMemory"),
33413341
JS_WarmupVocbaseCol);
33423342

33433343
TRI_InitV8IndexCollection(isolate, rt);

js/actions/_api/collection/app.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -468,17 +468,15 @@ function put_api_collection_load (req, res, collection) {
468468
}
469469

470470
// //////////////////////////////////////////////////////////////////////////////
471-
// / @brief was docuBlock JSF_put_api_collection_warmup
471+
// / @brief was docuBlock JSF_put_api_collection_loadIndexesIntoMemory
472472
// //////////////////////////////////////////////////////////////////////////////
473473

474-
function put_api_collection_warmup (req, res, collection) {
474+
function put_api_collection_load_indexes_in_memory (req, res, collection) {
475475
try {
476-
// Warmup the indexes
477-
collection.warmup();
476+
// Load all index values into Memory
477+
collection.loadIndexesIntoMemory();
478478

479-
var result = collectionRepresentation(collection);
480-
481-
actions.resultOk(req, res, actions.HTTP_OK, result);
479+
actions.resultOk(req, res, actions.HTTP_OK, true);
482480
} catch (err) {
483481
actions.resultException(req, res, err, undefined, false);
484482
}
@@ -632,12 +630,12 @@ function put_api_collection (req, res) {
632630
put_api_collection_rename(req, res, collection);
633631
} else if (sub === 'rotate') {
634632
put_api_collection_rotate(req, res, collection);
635-
} else if (sub === 'warmup') {
636-
put_api_collection_warmup(req, res, collection);
633+
} else if (sub === 'loadIndexesIntoMemory') {
634+
put_api_collection_load_indexes_in_memory(req, res, collection);
637635
} else {
638636
actions.resultNotFound(req, res, arangodb.ERROR_HTTP_NOT_FOUND,
639637
"expecting one of the actions 'load', 'unload',"
640-
+ " 'truncate', 'properties', 'rename'");
638+
+ " 'truncate', 'properties', 'rename', 'loadIndexesIntoMemory'");
641639
}
642640
}
643641

0 commit comments

Comments
 (0)
0