我设计了一个在单台计算机上运行的 Web 应用程序的架构

发布于 2024-08-18 22:08:57 字数 525 浏览 2 评论 0原文

我计划构建一个在单台计算机上运行的网络应用程序,并尽可能高效地利用硬件资源。 app的逻辑不会很复杂。以下是我的设计:

操作系统:Linux (CentOS 5)

Web服务器:Nginx

Web脚本:PHP

数据库:Tokyo Cabinet + Tokyo Tyrant

Index:Sphinx

我不会使用MySQL等RDBMS,因为我认为键值存储(东京内阁)带有索引器(Sphinx)将满足部署普通 Web 应用程序的所有需求,并且性能也比 MySQL 更好。

我的问题是:这种设计对于单台计算机来说是一种高效的架构吗?或者说如何改进呢?

(我知道这个问题可能很主观,但我真的需要你的帮助)

非常感谢〜

编辑:

我要托管我的应用程序的计算机是一台普通的PC,比如8GB~16GB内存、500G~1TB硬盘等,我想就不用考虑“扩展性”了。 Web 应用程序的每一个第一步都是从一台机器开始的,而且永远都是开始。

I am planning to build a web app running on a single computer and exploit the hardware resources as efficient as possible. The logic of app will not be complex. The following is my design:

OS: Linux (CentOS 5)

Web Server: Nginx

Web script: PHP

Database: Tokyo cabinet + Tokyo Tyrant

Index: Sphinx

I am not going to use RDBMS such as MySQL, cause I think a key-value store (Tokyo cabinet) with a indexer (Sphinx) will meet all the needs to deploy a normal web app, also with better performance than MySQL.

My question is: is this design to be the an efficient architecture for a single computer? Or how to improve it?

(I know this question might to be subjective but I really need your help)

Thank you very much~

EDIT:

The computer I am going to host my app on, is a normal PC, like 8GB~16GB memory, 500G~1TB Hard disk, etc. I think it won't need to consider the "scalability". Every first step of a web app is started from one machine and it will always the beginning.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

番薯 2024-08-25 22:08:57

数据库的选择

我认为您选择的数据库类型较少取决于系统托管在多少台计算机上。我认为这应该更多地取决于您想要/需要保留的数据质量。

例如,如果您需要存储客户的送货地址,则需要在存储结构中考虑到这一点。名称值对可能看起来是一个足够简单的结构,但如果您预见到以下任何情况,您应该考虑迁移到标准数据库系统来

  • 跟踪更改
  • 报告活动/报告
  • 并发用户

性能

这取决于您的代码、图像、内容、缓存等,就像它取决于您的数据库一样。

Choice of DB

I think that the choice of type of database you make depends less on how many computers the system is hosted on. I think this should be more a function of the quality of data that you want/need to preserve.

For example, if you need to store the shipping addresses for a customer, you will need to account for that in your storage structure. A name value pair may seem an easy enough structure to begin with, but if you foresee any of the following, you should consider moving to a standard database system

  • keeping track of changes
  • reporting activity / reports
  • concurrent users

Performance

This is dependent on your code, images, content, caching, etc just as much as it is on your database.

天涯离梦残月幽梦 2024-08-25 22:08:57

好吧,一种查看方法是对其进行负载测试:
http://grinder.sourceforge.net/

我从未与东京内阁合作过,但如果它在功能上足够了,那么它可能会比数据库快得多。

但从长远来看,当您开始扩展到超出该盒子时,您通过调整应用程序以在一个盒子上运行而实现的任何节省都将很快消失。尝试添加大量缓存,以及让应用程序变得更快的黑客手段也只能到此为止。更重要的是,您应该尝试考虑如何轻松地解耦各个层。

well, one way to see is to load test it:
http://grinder.sourceforge.net/

I've never worked with Tokyo cabinet, but if it's functionally sufficient, then it will probably be significantly faster then a DB.

In the long run though, any savings you realize by tuning your app to work on one box will be quickly lost when you start to scale beyond that box. trying to add a lot of caching, and hacks to get the app to be faster will only go so far. More importantly you should try to think about how easily you can decouple the various layers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文