equal
deleted
inserted
replaced
64 |
64 |
65 // Perform GC if timer has expired. |
65 // Perform GC if timer has expired. |
66 const double time_since_last_gc = ZStatCycle::time_since_last(); |
66 const double time_since_last_gc = ZStatCycle::time_since_last(); |
67 const double time_until_gc = ZCollectionInterval - time_since_last_gc; |
67 const double time_until_gc = ZCollectionInterval - time_since_last_gc; |
68 |
68 |
69 log_debug(gc, director)("Rule: Timer, Interval: %us, TimeUntilGC: %.3lfs", |
69 log_debug(gc, director)("Rule: Timer, Interval: %us, TimeUntilGC: %.3fs", |
70 ZCollectionInterval, time_until_gc); |
70 ZCollectionInterval, time_until_gc); |
71 |
71 |
72 return time_until_gc <= 0; |
72 return time_until_gc <= 0; |
73 } |
73 } |
74 |
74 |
131 // We also deduct the sample interval, so that we don't overshoot the target |
131 // We also deduct the sample interval, so that we don't overshoot the target |
132 // time and end up starting the GC too late in the next interval. |
132 // time and end up starting the GC too late in the next interval. |
133 const double sample_interval = 1.0 / ZStatAllocRate::sample_hz; |
133 const double sample_interval = 1.0 / ZStatAllocRate::sample_hz; |
134 const double time_until_gc = time_until_oom - max_duration_of_gc - sample_interval; |
134 const double time_until_gc = time_until_oom - max_duration_of_gc - sample_interval; |
135 |
135 |
136 log_debug(gc, director)("Rule: Allocation Rate, MaxAllocRate: %.3lfMB/s, Free: " SIZE_FORMAT "MB, MaxDurationOfGC: %.3lfs, TimeUntilGC: %.3lfs", |
136 log_debug(gc, director)("Rule: Allocation Rate, MaxAllocRate: %.3fMB/s, Free: " SIZE_FORMAT "MB, MaxDurationOfGC: %.3fs, TimeUntilGC: %.3fs", |
137 max_alloc_rate / M, free / M, max_duration_of_gc, time_until_gc); |
137 max_alloc_rate / M, free / M, max_duration_of_gc, time_until_gc); |
138 |
138 |
139 return time_until_gc <= 0; |
139 return time_until_gc <= 0; |
140 } |
140 } |
141 |
141 |
160 const size_t used = ZHeap::heap()->used(); |
160 const size_t used = ZHeap::heap()->used(); |
161 const double time_since_last_gc = ZStatCycle::time_since_last(); |
161 const double time_since_last_gc = ZStatCycle::time_since_last(); |
162 const double time_since_last_gc_threshold = 5 * 60; // 5 minutes |
162 const double time_since_last_gc_threshold = 5 * 60; // 5 minutes |
163 if (used < used_threshold && time_since_last_gc < time_since_last_gc_threshold) { |
163 if (used < used_threshold && time_since_last_gc < time_since_last_gc_threshold) { |
164 // Don't even consider doing a proactive GC |
164 // Don't even consider doing a proactive GC |
165 log_debug(gc, director)("Rule: Proactive, UsedUntilEnabled: " SIZE_FORMAT "MB, TimeUntilEnabled: %.3lfs", |
165 log_debug(gc, director)("Rule: Proactive, UsedUntilEnabled: " SIZE_FORMAT "MB, TimeUntilEnabled: %.3fs", |
166 (used_threshold - used) / M, |
166 (used_threshold - used) / M, |
167 time_since_last_gc_threshold - time_since_last_gc); |
167 time_since_last_gc_threshold - time_since_last_gc); |
168 return false; |
168 return false; |
169 } |
169 } |
170 |
170 |
173 const AbsSeq& duration_of_gc = ZStatCycle::normalized_duration(); |
173 const AbsSeq& duration_of_gc = ZStatCycle::normalized_duration(); |
174 const double max_duration_of_gc = duration_of_gc.davg() + (duration_of_gc.dsd() * one_in_1000); |
174 const double max_duration_of_gc = duration_of_gc.davg() + (duration_of_gc.dsd() * one_in_1000); |
175 const double acceptable_gc_interval = max_duration_of_gc * ((assumed_throughput_drop_during_gc / acceptable_throughput_drop) - 1.0); |
175 const double acceptable_gc_interval = max_duration_of_gc * ((assumed_throughput_drop_during_gc / acceptable_throughput_drop) - 1.0); |
176 const double time_until_gc = acceptable_gc_interval - time_since_last_gc; |
176 const double time_until_gc = acceptable_gc_interval - time_since_last_gc; |
177 |
177 |
178 log_debug(gc, director)("Rule: Proactive, AcceptableGCInterval: %.3lfs, TimeSinceLastGC: %.3lfs, TimeUntilGC: %.3lfs", |
178 log_debug(gc, director)("Rule: Proactive, AcceptableGCInterval: %.3fs, TimeSinceLastGC: %.3fs, TimeUntilGC: %.3fs", |
179 acceptable_gc_interval, time_since_last_gc, time_until_gc); |
179 acceptable_gc_interval, time_since_last_gc, time_until_gc); |
180 |
180 |
181 return time_until_gc <= 0; |
181 return time_until_gc <= 0; |
182 } |
182 } |
183 |
183 |
196 const size_t used = ZHeap::heap()->used(); |
196 const size_t used = ZHeap::heap()->used(); |
197 const size_t free_with_reserve = max_capacity - used; |
197 const size_t free_with_reserve = max_capacity - used; |
198 const size_t free = free_with_reserve - MIN2(free_with_reserve, max_reserve); |
198 const size_t free = free_with_reserve - MIN2(free_with_reserve, max_reserve); |
199 const double free_percent = percent_of(free, max_capacity); |
199 const double free_percent = percent_of(free, max_capacity); |
200 |
200 |
201 log_debug(gc, director)("Rule: High Usage, Free: " SIZE_FORMAT "MB(%.1lf%%)", |
201 log_debug(gc, director)("Rule: High Usage, Free: " SIZE_FORMAT "MB(%.1f%%)", |
202 free / M, free_percent); |
202 free / M, free_percent); |
203 |
203 |
204 return free_percent <= 5.0; |
204 return free_percent <= 5.0; |
205 } |
205 } |
206 |
206 |