Teddy Ward
Teddy Ward

Reputation: 450

Could running a Heroku one-off dyno as `:detached` cause it to consume more memory?

When I run my management command in a detached one-off dyno, it exceeds the memory quota almost immediately. When I run non-detached, it works perfectly. I would like some insight as to how that could possibly be. Any answer that points to any documentation on this phenomenon would be amazing.

This is for a Python management command (addfeederpolygons) that I estimate to use a few hundred megabytes of memory, as it does some intensive spatial joins with geodjango.

Are there ways that the underlying code could perform differently in a detached one-off dyno vs. a non-detached one-off dyno?

I expect the results to be the same, regardless of whether or not the dyno is running detached. But here is the actual output:

When running un-detached

$ heroku run -a kevala-api-stage python manage.py addfeederpolygons --geography 25 --overwrite
 ›   Warning: heroku update available from 7.0.33 to 7.19.3
Running python manage.py addfeederpolygons --geography 25 --overwrite on ⬢ kevala-api-stage... up, run.8817 (Standard-1X)
initialized redis cache
Imported all multipolygon data for 328922
Imported all multipolygon data for 329602
...etc...

this does not crash, and runs much faster than the other scenario...

When running detached

$ heroku run:detached -a kevala-api-stage python manage.py addfeederpolygons --geography 25 --overwrite
$ heroku logs --app kevala-api-stage --dyno run.5051 -n 1500
 ›   Warning: heroku update available from 7.0.33 to 7.19.3
2019-01-30T19:23:10.894495+00:00 heroku[run.5051]: State changed from starting to up
2019-01-30T19:23:19.578170+00:00 app[run.5051]: initialized redis cache
2019-01-30T19:23:56.311511+00:00 heroku[run.5051]: Process running mem=553M(108.1%)
2019-01-30T19:23:56.311732+00:00 heroku[run.5051]: Error R14 (Memory quota exceeded)
2019-01-30T19:24:00.700959+00:00 app[run.5051]: Imported all multipolygon data for 328922
2019-01-30T19:24:03.325782+00:00 app[run.5051]: Imported all multipolygon data for 329602
...etc...
eventually fails with R15

Upvotes: 0

Views: 269

Answers (1)

JLynchDesigns
JLynchDesigns

Reputation: 157

So, I lost the ability to comment for the moment, so I am kind of forced to write out an answer. Good news is, I think what you want to do is set up a Log Drain to compensate for the memory leaks and/or bottlenecking you're experiencing.

If you don't mind, could I also see one of the logs in question (Pastebin?). I would like to see exactly what's going on, that would probably help.

Upvotes: 2

Related Questions