Integrate a wonderful library fast_float by Daniel Lemire.
It achieves x2 improvement on x86_64:
BM_ParseFastFloat 663 ns 663 ns 1049085
BM_ParseDoubleAbsl 1358 ns 1358 ns 523853
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
A regular DenseSet insertion first checks for uniqueness and then inserts a new element.
Sometimes we know that the new element is new and we can insert it without checking for
uniqueness first.
Also, pass hashcode into internal functions so we could save some hash calls.
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
* bug(server): global command stalls on server load with pipeline mode
fixes#1797
the bug: global command is not able to schedule into txq when high load pipelined commands. Only after the load finish the global transaction gets scheduled into the txq. The reason for this is when we start a global transaction we set the shard lock and all the transactions start to enter the txq. They compete with the global tx on the order they are inserted into the queue to preserve transaction atomicity. Because the global tx needs to be inserted to all shard queues its chance to schedule with order with all the other transactions is low.
the solution: lock the global transaction inside the schedule in shard, locking closer to scheduling decreases the number of transactions in the queue and the competition on ordering correctly has higher chance now.
Signed-off-by: adi_holden <adi@dragonflydb.io>
* bug(server): zadd wrong insert when non unique members
the bug: when calling zadd with non uniq members the server would result
in updating the zset with the higher score instead of the last score
given
f.e
zadd myzset 2 a 1 a
will result in member a score 2 while the expected 1
the fix: if the members in zadd command are not unique than we do not
sort the members. As a result in this case when we dont sort we will not have perfomace optimization on listpack.
Signed-off-by: adi_holden <adi@dragonflydb.io>
Check whether the key is the biggest one before doing the binary search.
Also, avoid using listpacks when we get lots of items to add to zset.
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
1. Cherry-pick changes from Redis 7 that encode integer scores more efficiently
2. Introduces optimization that first checks if the new element should be the last
for listpack sorted sets.
3. Consolidates listpack related constants and tightens usage for listpack.
4. Introduce MEMORY USAGE command.
5. Introduce a small delay before decommitting memory pages back to OS.
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
* feat(replication): Use a ring buffer with messages to serve replication.
* Fix libraries dep graph
* Address PR feedback
* nits
* add a comment
* Lower the default log length
* chore: Add a context manager to DflyInstance so we don't forget to close
them.
* Update tests/dragonfly/config_test.py
Co-authored-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Roy Jacobson <roi.jacobson1@gmail.com>
---------
Signed-off-by: Roy Jacobson <roi.jacobson1@gmail.com>
Co-authored-by: Roman Gershman <roman@dragonflydb.io>
* flags from env variables
* querying environment vars
* remove includes
* refactor
* exit for unknown flag with DFLY_ prefix
* reflecting change in the test
* better tests
* refactor + new test case
* refactor test with inner class
* refactor
* revert back test flags as it might affect ci/cd
* fixing flags
* refactor
* remove includes
* refactor