简体   繁体   English

heroku 服务器慢吗?

[英]Are heroku servers slow?

I have a node js webiste, when I run it on localhost on my computer, it runs blazingly fast but when I deploy it on heroku, it becomes very slow.我有一个 node js webiste,当我在我的计算机上的 localhost 上运行它时,它运行得非常快,但是当我将它部署到 heroku 上时,它变得非常慢。 So will this also happen if I host my site with digital ocean or any other hosting provider?那么,如果我使用数字海洋或任何其他托管服务提供商托管我的网站,也会发生这种情况吗?

This is my package.json这是我的 package.json

  {
  "name": "something",
  "version": "1.0.0",
  "engines": {
    "node": "16.x"
  },
  "description": "",
  "main": "app.js",
  "scripts": {
    "start": "cross-env NODE_ENV=production node app",
    "dev": "cross-env NODE_ENV=development nodemon app"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "compression": "^1.7.4",
    "connect-mongo": "^4.6.0",
    "cross-env": "^7.0.3",
    "cryptr": "^6.0.3",
    "dotenv": "^16.0.0",
    "express": "^4.17.3",
    "express-handlebars": "^6.0.5",
    "express-session": "^1.17.2",
    "flatted": "^3.2.5",
    "got": "^12.1.0",
    "lodash": "^4.17.21",
    "method-override": "^3.0.0",
    "moment": "^2.29.3",
    "mongoose": "^6.3.1",
    "most-common-words-by-language": "^3.0.10",
    "node-fetch": "^3.2.4",
    "passport": "^0.5.2",
    "passport-google-oauth20": "^2.0.0",
    "randomcolor": "^0.6.2",
    "request": "^2.88.2",
    "workbox-cli": "^6.5.3"
  }
}

It is most likely not a hosting provider issue but rather a limitation issue.这很可能不是托管服务提供商问题,而是限制问题。

Heroku uses the Linux containers Dynos to execute your code in their platform, and they have multiple types with differentiating characteristics. Heroku 使用 Linux 容器Dynos在其平台上执行您的代码,它们具有多种类型,具有不同的特征。 If you have an unverified account, then you're given the free dyno type by default.如果您有一个未经验证的帐户,那么默认情况下您将获得free的 dyno 类型。 Check Heroku's dynos page.检查 Heroku 的dynos页面。 You'll see that for the " Always on " row, the free type has the trait:您会看到对于“始终在线”行, free类型具有以下特征:

"Sleeps after 30 mins of inactivity, otherwise always on depending on your remaining monthly free dyno hours." “闲置 30 分钟后睡觉,否则总是取决于你每月剩余的免费测功时间。”

This is your issue.这是你的问题。 Your app starts slower when the dynos are asleep.当测功机睡着时,您的应用程序启动速度会变慢。 The speed improves as you continue using the app, but it's not going to be performant and it's going to start slow again once the app is inactive for 30 mins.随着您继续使用该应用程序,速度会提高,但它不会表现出色,并且一旦应用程序处于非活动状态 30 分钟,它就会再次开始变慢。 If you want your app to be blazingly fast in Heroku, then you need to verify your account and purchase a non free or hobby dyno type.如果您希望您的应用程序在 Heroku 中快速运行,那么您需要验证您的帐户并购买非freehobby dyno 类型。

Take note that you will also face similar issues with other hosting providers if you are using free account on their platform.请注意,如果您在其他托管服务提供商的平台上使用免费帐户,您也将面临类似的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 heroku 中运行两台服务器 - How to run two servers in heroku Heroku 图像加载缓慢 - Heroku slow image loading 无法将 MERN 应用推送到 Heroku 服务器 - Unable to push MERN App to heroku servers 为什么在Heroku上部署后我的应用程序变慢 - Why is my app slow after deploying on heroku Heroku服务器上未调用Http Server升级事件 - Http Server upgrade event not being called on Heroku servers 5秒未加载,heroku node.js app加载缓慢 - 5 seconds of not loading, heroku node.js app slow loading 在Heroku上为不同的服务器(Rails和Node js)使用不同的应用程序有什么弊端? - Is there any downside to using different apps for different servers (Rails and Node js) on Heroku? 当我的 React 和 Node 服务器不同(Firebase)时,我遇到 Passport 问题,但当它们相同时(Heroku)没有问题 - I'm having an issue with Passport when my React and Node servers are different (Firebase), but no issue when they are the same (Heroku) 来自 Heroku 的免费计划托管的节点服务器的响应超时或响应缓慢 - Response timeout or slow response from my node server hosted at Heroku's free plan 响应时间非常慢(~1000ms)。 Heroku的。 node.js中 mongolab。 什么也没做 - very slow (~1000ms) response time. Heroku. node.js. mongolab. doing almost nothing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM