简体   繁体   中英

Can I place views, models, controllers on different EC2 server?

I am working on a very big project of social networking in YII framework where the load balancing is very important issue that is arising. What I need is : I want to keep all the three layers ( models, views, controllers) on different EC2 amazon servers so that load balancing can be done in an efficient way.

What can I do for that in YII ?

Any help ?

For your load balancing you should not seperate the application on 3 different instances.

You should have the same app (with all the models, views and controllers) on several servers and then depending on each server's CPU and RAM usage the load balancer will redirect the end user on the appropriate server.

I don't even know if separate the app is doable, and if it is the user will have to wait much longer:

  • The front controller will call some models => One or several calls to the model server = some time
  • The front controller have to send the datas to the view => more time

At the end the user will have waited more than on a loaded server!

我强烈推荐Amazon的Elastic Beanstalk服务,因为我正在将其用于我正在开发的项目中,该项目也基于Yii Framework。

The solution i use, is to deploy my application on 3 servers and keep them in sync from a deployment server with rsync. My static content comes from a 4rth server, but that would put all your code on 3 servers, as 3 exact clones. Imo this is the best because with amazone you can just spawn more clones if you need to scale your balancing.

Load balancing means that you will server a portion of the users on 1 server and another portion on a 2nd server and so on.. But if you split up your models/controllers/views you do not understand what load balancing is about.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM