Can someone explain “heroku ps:scale web=1”

China☆狼群 提交于 2019-11-29 17:21:44

问题


I'm looking for a straightforward explanation of what all happens when I enter the following command:

heroku ps:scale web=1 

What is Heroku doing behind the scenes to deploy the app? I ask because I'm just now using Heroku to deploy and would like to better understand the process. Thanks!


回答1:


This command does not deploy the app. It starts it, after you have deployed.

When you deploy your application, heroku creates a "slug". A runnable zipped version of your app which is then stored. You can then start "dynos", which take your current slug and start it on one of heroku's servers.

Running heroku ps:scale web=1 will scale your app to one running dyno, basically meaning you have one server running your app currently.

If you deploy your app again, a new slug will be generated and stored, and your currently running dynos will be destroyed, to be replaced by new ones with the new version of your code.




回答2:


You scale the number of web dynos to 1.
I would say there is a lot of docu about this topic.
https://devcenter.heroku.com/articles/scaling
https://devcenter.heroku.com/articles/dynos




回答3:


Whenever you freshly deploy your app in heroku it starts up one dyno where the app runs. Just consider it as a server. This server cant handle large number of requests all at once.

So in order to handle all these bulk requests you may want to run multiple instances of your app i.e. multiple dyno using the spare resources available in heroku just like running multiple instances in tomcat for the same application using the command (within limits ofcourse):

heroku ps:scale web=<number_dynos_u_want>

Heroku does the load-balancing for you. Thus you are able to horizontally scale your app to handle more load. Hope this clears this concept!



来源:https://stackoverflow.com/questions/30318369/can-someone-explain-heroku-psscale-web-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!