Alex
Alex

Reputation: 4507

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?

Upvotes: 9

Views: 1557

Answers (1)

JeanMertz
JeanMertz

Reputation: 2270

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...

Upvotes: 5

Related Questions