Commit graph

29 commits

Author SHA1 Message Date
Kostas Kyrimis
267d5ab370
chore: remove DbSlice mutex and add ConditionFlag in SliceSnapshot (#4073)
* remove DbSlice mutex
* add ConditionFlag in SliceSnapshot
* disable compression when big value serialization is on
* add metrics

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-12-05 13:24:23 +02:00
Roman Gershman
84e22aa658
chore: remove ToUpper calls in main_service (#3947)
* chore: remove ToUpper calls in main_service

Also, test for IsPaused() first to avoid doing more checks for common-case.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-18 14:04:47 +00:00
adiholden
4d38271efa
feat(server): introduce rss oom limit (#3702)
* introduce rss denyoom limit

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-09-22 13:28:24 +03:00
Roman Gershman
93f6773297
chore: reduce pipelining latency by reusing existing shard fibers (#3494)
* chore: reduce pipelining latency by reusing existing shard fibers

To prove the benefits, run `./dfly_bench --pipeline=50   -n 20000  --ratio 0:1  --qps=0  --key_maximum=1`
Before: the average pipelining latency was 10ms
After: the average pipelining latency is 5ms.
Avg latency: pipelined_latency_usec / total_pipelined_squashed_commands

Also, improved counting of squashed commands - to count actual squashed ones.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-14 14:45:54 +03:00
Vladislav
82298b8122
fix(server): Implement SCRIPT GC command (#3431)
* fix(server): Implement SCRIPT GC command
2024-08-02 23:49:51 +03:00
Vladislav
fbc55bb82d
feat(transaction): Idempotent callbacks (immediate runs) (#2453)
This commit generalizes the machanism of running transaction callbacks during scheduling, removing the need for specialized ScheduleUniqueShard/RunQuickie. Instead, transactions can be run now during ScheduleInShard - called "immediate" runs - if the transaction is concluding and either only a single shard is active or the operation can be safely repeated if scheduling failed (idempotent commands, like MGET).

Updates transaction stats to mirror the new changes more closely.

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-04-03 23:06:57 +03:00
Kostas Kyrimis
7d093460f0
fix(ci): malloc trim on sanitizers workflow (#2794)
* remove malloc_trim from sanitizers build
2024-03-30 21:52:43 +02:00
Shahar Mike
d8ce011749
feat(server): Add metric for RDB save duration. (#2768)
* feat(server): Add metric for RDB save duration.

This tracks both saving to RDB files, DFS files and full sync
replication.

* Add rdb_save_count
2024-03-26 12:47:18 +02:00
Roman Gershman
b38024ba4f
chore: add malloc-based stats and decommit (#2692)
* chore: add malloc-based stats and decommit

Provides more stats and control with glibc-malloc based allocator.
For example,
with v1.15.0 (--proactor_threads=2), empty database, `info memory`returns

```
used_memory:614576
used_memory_human:600.2KiB
used_memory_peak:614576
used_memory_peak_human:600.2KiB
used_memory_rss:19922944
used_memory_rss_human:19.00MiB
```

then during `memtier_benchmark  -n 300000  --key-maximum 100000 --ratio 0:1 --threads=30 -c 100` (i.e GET-only with 3k connections):

```
used_memory:614576
used_memory_human:600.2KiB
used_memory_peak:614576
used_memory_peak_human:600.2KiB
used_memory_rss:59985920
used_memory_rss_human:57.21MiB
used_memory_peak_rss:59985920
```

connections overhead grows by ~39MB.
when the traffic stops, `used_memory_rss_human` becomes `30.35MiB`
and we do not know where 11MB gets lost and `MEMORY DECOMMIT` does not reduce the RSS.

With this change, `memory malloc-stats` return during the memtier traffic
```
malloc arena: 394862592
malloc fordblks: 94192
```
i.e. 395MB virtual memory was allocated by malloc and only 94KB is chunks available for reuse.
395MB is arena virtual memory, and not RSS obviously, but at least we have some visibility into malloc reservations.
The RSS usage is the same ~57MB and the difference between virtual and RSS is due to the fact we reserve fiber stacks of size 131KB but we touch less.
After the traffic stops, `arena` is reduced to 134520832 bytes, and fordblks are 133016592, i.e. majority of reserved ranges are also free (available to reuse) in the malloc pools.
RSS goes down similarly to before to ~31MB.

So far, this PR only demonstrated the increased visibility to mmapped ranges reserved by glibc malloc.
The additional functional change is in `MEMORY DECOMMIT` that now trims malloc RSS usage from reserved but unused (fordblks) pages
by calling `malloc_trim`.
After the call, RSS is: `used_memory_rss_human:20.29MiB` which is almost the same as when we started the empty process.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>

* chore: fix build for older glibc environments

Disable these extensions for alpine and use legacy version
for older glibc libraries.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-06 13:11:44 +00:00
Roman Gershman
0c1150956b
chore: add oom stats to /metrics (#2680)
* chore: add oom stats to /metrics

Expose oom/cmd errors when we reject executing a command if we reached OOM state (controlled by oom_deny_ratio flag).
Expose oom/insert errors when we do not insert a new key or do not grow a dashtable (controlled by table_growth_margin).

Move OOM command check to a place that covers all types of transactions - including multi and squashing transactions. 
 
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-03 18:01:21 +00:00
Vladislav
815976c9dc
chore: Remove manual memory management from stats (#2550)
Simplift stats memory management

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-02-10 10:30:30 +03:00
Vladislav
83a12b99c6
fix: fix interpreter acquisition with MULTI (#2549)
* fix: fix interpreter acquisition with MULTI

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-02-06 12:54:14 +02:00
s-shiraki
73fe5a4eb2
fix(server): Implement SCRIPT FLUSH command (#2493)
* fix(server): Implement SCRIPT FLUSH command
2024-01-31 08:31:06 +02:00
Vladislav
07a6dc0712
feat(transaction): Independent out of order execution (#2426)
Previously, transactions would run out of order only when all shards determined that the keys locks were free. With this change, each shard might decide to run out of order independently if the locks are free. COORD_OOO is now deprecated and the OUT_OF_ORDER per-shard flag should is used to indicate it

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-01-22 10:38:10 +03:00
Kostas Kyrimis
c8871896d7
fix: access to wrong thread local after command migrates fiber to a different thread (#2410)
* fix: access to wrong thread local after command migrates fiber to a different
thread
2024-01-17 08:19:10 +02:00
Roman Gershman
bd7a02d474
feat: track differrent patterns of multi/exec transactions (#2334)
* feat: track differrent patterns of multi/exec transactions

This information is exposed via "DEBUG EXEC" command.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>

* chore: address comments + add basic squasher stats

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-25 12:22:24 +02:00
Roman Gershman
bbe3d9303b
feat: introduce transaction statistics in the info output (#2328)
1. How many transactions we processed by type
2. How many transactions we processed by width (number of unique shards).

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-23 13:18:49 +02:00
Vladislav
11ef6623dc
feat: DispatchTracker to replace everything (#2179)
* feat: DispatchTracker

Use a DispatchTracker to track ongoing dispatches for commands that change global state

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-12-05 11:02:11 +03:00
Roman Gershman
0c5bb7b894
fix: regression test failures (#2226)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-11-27 21:41:52 +02:00
adiholden
c95f4961be
fix(server): client pause fix on pipeline squash (#2180)
* fix(server): client pause fix on pipeline squash

allow squashing commands on pause
move await on client pause inside InvokeCommand - this way all flows of command invoke will read pause state

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-11-16 13:30:02 +02:00
Roy Jacobson
c3a2da559e
feat(server): Implement CLIENT PAUSE (#1875)
* feat(server): Implement CLIENT PAUSE

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-11-15 08:56:49 +02:00
Vladislav
e84d9a65d8
fix(server): Add additional metrics (#1975)
* fix(server): Clean up metrics collection
* feat(server): Replication memory metrics
* fix(server): Limit dispatch queue size

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-10-06 14:16:22 +03:00
Kostas Kyrimis
898061d738
feat(AclFamilly): add acl list command (#1722)
* Add acl-family source and header
* Add `ACL LIST` command
* Add a simple test to check the default user
2023-08-22 15:33:14 +00:00
adiholden
116934b008
feat(server): add oom guard (#1650)
1. add flag maxmemory_ratio
2. When current used memory * maxmemory_ratio > maxmemory_limit denyoom
   commands will return oom error.

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-08-08 23:26:35 +03:00
Roy Jacobson
7adf3799f0
feature(server): Bring back inline scheduling (#1130)
* feat: run tx-schedule inline if the dest shard is on the same thread (#908)

The optimization is applied within ScheduleSingleHop call.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>

* fix(server): Don't inline schedule when in LOADING

* Fix the another pre-emption bug with inline scheduling

* Better locking around journal callbacks

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Co-authored-by: Roman Gershman <roman@dragonflydb.io>
2023-05-21 10:10:38 +03:00
Roman Gershman
bac9180602 chore: change thread_local to __thread when possible.
This should reduce the access cost to thread_local objects.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-03-12 21:57:56 +02:00
Roman Gershman
8cf8115116
chore(server): pass coordinator thread to a transaction object (#905)
This should help with some of the optimizations we may do in the future.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-03-03 14:40:29 +02:00
Roman Gershman
6f1e49120e
feat(server): track pipeline requests cache capacity (#776)
1. now pipeline_cache_capacity tracks how many bytes are allocated via free_req_pool_ cache.
   it's been shown now via "pipeline_cache_bytes" stat in "info memory" command.
2. a small refactoring of server_state code into server_state.cc
3. Reduce dependency of dfly_transaction on facade lib.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-02-12 11:58:21 +02:00
Boaz Sade
c9f7cbe0e9
Monitor command (#427)
feat(server): support monitor command - allowing user to debug commands
from all connections by using a connection as monitors for the this
(#344)

Signed-off-by: Boaz Sade <boaz@dragonflydb.io>
2022-10-24 18:29:34 +03:00