Comments (9)
It looks as though it only hits the apr_sleep(wait)
call if it's "deaf". If so, it would probably be better done as:
debug_msg("Starting TCP listener thread...");
if(!deaf)
{
for(;!done;)
{
now = apr_time_now();
/* Pull in incoming data */
poll_tcp_listen_channels(wait, now);
apr_sleep( wait );
}
}
else
{
/* Do nothing or something else here */
}
from monitor-core.
poll_tcp_listen_channels(wait, now)
actually times out after wait
microseconds, does it not? Adding an apr_sleep(wait)
call would just double the interval, which would cut the CPU usage in half. I'd have expected the timeout to just be set to something more sensible, like 1 second.
from monitor-core.
I think this was meant to be a 1 second timeout but I might have misread the API docs for apr_interval_time_t
as @psobot suggested. Would 100ms be a more sensible value or should we go for the full 1 second?
Alternatively, the TCP listener thread could not be started at all if the gmond is configured to be deaf.
/* Create TCP listener thread */
if(!deaf)
{
apr_thread_t *thread;
if (apr_thread_create(&thread, NULL, tcp_listener, NULL, global_context) != APR_SUCCESS)
{
err_msg("Failed to create TCP listener thread. Exiting.\n");
exit(1);
}
}
from monitor-core.
Forgive my ignorance, but why is this function polling in the first place? It's waiting on a TCP connection and re-checking every n µs to see if one has arrived... but if it's in a separate thread, couldn't that thread just block until connection arrives? (The apr docs suggest that a negative timeout will block indefinitely, which would work in this case.)
from monitor-core.
If the TCP thread blocks until a connection arrives then the TCP thread will prevent the gmond from reloading its config due to a SIGHUP or exiting due to any other signal interrupt. I think we should increase the timeout to 500ms or so and not even start the TCP thread if the gmond is in deaf mode.
from monitor-core.
I agree on not starting the TCP thread if gmond is in deaf mode. 500ms may be too large. I'd go for say 100ms. @psobot can you test with value of 100ms and see if CPU utilization is greatly diminished. Thank you.
from monitor-core.
@satterly - Good point.
@vvuksan - Quick testing results on my laptop, as reported by ps
:
Timeout: 1000 (1ms) => 1.2% CPU
Timeout: 100000 (100ms) => 0.1% CPU
Timeout: 500000 (500ms) => 0.0% CPU
from monitor-core.
Is there consensus here?
from monitor-core.
I'd go for 100ms.
from monitor-core.
Related Issues (20)
- Does the gmond support dynamic python module updating?
- error on the wiki page for value_treshhold
- ganglia-config should not return *all* CFLAGS/Fully support alternate SunRPC implementation like libtirpc
- bus error is occuring on gmetad on RHEL7 (built from "master")
- Need unique names for many small clusters in unicast send-only configuration
- with gmond 3.7.1 ,cannot create udp client if band_hostname is on.
- Ganglia Missing Metrics for Some Nodes
- Links in Wiki broken
- Migrate LGTM.com installation from OAuth to GitHub App
- does it plan to have a new release?
- Anybody built a working RPM for CentOS 8? HOT 1
- Small values bytes_in/bytes_out after week work
- memory leak
- Questions about abnormalities in the passive close of gmond HOT 1
- gmetad 3.7.2 service causes IO hangs HOT 1
- gmond/ganglia not starting with systemd HOT 2
- python_modules not installed
- trouble,what can i do? thank you for help! HOT 1
- undeclared functions in libmetrics/darwin/metrics.c
- default conf file missing in ganglia-monitor 3.7.2-6 (in Ubuntu 22)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monitor-core.