As a result, the amount of memory the application uses throughout its life cycle becomes abnormal, impacting its performance. Memory bloating arises when memory allocation sharply increases in an application. Before we get to the building part, let's introduce memory bloating and a note on a process's memory usage. One can think that a good start is to look at the process' memory usage, which would provide us with a good indicator of our code's memory usage and that's what we will be doing. With that behavior in mind, we challenged ourselves to come up with a much simpler solution. It all sounds very complex and precisely what our observability service should be doing instead.Īt BetterUp, one of our high-impact behavior is “Do Less, Deliver More”. We could tap into Ruby C API and have a sophisticated solution based on Ruby's internal object lifecycle events and use rb_tracepoint_new ( source) to register a new listener. The question becomes, how can we circumvent this overhead? Can we build a simple tool that might not be perfect but provides valuable insights into memory allocation? And there lies your good old friend, C. Those tools, however, have some limitations and are often used for one-off use or as needed, and are not recommended for always-on use on production because of their added overheard. There are a few different tools (gems) that can help profile Ruby code. The lack of memory profiling for Ruby comes as a regression for us, given that our current tool gives us insights into memory usage.Īs a first step, one could manually start tracking memory usage and report it to any observability service. At this time, Datadog does not have first-class support for memory profiling in Ruby applications. At BetterUp, we have consolidated a few observability tools into one vendor, Datadog. If your observability service gives you that number, you are off to the races if not, you are on a new journey. The quest to come up with that number per a given task is a challenge on its own when you want to debug your production application. The amount of memory an application consumes is fundamental to investigating memory bloating.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |