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

Investigate Feasibility of Using Cassandra-Based Distributed Locks vs. Java Lock Mechanisms for Thread Safety in the Agent #741

Closed
VictorCavichioli opened this issue Oct 13, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request PoC/Agent Tasks related to new generation of ecchronos as an agent

Comments

@VictorCavichioli
Copy link
Contributor

VictorCavichioli commented Oct 13, 2024

Story Description:

The current ecChronos sidecar utilizes distributed locks, implemented using Cassandra tables called lock and lock_priority, to manage task execution and synchronization across multiple nodes. This investigation seeks to determine if the same distributed locking mechanism can be applied within the agent, or whether Java-based locking mechanisms, such as ReentrantLock, can provide a more efficient and thread-safe solution.

The investigation must:

  1. Analyze the feasibility of using the current Cassandra-based distributed lock system (lock and lock_priority) for thread-safe operations within the agent.
  2. Explore alternatives like Java's built-in locking mechanisms (ReentrantLock, StampedLock, etc.) to improve thread safety and potentially simplify synchronization logic.
  3. Perform a performance comparison between the Cassandra-based distributed lock system and Java's native lock mechanisms to evaluate efficiency in various scenarios.
  4. Recommend and define the locking strategy to be implemented for thread safety across the project.

Acceptance Criteria:

  1. A detailed analysis of the Cassandra-based distributed locking mechanism's suitability for thread-safe operations in the agent.
  2. A thorough evaluation of Java's locking mechanisms, including ReentrantLock, for managing thread safety within the agent.
  3. Performance bench-marking between the two locking approaches (Cassandra locks vs. Java locks) under different load conditions.
  4. Recommendation for the locking mechanism to be used, including justification based on performance, simplicity, and maintainability.
  5. Implementation of the chosen locking mechanism in the relevant classes requiring thread-safe operations.
  6. Documentation and tests covering the new locking approach, ensuring thread safety across critical sections of the code.

Definition of Done:

  1. Completed investigation with a report outlining the strengths and weaknesses of Cassandra-based distributed locks vs. Java locking mechanisms.
  2. Clear performance comparison between the two locking approaches.
  3. Recommendation and justification for the locking mechanism to be used across the project.
  4. Implementation of the locking mechanism in all necessary classes.
  5. Performance tests that simulate real-world load and measure the impact of both locking approaches.
  6. Code review completed, ensuring thread-safe functionality is added without regression or performance degradation.
  7. Unit and integration tests created to validate thread safety and correct lock behavior.

Notes:

  • Consider edge cases such as lock contention, deadlocks, and distributed vs. single-node scenarios.
  • Ensure that performance tests simulate real-world multi-threaded and multi-node environments.
  • If switching to Java locks, consider the impact on distributed systems and synchronization across nodes.

Related with #652

@VictorCavichioli VictorCavichioli added enhancement New feature or request PoC/Agent Tasks related to new generation of ecchronos as an agent labels Oct 13, 2024
@SajidRiaz138 SajidRiaz138 self-assigned this Oct 25, 2024
SajidRiaz138 added a commit that referenced this issue Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PoC/Agent Tasks related to new generation of ecchronos as an agent
Projects
None yet
Development

No branches or pull requests

2 participants