简体   繁体   English

我可以在其他EC2服务器上放置视图,模型,控制器吗?

[英]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. 我正在YII框架中进行一个非常大的社交网络项目,其中负载平衡是一个非常重要的问题。 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. 我需要的是:我想将所有三个层(模型,视图,控制器)保留在不同的EC2亚马逊服务器上,以便可以高效地完成负载平衡。

What can I do for that in YII ? 在YII中我该怎么做?

Any help ? 有什么帮助吗?

For your load balancing you should not seperate the application on 3 different instances. 为了实现负载平衡,您不应在3个不同的实例上分离应用程序。

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. 您应该在多台服务器上具有相同的应用程序(具有所有模型,视图和控制器),然后根据每台服务器的CPU和RAM使用情况,负载平衡器将在适当的服务器上重定向最终用户。

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. 我使用的解决方案是将我的应用程序部署在3台服务器上,并通过rsync使它们与部署服务器保持同步。 My static content comes from a 4rth server, but that would put all your code on 3 servers, as 3 exact clones. 我的静态内容来自第4个服务器,但这会将您的所有代码放在3个服务器上,作为3个精确的克隆。 Imo this is the best because with amazone you can just spawn more clones if you need to scale your balancing. Imo这是最好的,因为有了amazone,您可以在需要扩展平衡时只产生更多克隆。

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. 负载平衡意味着您将一部分用户服务在1台服务器上,另一部分用户服务在2nd服务器上,依此类推。.但是,如果拆分模型/控制器/视图,您将不了解负载平衡的含义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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