Skip to content

FOX-3833 - Connection pooling#51

Merged
PawelKlapec merged 5 commits into
masterfrom
connection-pooling
May 6, 2026
Merged

FOX-3833 - Connection pooling#51
PawelKlapec merged 5 commits into
masterfrom
connection-pooling

Conversation

@PawelKlapec
Copy link
Copy Markdown
Contributor

@PawelKlapec PawelKlapec commented May 4, 2026

This pull request introduces major improvements to MySQL connection pooling, updates documentation, and upgrades the development and test environments. The most significant change is the introduction of a robust, configurable connection pool implementation (MysqlConnectionPool), with enhanced lifecycle management and monitoring support. The Connector class is refactored to use this new pool, and the documentation is updated to reflect new pooling behaviors, configuration options, and metrics publishing features. Additionally, the development stack is modernized by upgrading Ruby and MySQL versions.

MySQL Connection Pooling Enhancements

  • Added a new MysqlFramework::MysqlConnectionPool class implementing connection pooling using the connection_pool gem, with support for pool sizing, timeouts, idle connection reaping, and connection sanitization before checkout. This enables robust, thread-safe pooling and automatic cleanup of idle connections. (lib/mysql_framework/mysql_connection_pool.rb lib/mysql_framework/mysql_connection_pool.rbR1-R176)
  • Refactored MysqlFramework::Connector to delegate all pooling logic to the new pool class, simplifying its methods and improving reliability for checking out, checking in, and using MySQL clients. (lib/mysql_framework/connector.rb lib/mysql_framework/connector.rbR3-L123)

Documentation Updates

  • Expanded the README.md to document all new pooling environment variables, updated usage examples for all connector methods, and added detailed warnings about thread-local connection reuse and sanitization. (README.md [1] [2] [3] [4]
  • Added documentation for the new MysqlFramework::Stats::AwsMetricPublisher class, which publishes pool metrics to AWS CloudWatch, and explained how to customize metric dimensions and namespace. (README.md README.mdL283-R367)

Development and Test Environment Modernization

  • Upgraded Ruby to version 4.0 and MySQL to version 8.0 in both GitHub Actions and Docker Compose environments, ensuring compatibility with modern dependencies and features. (.github/workflows/rspec.yml [1] [2]; docker-compose.yml [3] [4]
  • Updated dependencies in the Gemfile, bumping simplecov to the latest version and adding the debug gem for improved debugging during development and testing. (Gemfile GemfileL10-R11)

Other Notable Improvements

  • Improved connection and result management in all query methods to avoid resource leaks and ensure proper cleanup, especially when using pooled connections. (lib/mysql_framework/connector.rb lib/mysql_framework/connector.rbR3-L123)
  • Removed the legacy code coverage step from the GitHub Actions workflow. (.github/workflows/rspec.yml .github/workflows/rspec.ymlL22-L37)

@PawelKlapec PawelKlapec self-assigned this May 5, 2026
@PawelKlapec PawelKlapec merged commit e1a0882 into master May 6, 2026
1 check passed
@PawelKlapec PawelKlapec deleted the connection-pooling branch May 6, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants