0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-30 07:30:04 +00:00
netdata_netdata/database/storage_engine.c
Costa Tsaousis 204dd9ae27
Boost dbengine ()
* configure extent cache size

* workers can now execute up to 10 jobs in a run, boosting query prep and extent reads

* fix dispatched and executing counters

* boost to the max

* increase libuv worker threads

* query prep always get more prio than extent reads; stop processing in batch when dbengine is queue is critical

* fix accounting of query prep

* inlining of time-grouping functions, to speed up queries with billions of points

* make switching based on a local const variable

* print one pending contexts loading message per iteration

* inlined store engine query API

* inlined storage engine data collection api

* inlined all storage engine query ops

* eliminate and inline data collection ops

* simplified query group-by

* more error handling

* optimized partial trimming of group-by queries

* preparative work to support multiple passes of group-by

* more preparative work to support multiple passes of group-by (accepts multiple group-by params)

* unified query timings

* unified query timings - weights endpoint

* query target is no longer a static thread variable - there is a list of cached query targets, each of which of freed every 1000 queries

* fix query memory accounting

* added summary.dimension[].pri and sorted summary.dimensions based on priority and then name

* limit max ACLK WEB response size to 30MB

* the response type should be text/plain

* more preparative work for multiple group-by passes

* create functions for generating group by keys, ids and names

* multiple group-by passes are now supported

* parse group-by options array also with an index

* implemented percentage-of-instance group by function

* family is now merged in multi-node contexts

* prevent uninitialized use
2023-04-07 21:25:01 +03:00

118 lines
3.6 KiB
C

// SPDX-License-Identifier: GPL-3.0-or-later
#include "storage_engine.h"
#include "ram/rrddim_mem.h"
#ifdef ENABLE_DBENGINE
#include "engine/rrdengineapi.h"
#endif
static STORAGE_ENGINE engines[] = {
{
.id = RRD_MEMORY_MODE_NONE,
.name = RRD_MEMORY_MODE_NONE_NAME,
.backend = STORAGE_ENGINE_BACKEND_RRDDIM,
.api = {
.metric_get = rrddim_metric_get,
.metric_get_or_create = rrddim_metric_get_or_create,
.metric_dup = rrddim_metric_dup,
.metric_release = rrddim_metric_release,
.metric_retention_by_uuid = rrddim_metric_retention_by_uuid,
}
},
{
.id = RRD_MEMORY_MODE_RAM,
.name = RRD_MEMORY_MODE_RAM_NAME,
.backend = STORAGE_ENGINE_BACKEND_RRDDIM,
.api = {
.metric_get = rrddim_metric_get,
.metric_get_or_create = rrddim_metric_get_or_create,
.metric_dup = rrddim_metric_dup,
.metric_release = rrddim_metric_release,
.metric_retention_by_uuid = rrddim_metric_retention_by_uuid,
}
},
{
.id = RRD_MEMORY_MODE_MAP,
.name = RRD_MEMORY_MODE_MAP_NAME,
.backend = STORAGE_ENGINE_BACKEND_RRDDIM,
.api = {
.metric_get = rrddim_metric_get,
.metric_get_or_create = rrddim_metric_get_or_create,
.metric_dup = rrddim_metric_dup,
.metric_release = rrddim_metric_release,
.metric_retention_by_uuid = rrddim_metric_retention_by_uuid,
}
},
{
.id = RRD_MEMORY_MODE_SAVE,
.name = RRD_MEMORY_MODE_SAVE_NAME,
.backend = STORAGE_ENGINE_BACKEND_RRDDIM,
.api = {
.metric_get = rrddim_metric_get,
.metric_get_or_create = rrddim_metric_get_or_create,
.metric_dup = rrddim_metric_dup,
.metric_release = rrddim_metric_release,
.metric_retention_by_uuid = rrddim_metric_retention_by_uuid,
}
},
{
.id = RRD_MEMORY_MODE_ALLOC,
.name = RRD_MEMORY_MODE_ALLOC_NAME,
.backend = STORAGE_ENGINE_BACKEND_RRDDIM,
.api = {
.metric_get = rrddim_metric_get,
.metric_get_or_create = rrddim_metric_get_or_create,
.metric_dup = rrddim_metric_dup,
.metric_release = rrddim_metric_release,
.metric_retention_by_uuid = rrddim_metric_retention_by_uuid,
}
},
#ifdef ENABLE_DBENGINE
{
.id = RRD_MEMORY_MODE_DBENGINE,
.name = RRD_MEMORY_MODE_DBENGINE_NAME,
.backend = STORAGE_ENGINE_BACKEND_DBENGINE,
.api = {
.metric_get = rrdeng_metric_get,
.metric_get_or_create = rrdeng_metric_get_or_create,
.metric_dup = rrdeng_metric_dup,
.metric_release = rrdeng_metric_release,
.metric_retention_by_uuid = rrdeng_metric_retention_by_uuid,
}
},
#endif
{ .id = RRD_MEMORY_MODE_NONE, .name = NULL }
};
STORAGE_ENGINE* storage_engine_find(const char* name)
{
for (STORAGE_ENGINE* it = engines; it->name; it++) {
if (strcmp(it->name, name) == 0)
return it;
}
return NULL;
}
STORAGE_ENGINE* storage_engine_get(RRD_MEMORY_MODE mmode)
{
for (STORAGE_ENGINE* it = engines; it->name; it++) {
if (it->id == mmode)
return it;
}
return NULL;
}
STORAGE_ENGINE* storage_engine_foreach_init()
{
// Assuming at least one engine exists
return &engines[0];
}
STORAGE_ENGINE* storage_engine_foreach_next(STORAGE_ENGINE* it)
{
if (!it || !it->name)
return NULL;
it++;
return it->name ? it : NULL;
}