You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Use background context rather than IO context during Aux save. (#143)
Due to valkey-io/valkey#2125 the IO context
will not be freed which can trigger later assertions. We don't rely on
it during saving so instead we now just use the background context for
things like logging.
Signed-off-by: Jacob Murphy <jkmurphy@google.com>
* Allow changing the reader/writer threads count at runtime (#129)
With this PR, user can control the threads counts using:
```
config set search.reader-threads <value>
config get search.reader-threads
config set search.writer-threads <value>
config get search.writer-threads
```
In addition, refactored the configuration registration mechanism. Calling `Builder<type>("my-config",...).Build()` will create an instance of configuration entry named `my-config` that can be controlled from the Valkey's `CONFIG SET|GET search.my-config` command AND from the command line by passing `--my-config ...`
**Example 1:**
In order to register a configuration entry with Valkey, named: `search.hnsw-block-size`, the developer needs to place similar lines of code in one of his source files:
```c++
// Include the vmsdk::config namespace
#include "vmsdk/src/module_config.h"
...
// Controls the HNSW resize increments
namespace config = vmsdk::config;
static auto hnsw_block_size =
config::NumberBuilder("hnsw-block-size", // name
kHNSWDefaultBlockSize, // default size
kHNSWMinimumBlockSize, // min size
UINT_MAX) // max size
.WithValidationCallback(ValidateHNSWBlockSize)
.Build();
// Define some boolean flag and initialize it with false
// we can later change it using `config set search.my-bool-flag yes`
auto my_bool_flag =
config::BooleanBuilder("my-bool-flag", false).Build();
```
With the above example, it is now also possible to pass these configuration from the
command line like this:
```bash
valkey-server "--loadmodule libsearch.so --my-bool-flag yes --hnsw-block-size 20480"
```
**Example 2:**
We can also register a configuration entry with an action to take when the configuration item is modified:
```c++
// Include the vmsdk::config namespace
#include "vmsdk/src/module_config.h"
...
namespace config = vmsdk::config;
// Controls the number of reader threads
static auto reader_threads_count =
config::NumberBuilder(
kReaderThreadsConfig, // name
kDefaultThreadsCount, // default size
1, // min size
kMaxThreadsCount) // max size
.WithModifyCallback( // set an "On-Modify" callback
[](long long new_value) {
UpdateThreadPoolCount(
ValkeySearch::Instance().GetReaderThreadPool(), new_value);
})
.Build();
```
Note that the callback is called if you set it programmatically like this:
```c++
VMSDK_RETURN_IF_ERROR(reader_threads_count->SetValue(100));
```
or using `valkey-cli`:
```bash
config set search.reader-threads 100
```

---------
Signed-off-by: Eran Ifrah <eifrah@amazon.com>
* Dropped the deprecated `--threads` flag (#146)
Use `--writer-threads` & `--reader-threads` flags instead
Signed-off-by: Eran Ifrah <eifrah@amazon.com>
---------
Signed-off-by: Jacob Murphy <jkmurphy@google.com>
Signed-off-by: Eran Ifrah <eifrah@amazon.com>
Co-authored-by: Jacob Murphy <jkmurphy@google.com>
Co-authored-by: eifrah-aws <eifrah@amazon.com>
0 commit comments