<@U0A71G31CDV> - an application connecting from a ...
# questions-and-troubleshooting
a
@Rocky - an application connecting from a dedicated service account to starrocks 3.5.20 that runs in shared-data mode is getting periodic error "error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool." What can be done to resolve this issue?
✅ 1
r
The error message "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool" is a client-side error (common in .NET, JDBC, and other connection poolers). It indicates that the application's internal connection pool is exhausted, and no connection became available within the configured timeout period. While the error originates in your application, it is often triggered by server-side bottlenecks or configuration limits in StarRocks. To resolve this in StarRocks 3.5.20 (shared-data mode), follow these steps: 1. Check User-Specific Connection Limits Since you mentioned a dedicated service account, check if there is a per-user connection limit. StarRocks allows restricting the number of concurrent connections for a specific user. * Check limit:
SHOW PROPERTY FOR 'your_service_account';
* Increase limit: If
max_user_connections
is set low, increase it:
Copy code
sql
    ALTER USER 'your_service_account' SET PROPERTIES ("max_user_connections" = "2000");
2. Verify Global Connection Limits (
qe_max_connection
)
StarRocks FEs have a global limit on concurrent MySQL connections. In version 3.5.x, the default is 4096. * Check current connections: Run
SHOW PROCESSLIST;
or check the
starrocks_fe_query_resource_group_running_queries
metric. * Check FE config: Run
ADMIN SHOW CONFIG LIKE 'qe_max_connection';
* Solution: If you are hitting this limit, increase it in `fe.conf`:
Copy code
properties
    qe_max_connection = 8192
(Note: This requires an FE restart.) 3. Enable NIO for MySQL Service In high-concurrency environments, the default blocking I/O for MySQL connections can cause bottlenecks in the FE. Enabling Netty-based Non-blocking I/O (NIO) improves the FE's ability to handle many concurrent connections. * Edit `fe.conf`:
Copy code
properties
    mysql_service_nio_enabled = true
(Note: This requires an FE restart.) 4. Optimize Shared-Data FE Metadata Pressure In shared-data mode, the FE performs extra work for tablet metadata management and compaction scheduling. If the FE is under heavy load (high CPU or JVM GC), connection handshakes may time out. * Monitor FE JVM: Check for frequent "Stop the World" GC pauses. * Publish Version Threads: If you have high-frequency ingestion, increase the threads available for version publishing in `fe.conf`:
Copy code
properties
    lake_publish_version_max_threads = 1024
5. Application-Side Troubleshooting If StarRocks appears healthy, the issue likely resides in the application's connection management: * Connection Leaks: Ensure the application always closes or returns connections to the pool in a
finally
block. * Increase Pool Size: Increase the
Max Pool Size
in your application’s connection string (e.g.,
Max Pool Size=200;
). * Increase Timeout: Increase the
Connection Timeout
or
Connect Timeout
in the connection string to allow more time for a connection to become available during spikes. Summary Checklist 1. Run
SHOW PROCESSLIST
to see if connections are stuck in a
Sleep
state (leak) or running slow queries. 2. Increase
max_user_connections
for the service account. 3. Set
mysql_service_nio_enabled = true
in
fe.conf
. 4. Increase the application's
Max Pool Size
. References • faq/shared_data_faq.md • quick_start/shared-data.md