如何构建可用的 Web 应用程序
假设我们即将构建一个以高可用性为首要关注点的 Web 应用程序。我们的客户是公司,因此停机对于所有相关人员来说就等于收入损失。
总而言之,我们需要始终在线才能让每个人都开心。因此,从非常基本的角度来看,我们应该考虑哪些技术来做到这一点?
除了我们将使用 PHP 来保持较高的开发速度之外,我们几乎没有任何偏好,所以我们完全开放新的数据存储平台以及还有什么可以实现这一目标。
非常感谢您的回答!多谢!
Let's say that we are about to build an web application where high availability is top focus. Our customers are companies, so downtime are equal to loss of revenue for everyone involved.
To sum it up, we need to be online at all times to keep everyone happy. So, from a very basic perspective, what techniques should we be looking at to do this?
We have pretty much no preferences besides that we will be using PHP to keep developing speed high, so we're totally open for new platforms of data storage and what else is out there to make it happen.
Your answer is very appreciated! Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
为此,您需要考虑硬件和软件。
关于硬件,您最好的选择可能是选择具有必要经验的托管提供商,例如 Rackspace(我与他们取得了良好的个人体验,但还有很多其他的)。这并不便宜。您将需要完全冗余的硬件来应对任何一个组件的故障 - 多台服务器(至少两台),每台服务器都有多个磁盘、网卡、风扇、电源 - 您明白了。
关于软件 - 确保在构建它时考虑到可扩展性。如果它是您的普通 Web 应用程序,那么使用 MVC 范例并保持分离干净将大大有助于确保您可以在需要运行的多个服务器上扩展您的应用程序。
最难的部分通常是数据库,因为你不能只运行两个。因此,请考虑具有自动故障转移功能的主从设置,甚至是集群。
有关此主题的书籍有很多,这里只是其中一本。祝你好运!
You need to consider both hardware and software for this.
Regarding hardware, your best bet is probably to pick a hosting provider with the necessary experience, like Rackspace (I have made good personal experiences with them, but there are lots of others). This will not come cheap. You will need fully redundant hardware to survive the failure of any one component - multiple servers (at least two), each with multiple disks, network cards, fans, power supplies - you get the picture.
Regarding the software - make sure you build it with scalability in mind. If it's your run-of-the-mill web application, using the MVC paradigm and keeping the separation clean will go a long way in ensuring that you can scale your application across the multiple servers you will need to run.
The hardest part is usually the database, since you can't just run two. So look into a master-slave setup with automatic failover, or even a cluster.
A number of books are available for this topic, here's just one of them. Good luck!
有几种方法可以解决这个问题,具体取决于很多变量:
所有这些组合都可以帮助您。
如果您决定使用托管解决方案,您仍然需要进行一些自己的备份,以防您的主机出现故障并且需要恢复。如果您部署了虚拟机,您还可以强制执行一些负载平衡,并准备好虚拟机,以防组件出现故障。
There are a few ways to address this question depending on a lot of variables:
All those combinations can help you.
If you decided to go with a hosted solution you would still want to do some of your own backups, in case your host goes down and you need to recover. If you deployed virtual machines you could also enforce some load balancing and have virtual machines prepared in case components go down.
如果您永远无法承受停机,则可以提供大量冗余,一直到多个数据中心。
Lots of redundancy, all the way to multiple data centres if you can never afford to be down.
您还可以查看不同的云服务,例如 Amazon EC2 和 Rackspace Cloud。然后,您可能只需为所需的计算能力付费...
另请参阅:
http://www.2mhost.com/mission-ritic-web-hosting.html
http ://www.ihostxtremes.com/
http://www.netlocations.com/
http://www.mewebhost.com/
You can also have a look at the different cloud services such as Amazon EC2 and Rackspace Cloud. You might then be able to pay only for the exact computing power you need ...
Also see:
http://www.2mhost.com/mission-critical-web-hosting.html
http://www.ihostxtremes.com/
http://www.netlocations.com/
http://www.mewebhost.com/
我个人强烈推荐 Azure App Service (这是一个 PaaS 解决方案用于构建网络应用程序)。
(来源:windows.net)
另请查看以下通用/同构 Web 应用程序入门套件: https ://github.com/kriasoft/react-starter-kit(免责声明:我是作者)
I personally highly recommend Azure App Service (which is a PaaS solution for building web apps).
(source: windows.net)
Also take a look at the following universal / isomorphic web application starter kit: https://github.com/kriasoft/react-starter-kit (disclaimer: I'm the author)