Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Manually run GC on reactor tick. #771
Conversation
erikjohnston
assigned
NegativeMjark
May 9, 2016
NegativeMjark
and 1 other
commented on an outdated diff
May 13, 2016
| @@ -182,6 +184,18 @@ def f(*args, **kwargs): | ||
| end = time.time() * 1000 | ||
| tick_time.inc_by(end - start) | ||
| pending_calls_metric.inc_by(num_pending) | ||
| + | ||
| + threshold = gc.get_threshold() | ||
| + counts = gc.get_count() | ||
| + | ||
| + start = time.time() * 1000 | ||
| + for i in [2, 1, 0]: | ||
| + if threshold[i] < counts[i]: | ||
| + logger.info("Collecting gc %d", i) | ||
| + gc.collect(i) | ||
| + end = time.time() * 1000 | ||
| + gc_time.inc_by(end - start) |
NegativeMjark
Contributor
|
|
this seems really weird - surely GCs can be very costly with lots of objects, especially for the higher generations? Why would you want to run it on every reactor tick? Wouldn't it be better to bump up the GC thresholds and just have the machine stop the world to GC once every few hours or whatever? |
|
@ara4n We check if we need to run the GC on each reactor tick, we don't necessarily do so. The check should be equivalent to the one done internally by python |
|
okay... but what is the rationale for doing so? (aka where are the comments?) |
|
Sure I can add a comment. It's mainly so that we can get some metrics over how long we spend GC'ing |
|
aaah! makes much more sense - thanks :) |
|
LGTM. Might want to be careful about merging this to make sure it doesn't end up on one of our servers by accident. |
erikjohnston commentedMay 9, 2016
This also adds a metric for amount of time spent in GC.