Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAFT #82

Open
smeadows-okta opened this issue Jun 26, 2024 · 2 comments
Open

RAFT #82

smeadows-okta opened this issue Jun 26, 2024 · 2 comments

Comments

@smeadows-okta
Copy link

smeadows-okta commented Jun 26, 2024

I need to run within single node and multi-node environment without reconfiguring. The following messages occur during single node environment and no caching is happening

2024-06-26T16:32:52.327-0400 [INFO] raft: initial configuration: index=1 servers="[{Suffrage:Voter ID:01J1B3A78G06A0HWM86QZYAVB8 Address:localhost:7481}]"

2024-06-26T16:32:52.327-0400 [INFO] raft: entering follower state: follower="Node at 127.0.0.1:7481 [Follower]" leader-address= leader-id=

2024-06-26T16:32:55.204-0400 [WARN] raft: heartbeat timeout reached, not part of a stable configuration or a non-voter, not triggering a leader election

2024/06/26 17:11:14 deleted key 3491595662
2024/06/26 17:11:14 1 keys sampled, 1 keys deleted
2024/06/26 17:11:14 deletion ratio (100 percent) reached threshold (20 percent), sampling again

can you explain EvictionInterval, EvictionSample, and SET EX and how they relate to each other.
i have 64mb cache allocated, and the cache contain 2 messages of 1024. Please explain deletion ratio (100 percent) reached threshold (20 percent), sampling again

@kelvinmwinuka
Copy link
Collaborator

kelvinmwinuka commented Jun 27, 2024

Hi @smeadows-okta could you please share your configurations so I can attempt to reproduce this?

  1. EvictionInterval determines the interval between attempts to evict expired keys.
  2. EvictionSample is the number of keys that will be checked for expiry when the node is attempting evicting keys.
  3. SET EX allows you to create a key and define its expiry/TTL at the same time. This particular variant sets the number the keys TTL in seconds.

During this sampling, if enough keys are expired and evicted, then the eviction sampling will immediately run again without waiting for the interval. This process continues until the number of evicted keys is below the threshold (in this case, 20 percent of total keys) or there are no more keys left to evict (because the store is empty).

In your example, it seems the 2 keys you set where evicted upon expiry, and because you only had to keys, that was a 100 percent eviction rate so the eviction sampling was restarted. The next round of resampling would have no more keys to delete so the sampling will return to waiting for the interval.

@smeadows-okta
Copy link
Author

smeadows-okta commented Jul 2, 2024

I've allocated 32MB
config := echovault.DefaultConfig()
config.BootstrapCluster = true
config.MaxMemory = 32 << 20
config.EvictionPolicy = "allkeys-lru"
config.DataDir = "/var/echovault"

it appears EchoVault runs standalone or raft mode. In raft mode, when no other node can be contacted with in specified time, no caching can occur?  Also, I think some of the Raft configuration options should be exposed, especially time frame it takes nodes to form a consensus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants