I designed an architecture for web app running on single computer
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开发者_JAVA技巧 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.
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.
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.
精彩评论