Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby: can GC::Profiler.enable in production environment cause performance issue?

Can activating the GC::Profiler in ruby 1.9.2 in a production environment can cause performance issue? Is it safe to use it in a performance critical production application?

like image 450
Alex Avatar asked Jun 28 '12 14:06

Alex


1 Answers

Simply activating GC::Profiler shouldn't cause a performance drop, the question is however what you plan to do with it.

Compare it with Rails.config.log_level. If you set this too high (like :notice), it needs to write a lot of data to the log file, causing a much higher IO than needed and thus causing performance drops. That is why the logger is set to :debug in production, to minimize IO operations.

So if you enable GC::Profiler and only poll specific results in edge-case scenarios then I don't believe there should be a problem, it is when you start to overuse the profiler that things can start to slow down.

but this goes for everything, from overusing database queries, to overusing complex code to overusing images, etc...

like image 93
JeanMertz Avatar answered Sep 28 '22 18:09

JeanMertz