Detecting a Memory Leak/Bloat of a Huge Code Base

Few weeks ago, I was maintaining a product with big traffic when I noticed that Nginx processes were eating up the server memory on random occasions. Nothing consistent, and the exact cause is totally unknown.

I initially thought this might be a memory leak, and I started doing memory profiling locally on my machine. I had no luck doing so, for several reasons, amongst of them: Huge code base and the testing environment was nothing like the production one in terms of data size and user base.

Then I thought why not treat the running process as a black box and try doing some linux stuff, so I logged the memory stats using this command:

Which dumps the size of the current request memory. It was good enough, but I used a better wrapper that helped me test on several platforms, using NewRelic code:

I waited for few hours and watched the memory consumed by the process after each request. Then I found out that I had a memory bloat, where the code was loading thousands of records due to wrong query.

It was a fun experiment, finding which request was eating the memory was a tedious task, but treating it as a black box turned out to be the right way to inspect it.

4 Replies to “Detecting a Memory Leak/Bloat of a Huge Code Base”

  1. Reward notes, maybe not considered element of Standard enjoy, are acquired by simply finishing meta-game quests around the video game such as accumulating the traditional ready’s murloc cards.

  2. В продаже аккаунты Facebook.com 2010 Instant, в наличии очень много подобных аккуантов / Can sell accounti Twitter.com PVA 2015 ready a lot of diverse accounts

    ICQ – 231538

    РУ
    Распродажа аки Twitter.com Profiled, аккуанты готовы + есть много подобных аккуантов, например – Mail.com, Yahoo.com PVA, Twitter.com 1000 Plus, AOL.com USA PVA и множество других.

    ICQ – 231538

    EN
    on sale accounts Gmx.com No SPAM, accounts have in stock + available a lot of diverse account, such – Google.com Voice HQ, Twitter.com 1000 Plus, Hotmail.com POP3, O2.pl and similar.

    ICQ – 231538

    В продаже акки Facebook.com PVA 2015, присутствуют очень много подобных акков ICQ – 231538 / available accounts karagany a great number other account ICQ – 231538

    купить mail.ru аккаунты, vkontakte.ru codi, купить mail, акки мамба, продам авторег аккаунты facebook, покупка анкет mamba, продам аккаунты gmail, продажа аккаунтов yandex.ru, продам раскрученные акки вконтакте, продам аккаунты в одноклассниках, магазин aol.com аккаунтов, купить аккаунты вконтакте

Leave a Reply

Your email address will not be published. Required fields are marked *