How to identify the root cause of excess memory consumption in a Heroku Python deployment?Heroku load average alarmingly highHeroku R14 Errors Immediately on RestartDeploy Django project on heroku (python 3.4.3)'ImportError: No module named ' , flask on herokuHeroku - No web process runningHeroku memory usage high in rails appModuleNotFoundError: No module named 'heroku'TypeError: __init__() got an unexpected keyword argument 'family_or_realsock'Flask-Socketio takes extremely long to connect on HerokuDjango App crashes when deployed to Heroku - Worker failed to boot

Shouldn't countries like Russia and Canada support global warming?

Examples of proofs by making reduction to a finite set

How to make a bold sparkline in Google Sheets?

Would it be unbalanced to increase a druid's number of uses of Wild Shape based on level?

Impossible Scrabble Words

How do certain apps show new notifications when internet access is restricted to them?

Why don't airports use arresting gears to recover energy from landing passenger planes?

shell script to check if input is a string/integer/float

How clean are pets?

Is the Dodge action perceptible to other characters?

How to control the output voltage of a solid state relay

Does a large scratch in an ND filter affect image quality?

Teleport everything in a large zone; or teleport all living things and make a lot of equipment disappear

Permutations in Disguise

Does my opponent need to prove his creature has morph?

Is it possible to format a USB from a live USB?

How do we know that black holes are spinning?

What was the motivation for the invention of electric pianos?

Can I travel to European countries with the Irish passport and without destination Visa?

How to publish superseding results without creating enemies

How to write characters doing illogical things in a believable way?

Seven Places at Once - Another Google Earth Challenge?

Python web-scraper to download table of transistor counts from Wikipedia

Why is this sentence grammatical?



How to identify the root cause of excess memory consumption in a Heroku Python deployment?


Heroku load average alarmingly highHeroku R14 Errors Immediately on RestartDeploy Django project on heroku (python 3.4.3)'ImportError: No module named ' , flask on herokuHeroku - No web process runningHeroku memory usage high in rails appModuleNotFoundError: No module named 'heroku'TypeError: __init__() got an unexpected keyword argument 'family_or_realsock'Flask-Socketio takes extremely long to connect on HerokuDjango App crashes when deployed to Heroku - Worker failed to boot






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have recently deployed a web app on Heroku (Free version). The deployment uses Python with libraries for plotly, dash, pandas and bootstrap. I would assume that this setup based on the size of all the files should only be in few 10s of MBs. However, it is consuming over 400 MB of RAM. How do I troubleshoot to identify the cause of this high memory (possibly a memory leak)?



I have tried using the heroku labs logs-runtime-metrics tool but the information is limited. I also tried to use the chrome developer tools but I was not able to reach anywhere.



heroku labs:enable log-runtime-metrics
heroku logs


The log looks something like this:



heroku[web.1]: source=web.1 dyno=heroku.XXXX sample#memory_total=458.20MB sample#memory_rss=431.30MB sample#memory_cache=26.89MB sample#memory_swap=0.00MB sample#memory_pgpgin=160223pages sample#memory_pgpgout=49568pages sample#memory_quota=512.00MB


As I mentioned above the memory_rss value which translated to the actual RAM consumption is too high for a python based function (close to the limit). Running the same process on my local machine peaks at around 180MB. Does the import of Python modules affect memory performance too much?



Looking for advice or help to point me in the right direction, please. Appreciate your help. Thanks.




EDIT 1: gunicorn --preload and improved codebase



I have tried to improve the memory optimization somewhat by using this hack where one can preload the application as explained here:
Gunicorn Preload



This is done by editing the Procfile to contain the following:



web: gunicorn hello:app --preload


I also did some edits in the way I was importing certain libraries and avoiding others whose purpose could be overridden. With all that my new logs show a decent improvement:



heroku[web.1]: source=web.1 dyno=heroku.XXXX sample#memory_total=272.63MB sample#memory_rss=248.45MB sample#memory_cache=24.18MB sample#memory_swap=0.00MB sample#memory_pgpgin=97938pages sample#memory_pgpgout=28145pages sample#memory_quota=512.00MB


More inputs are welcome!










share|improve this question


























  • I don't have any tips or tools for you, but bear in mind that the memory consumption Heroku reports likely includes things like your web server (and maybe some system-level processes since everything is running in a container) that you probably aren't considering locally.

    – Chris
    Mar 28 at 12:49











  • That makes sense. I have done some minor optimizations (EDIT 1 in question) that have helped me. But this method also seems to slow the page loading I feel (have to measure it)

    – SivamPillai
    Mar 28 at 15:16

















0















I have recently deployed a web app on Heroku (Free version). The deployment uses Python with libraries for plotly, dash, pandas and bootstrap. I would assume that this setup based on the size of all the files should only be in few 10s of MBs. However, it is consuming over 400 MB of RAM. How do I troubleshoot to identify the cause of this high memory (possibly a memory leak)?



I have tried using the heroku labs logs-runtime-metrics tool but the information is limited. I also tried to use the chrome developer tools but I was not able to reach anywhere.



heroku labs:enable log-runtime-metrics
heroku logs


The log looks something like this:



heroku[web.1]: source=web.1 dyno=heroku.XXXX sample#memory_total=458.20MB sample#memory_rss=431.30MB sample#memory_cache=26.89MB sample#memory_swap=0.00MB sample#memory_pgpgin=160223pages sample#memory_pgpgout=49568pages sample#memory_quota=512.00MB


As I mentioned above the memory_rss value which translated to the actual RAM consumption is too high for a python based function (close to the limit). Running the same process on my local machine peaks at around 180MB. Does the import of Python modules affect memory performance too much?



Looking for advice or help to point me in the right direction, please. Appreciate your help. Thanks.




EDIT 1: gunicorn --preload and improved codebase



I have tried to improve the memory optimization somewhat by using this hack where one can preload the application as explained here:
Gunicorn Preload



This is done by editing the Procfile to contain the following:



web: gunicorn hello:app --preload


I also did some edits in the way I was importing certain libraries and avoiding others whose purpose could be overridden. With all that my new logs show a decent improvement:



heroku[web.1]: source=web.1 dyno=heroku.XXXX sample#memory_total=272.63MB sample#memory_rss=248.45MB sample#memory_cache=24.18MB sample#memory_swap=0.00MB sample#memory_pgpgin=97938pages sample#memory_pgpgout=28145pages sample#memory_quota=512.00MB


More inputs are welcome!










share|improve this question


























  • I don't have any tips or tools for you, but bear in mind that the memory consumption Heroku reports likely includes things like your web server (and maybe some system-level processes since everything is running in a container) that you probably aren't considering locally.

    – Chris
    Mar 28 at 12:49











  • That makes sense. I have done some minor optimizations (EDIT 1 in question) that have helped me. But this method also seems to slow the page loading I feel (have to measure it)

    – SivamPillai
    Mar 28 at 15:16













0












0








0








I have recently deployed a web app on Heroku (Free version). The deployment uses Python with libraries for plotly, dash, pandas and bootstrap. I would assume that this setup based on the size of all the files should only be in few 10s of MBs. However, it is consuming over 400 MB of RAM. How do I troubleshoot to identify the cause of this high memory (possibly a memory leak)?



I have tried using the heroku labs logs-runtime-metrics tool but the information is limited. I also tried to use the chrome developer tools but I was not able to reach anywhere.



heroku labs:enable log-runtime-metrics
heroku logs


The log looks something like this:



heroku[web.1]: source=web.1 dyno=heroku.XXXX sample#memory_total=458.20MB sample#memory_rss=431.30MB sample#memory_cache=26.89MB sample#memory_swap=0.00MB sample#memory_pgpgin=160223pages sample#memory_pgpgout=49568pages sample#memory_quota=512.00MB


As I mentioned above the memory_rss value which translated to the actual RAM consumption is too high for a python based function (close to the limit). Running the same process on my local machine peaks at around 180MB. Does the import of Python modules affect memory performance too much?



Looking for advice or help to point me in the right direction, please. Appreciate your help. Thanks.




EDIT 1: gunicorn --preload and improved codebase



I have tried to improve the memory optimization somewhat by using this hack where one can preload the application as explained here:
Gunicorn Preload



This is done by editing the Procfile to contain the following:



web: gunicorn hello:app --preload


I also did some edits in the way I was importing certain libraries and avoiding others whose purpose could be overridden. With all that my new logs show a decent improvement:



heroku[web.1]: source=web.1 dyno=heroku.XXXX sample#memory_total=272.63MB sample#memory_rss=248.45MB sample#memory_cache=24.18MB sample#memory_swap=0.00MB sample#memory_pgpgin=97938pages sample#memory_pgpgout=28145pages sample#memory_quota=512.00MB


More inputs are welcome!










share|improve this question
















I have recently deployed a web app on Heroku (Free version). The deployment uses Python with libraries for plotly, dash, pandas and bootstrap. I would assume that this setup based on the size of all the files should only be in few 10s of MBs. However, it is consuming over 400 MB of RAM. How do I troubleshoot to identify the cause of this high memory (possibly a memory leak)?



I have tried using the heroku labs logs-runtime-metrics tool but the information is limited. I also tried to use the chrome developer tools but I was not able to reach anywhere.



heroku labs:enable log-runtime-metrics
heroku logs


The log looks something like this:



heroku[web.1]: source=web.1 dyno=heroku.XXXX sample#memory_total=458.20MB sample#memory_rss=431.30MB sample#memory_cache=26.89MB sample#memory_swap=0.00MB sample#memory_pgpgin=160223pages sample#memory_pgpgout=49568pages sample#memory_quota=512.00MB


As I mentioned above the memory_rss value which translated to the actual RAM consumption is too high for a python based function (close to the limit). Running the same process on my local machine peaks at around 180MB. Does the import of Python modules affect memory performance too much?



Looking for advice or help to point me in the right direction, please. Appreciate your help. Thanks.




EDIT 1: gunicorn --preload and improved codebase



I have tried to improve the memory optimization somewhat by using this hack where one can preload the application as explained here:
Gunicorn Preload



This is done by editing the Procfile to contain the following:



web: gunicorn hello:app --preload


I also did some edits in the way I was importing certain libraries and avoiding others whose purpose could be overridden. With all that my new logs show a decent improvement:



heroku[web.1]: source=web.1 dyno=heroku.XXXX sample#memory_total=272.63MB sample#memory_rss=248.45MB sample#memory_cache=24.18MB sample#memory_swap=0.00MB sample#memory_pgpgin=97938pages sample#memory_pgpgout=28145pages sample#memory_quota=512.00MB


More inputs are welcome!







python-3.x heroku plotly-dash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 15:15







SivamPillai

















asked Mar 28 at 12:10









SivamPillaiSivamPillai

464 bronze badges




464 bronze badges















  • I don't have any tips or tools for you, but bear in mind that the memory consumption Heroku reports likely includes things like your web server (and maybe some system-level processes since everything is running in a container) that you probably aren't considering locally.

    – Chris
    Mar 28 at 12:49











  • That makes sense. I have done some minor optimizations (EDIT 1 in question) that have helped me. But this method also seems to slow the page loading I feel (have to measure it)

    – SivamPillai
    Mar 28 at 15:16

















  • I don't have any tips or tools for you, but bear in mind that the memory consumption Heroku reports likely includes things like your web server (and maybe some system-level processes since everything is running in a container) that you probably aren't considering locally.

    – Chris
    Mar 28 at 12:49











  • That makes sense. I have done some minor optimizations (EDIT 1 in question) that have helped me. But this method also seems to slow the page loading I feel (have to measure it)

    – SivamPillai
    Mar 28 at 15:16
















I don't have any tips or tools for you, but bear in mind that the memory consumption Heroku reports likely includes things like your web server (and maybe some system-level processes since everything is running in a container) that you probably aren't considering locally.

– Chris
Mar 28 at 12:49





I don't have any tips or tools for you, but bear in mind that the memory consumption Heroku reports likely includes things like your web server (and maybe some system-level processes since everything is running in a container) that you probably aren't considering locally.

– Chris
Mar 28 at 12:49













That makes sense. I have done some minor optimizations (EDIT 1 in question) that have helped me. But this method also seems to slow the page loading I feel (have to measure it)

– SivamPillai
Mar 28 at 15:16





That makes sense. I have done some minor optimizations (EDIT 1 in question) that have helped me. But this method also seems to slow the page loading I feel (have to measure it)

– SivamPillai
Mar 28 at 15:16












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55397325%2fhow-to-identify-the-root-cause-of-excess-memory-consumption-in-a-heroku-python-d%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.




















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55397325%2fhow-to-identify-the-root-cause-of-excess-memory-consumption-in-a-heroku-python-d%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현