跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[服务器] nodejs 后端项目如何部署?

发表于

使用 Midwayjs 开发的后端项目,包括 api 项目和管理项目,使用 mongoo 数据库,后续可能会使用 redis ,请问这种单进程的项目怎样部署会比较好呢?

项目的特性决定了会有比较明显的流量潮汐,就是大部分时间流量不会很多,小部分时间流量会突然增多,但总体流量会持续增加这种。

目前的困惑在于

使用云服务器+pm2 的部署方案,可以很简单的实现均衡负载,可以根据云服务器核数灵活的决定 pm2 要 cluster 的数量,db 等可以和服务器装在一台云服务器。当流量增加时,可以增加云服务器核数和内存就行了。 但是感觉现在云服务器越来越贵,要实现灵活的增减配就只能买短时间,但是折扣就会很低。要买长时间的话,变更配置又要补很多差价。。。

另外问下大佬们,你们通过代理最多能少几个点的折扣?

另一种部署方案就是使用 Serverless ,麻烦的地方在于前期配置,比较麻烦。配置好了,只需要根据流量情况动态调整实例数量就好了,但是不清楚像 redis ,db 这些是需要另外云服务器来部署,还是买 云 db 或者去 redis 更方便。Serverless 另一个好处就是不像云服务器还要管理服务器的环境,软件版本,bug 修复,漏洞这些。

对于这两种方法,希望有经验的大佬些能不吝赐教,感谢。希望是能在产品早期找到一个能持续增加,成本可控的方案。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.