将 C++ 服务器移植到云端

Porting C++ server to cloud

我有多个传统服务器,成千上万的用户连接到这些服务器。我的服务器软件是用 C++ 编写的,用于在 TCP 套接字上侦听这些用户,并且我定义了自己的协议(在 TCP 之上)。服务器代码的编写使其能够处理客户端到客户端的通信(例如即时消息),无论哪个客户端连接到哪个服务器机器。这是典型的传统服务器场场景。

现在,当我想将其切换到云时,我需要做哪些更改?我是云的新手,我所知道的是云提供商为我们提供了与云通信的 API instance/DB,我们现在不需要担心后面的实际服务器实例 运行(负载平衡等都已完成)由云基础架构维护)。

  1. 单个云实例能否处理数千(或数百万)个连接?

  2. 我的服务器代码是用 C++ 编写的,当我想切换到云时它会过时吗?我是否需要使用云 API 从头开始​​开发我的服务器?

My server code is written in C++ and when I want to switch to cloud is it going to be obsolete? and do I need to develop my server from scratch using cloud APIs?

您拥有的是一个目前正在 运行 内部硬件上的应用程序。对于云,硬件和 OS 基础设施由云提供商提供。您需要将您的应用程序带到云端并 运行 按原样(几乎)。例如,如果当前您 运行 在 CentOS 7 上的应用程序中,您可以在云中创建 CentOS 7 的实例,并且您的 C++ 应用程序应该 运行没有问题。云提供商 "facilitates" 及其 API。它不强制使用其 API 重写应用程序。因此,无需从头开发。

Can single cloud instance could handle thousands (or say millions) of connections? Depends on the dimensions ( w.r.t to processor, memory, n/w throughput, etc) of the instance that you to use from the cloud provider.