How aabolfazl/vortex works
Main Components
• Worker Processes: Represent each CPU core running an independent worker process. Each process includes an event loop that uses io_uring for asynchronous I/O.
• Listener/Acceptor: A shared listening socket that all worker processes use to accept new connections (reflected in the listener modules).
• Event Loop and I/O Handling: Central to each worker, this module handles io_uring-based event dispatching, illustrated by the components in src/event and src/core/io. Include submodules for io_uring_core, io_uring_dispacher_impl, and I/O handling for sockets.
• Load Balancing Core: This includes the balancer, cluster management (e.g., cluster and cluster_manager implementations in src/core/balancer), and the components responsible for distributing traffic, such as round-robin/least-connections algorithms.
• Network/Connection Management: Highlight the modules dealing with network connections like client_connection_impl, connection_factory, tcp connection pool implementations, and socket management components found in src/core/net and include/vortex/net.
• Configuration and Logging: Include the configuration management (YAML parser and configuration manager in src/core/config) and logging components (see src/core/logger).
Relationships and Interactions
• Within a Worker Process, illustrate the event loop receiving notifications from io_uring (as shown in src/event and core I/O directories), then forwarding these events to connection management and load balancer modules.
• Configuration module feeding parameters into the workers and load balancing logic.
• Backend interactions where the load balancer routes incoming traffic to available service nodes or backends, which are represented within the load balancing module and service node components.
Architectural Patterns
• Process-per-Core Model: Clearly represent each worker process as an independent unit, with a common shared component for incoming connections.
• Modular design: Note the separation of concerns among configuration, networking, balancing logic, and I/O handling.
Relevant Technologies and Libraries
• Modern C++ (C++17) for language specifics.
• io_uring for high-performance event handling.
• CMake as the build system.
• Configuration is managed via YAML (see config files and YAML parser in src/core/config).