[英]Why is my django development server running locally so much faster then running the same development server on Heroku?
I have a website using Django that loads about 100 rows from a single table in a postgresql database when entering it. 我有一个使用Django的网站,输入该网站时,它将从postgresql数据库的单个表中加载约100行。
Development server locally : Page loaded in 300ms 本地开发服务器 :页面加载时间为300ms
Production server on Heroku : Page loaded in 1.34secs (about 4.13 times slower) (Integrated gunicorn
and loading my static files from aws S3
on a non-idling dyno) Heroku上的生产服务器 :页面加载速度为1.34秒 (慢了约4.13倍)(集成了
gunicorn
并在非空转的gunicorn
上从aws S3
加载了我的静态文件)
wth? 是什么?
Note that there is no traffic yet on my production server and I am using 1 dyno. 请注意,生产服务器上尚无流量,我正在使用1 dyno。
When I used the exact same setup as my development server for my production server on Heroku it was even slower. 当我在Heroku上为生产服务器使用与开发服务器完全相同的设置时,速度甚至会更慢。 Is such a difference in loading time normal?
这样的加载时间差异正常吗?
Specs of my computer : 我的电脑规格 :
Memory: 3.7 GiB
Processor: Intel® Core™ i5 CPU M 520 @ 2.40GHz × 4
OS type: 64-bit
If my computer has about 3.9 Gb ram
and one dyno indeed has 512Mb ram
according to this source , that means my computer has about 7.8 times more ram . 根据此消息 ,如果我的计算机具有大约
3.9 Gb ram
而一台dyno确实具有512Mb ram
,则意味着我的计算机的ram容量约为7.8倍 。 According to this source ram is very significant for increasing performance of db queries. 根据此消息, ram对于提高数据库查询的性能非常重要。 Since I'm doing quite a few queries the time difference makes sense to me.
由于我要进行很多查询,因此时差对我来说很有意义。
Running top in my heroku app directory surprisingly returns 35 Gb ram
though. 我的heroku应用程序目录中的toptop令人惊讶地返回
35 Gb ram
。 But according to this source running top
in Heroku is performed from a different dyno(one-off dyno) your app is running on. 但是根据此消息来源 ,Heroku中的运行状况
top
是通过您的应用正在运行的另一种dyno(一次性dyno)执行的。
The only thing I don't understand now is why a one-off dyno
has so much ram. 我现在唯一不了解的是为什么
one-off dyno
有这么多的夯。
As long as nobody gives a better answer I'll keep this answer checked. 只要没有人能给出更好的答案,我就将其保留为选中状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.