This commit introduces an enhancement to the proxy server's request processing mechanism by integrating a fixed-size thread pool, leveraging the concurrent-ruby gem. This change aims to improve the efficiency and stability of handling concurrent HTTP requests.
Key Changes:
Added Concurrent::FixedThreadPool to manage concurrent execution of request processing tasks.
Set the default thread pool size to 10, optimizing resource utilization and ensuring that the server can handle multiple requests simultaneously without overwhelming system resources. It can be changed depending on the situation. For semplicity purposes, I set it as fixed.
Enabled configuration of the thread pool size through the initialization options, allowing users to specify a custom size based on specific use cases or system capabilities. This flexibility ensures that the server can be tailored to different environments and workloads.
Usage:
The thread pool size can be customized by passing an additional option :thread_pool_size when initializing the proxy server. If not specified, the default size of 10 is used. This approach allows for easy adjustments to the concurrency level, accommodating both lightweight testing environments and more demanding production scenarios.
This commit introduces an enhancement to the proxy server's request processing mechanism by integrating a fixed-size thread pool, leveraging the
concurrent-ruby
gem. This change aims to improve the efficiency and stability of handling concurrent HTTP requests.Key Changes:
Concurrent::FixedThreadPool
to manage concurrent execution of request processing tasks.Usage: The thread pool size can be customized by passing an additional option
:thread_pool_size
when initializing the proxy server. If not specified, the default size of 10 is used. This approach allows for easy adjustments to the concurrency level, accommodating both lightweight testing environments and more demanding production scenarios.Example:
I hope you will find this helpful, I wish you a wonderful day!