-
Notifications
You must be signed in to change notification settings - Fork 1
Architectural Challenges
Several architectural limitations have emerged as Firebolt adoption and API complexity continue to increase.
- Promise creation for every request
- Request correlation complexity
- Additional synchronization overhead
- Blocked application threads
- Increased complexity
- Reduced scalability
- More difficult lifecycle management
sequenceDiagram
participant App
participant Client
participant Gateway
participant Server
App->>Client: getProperty()
Client->>Gateway: invoke()
Gateway->>Gateway: Create Promise
Gateway->>Gateway: Store Promise by Request Id
Gateway->>Server: JSON-RPC Request
Note over App,Gateway: Application thread blocked waiting for response
Server-->>Gateway: JSON-RPC Response
Gateway->>Gateway: Lookup Promise
Gateway->>Gateway: Resolve Promise
Gateway-->>Client: Result
Client-->>App: Return Value
The Gateway owns a dedicated watchdog thread responsible for timeout monitoring. To support request timeout processing, the Gateway creates a dedicated watchdog thread during connection establishment. The watchdog periodically wakes at a configurable interval, scans pending requests, resolves expired operations, and removes completed entries from the correlation queue.
While this design successfully provides timeout monitoring, it introduces an unintended coupling between timeout processing and connection lifecycle management.
- Periodic queue scanning
- Dedicated thread lifecycle management
- Disconnect latency tied to timeout interval
sequenceDiagram
participant Client
participant Gateway
participant Watchdog
Client->>Gateway: connect()
Gateway->>Watchdog: Start Thread
loop Timeout Monitoring
Watchdog->>Watchdog: sleep_for(timeoutInterval)
Watchdog->>Gateway: Scan Pending Requests
end
Client->>Gateway: disconnect()
Gateway->>Watchdog: Request Shutdown
Note over Watchdog: Thread may still be sleeping
Watchdog->>Watchdog: Wake After Timeout
Watchdog->>Watchdog: Detect Shutdown
Watchdog-->>Gateway: Exit
Gateway-->>Client: Disconnect Complete
sequenceDiagram
participant App
participant Gateway
participant Watchdog
App->>Gateway: disconnect()
Gateway->>Watchdog: shutdown = true
rect rgb(255,240,240)
Note over Watchdog: Still sleeping
Note over Gateway: Waiting in join()
end
Watchdog->>Watchdog: sleep_for() expires
Watchdog->>Watchdog: Check shutdown flag
Watchdog-->>Gateway: Thread exits
Gateway-->>App: Disconnect Complete
Several APIs depend on external services:
- Authentication
- Token refresh
- Cloud communication
- Remote processing
Transport infrastructure continues managing these requests despite having no control over remote delays.
- Larger pending request queues
- Longer-lived promises
- Additional monitoring overhead