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

Connection pool mechanism #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pavlua
Copy link
Collaborator

@pavlua pavlua commented Feb 12, 2024

  • added a few non-breaking changes in Box/IBox public interface (Do-methods and ConnectionGoesDown event handler), which are required for pooling implementation
  • ConnectionPool class implemented, user can work with multiple instances of Tarantool in unified way (and use RequestMode to control request routing to ro/rw instances)
  • ConnectionPool use round robin logic
  • ConnectionPool use abstraction ITarantoolNodesSource in initial filling, so user can easily change the source of Tarantool nodes: config, etcd, etc
  • ConnectionPool has autoreconnection logic: if node went down, it eliminates from pool, and special background reconnector starts to monitor its state and try to return it to pool back
  • unit tests
  • minor file reorganization: classes that implements inner Box machinery moved into Core folder

what is not implemented yet

  • readme updates with example(s)
  • monitoring of ro/rw state of nodes (ro can become rw after autofailover for example, ConnectionPool should update its state)
  • autorenewal of nodes in pool, by timer for example (we can use ITarantoolNodesSource abstraction)
  • zones/distances feature: ability to assign a zone/distance to each node and instruct pool to use the closest nodes as possible

- ConnectionPool class implemented, user can work with multiple instances of Tarantool in unified way (and use RequestMode to control request routing to ro/rw instances)
- ConnectionPool use round robin logic
- ConnectionPool use abstraction ITarantoolNodesSource in initial filling, so user can easily change the source of Tarantool nodes: config, etcd, etc
- ConnectionPool has autoreconnection logic: if node went down, it eliminates from pool, and special background reconnector starts to monitor its state and try to return it to pool back
- unit tests

what is not implemented yet
- readme updates with example(s)
- monitoring of ro/rw state of nodes (ro can become rw after autofailover for example, ConnectionPool should update its state)
- autorenewal of nodes in pool, by timer for example (we can use ITarantoolNodesSource abstraction)
- zones/distances feature: ability to assign a zone/distance to each node and instruct pool to use the closest nodes as possible
[InlineData(RequestMode.Rw, 2, 2, 0)]
[InlineData(RequestMode.PreferRo, 2, 0, 2)]
[InlineData(RequestMode.PreferRw, 2, 2, 0)]
public async Task PoolWithRoAndRw_AllRequestModes_WorksCorrectly(RequestMode requestMode,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky test. For some reason sometimes this test fails with null-reference here

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

Successfully merging this pull request may close these issues.

2 participants