Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed-up riemann-http-check with resolver and worker threads #254

Merged
merged 4 commits into from
Dec 22, 2022

Conversation

smortex
Copy link
Member

@smortex smortex commented Dec 21, 2022

IP addresses resolution and HTTP resources fetching are I/O bound. When testing a large amount of HTTP endpoints, this can be an issue. Some measurement we did for a use case show that checking 112 URI (most of them being serviced by 2 IP addresses) took 95 seconds.

Implement an address resolution queue and a working queue in order to parallelize tasks in multiple threads. With a default of 5 resolvers and 20 workers, our test case now completes in about 4 seconds, which is more than 23 times faster. These values can be tuned using the --resolvers and --workers new parameters.

While here, add metrics to track the resolvers and workers utilization and saturation.

IP addresses resolution and HTTP resources fetching are I/O bound. When
testing a large amount of HTTP endpoints, this can be an issue.  Some
measurement we did for a use case show that checking 112 URI (most of
them being serviced by 2 IP addresses) took 95 seconds.

Implement an address resolution queue and a working queue in order to
parallelize tasks in multiple threads.  With a default of 5 resolvers
and 20 workers, our test case now completes in about 4 seconds, which is
more than 23 times faster.  These values can be tuned using the
--resolvers and --workers new parameters.

While here, add metrics to track the resolvers and workers utilization and
saturation.
Some tools parse ARGV, and will not cope with parameters passed to
RSpec.

This allows runnning rspec with random parameters, e.g. `--fail-fast`.
@smortex smortex changed the title http check thread Add resolver and worker threads to http-check Dec 21, 2022
Style/RedundantRegexpEscape: Redundant escape inside regexp literal
Reusing the same port to run a second server just after the previous one
has been terminated sometimes fail with Errno::EADDRINUSE Address
already in use.

Start the server without setting a port so that the system pick up a
random one for us and use this port after.

This should make the test suite more reliable.
@smortex smortex added the enhancement New feature or request label Dec 21, 2022
@smortex smortex changed the title Add resolver and worker threads to http-check Add resolver and worker threads to riemann-http-check Dec 21, 2022
@smortex smortex changed the title Add resolver and worker threads to riemann-http-check Speed-up riemann-http-check with resolver and worker threads Dec 21, 2022
Copy link
Member

@jamtur01 jamtur01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jamtur01 jamtur01 merged commit 5bedf4b into main Dec 22, 2022
@smortex smortex deleted the http-check-thread branch December 22, 2022 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants