Angularjs 负载平衡:前端路由是否减少服务器负载?
我有点混淆了前端路由和后端路由。我在我的一个项目中使用Angular JS和Laravel 我想得到一个建议或方法,我可以减少在路由时的负载平衡 那么,哪一种是使用路由的最佳方式呢 前端布线或后端布线 我知道这不是建议,但我在谷歌上搜索了很多,但没有得到令人满意的答案。这就是我发布这个问题的原因Angularjs 负载平衡:前端路由是否减少服务器负载?,angularjs,laravel,routing,load-balancing,Angularjs,Laravel,Routing,Load Balancing,我有点混淆了前端路由和后端路由。我在我的一个项目中使用Angular JS和Laravel 我想得到一个建议或方法,我可以减少在路由时的负载平衡 那么,哪一种是使用路由的最佳方式呢 前端布线或后端布线 我知道这不是建议,但我在谷歌上搜索了很多,但没有得到令人满意的答案。这就是我发布这个问题的原因 Route::post('users/{email_id}/{name}/{image_url} ', 'Userscontroller@index'); 我应该将其用于路由还是 此代码位于app.m
Route::post('users/{email_id}/{name}/{image_url} ', 'Userscontroller@index');
我应该将其用于路由还是
此代码位于app.module.ts文件中
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { WelcomeComponent } from './home/welcome.component';
/* Feature Modules */
import { ProductModule } from './products/product.module';
@NgModule({
imports: [
BrowserModule,
HttpModule,
RouterModule.forRoot([
{ path: 'welcome', component: WelcomeComponent },
{ path: '', redirectTo: 'welcome', pathMatch: 'full' },
{ path: '**', redirectTo: 'welcome', pathMatch: 'full' }
]),
ProductModule
],
declarations: [
AppComponent,
WelcomeComponent
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
我应该用上面这个吗
任何帮助都会很好
谢谢。你找不到具体的答案。我不知道哪一个更好。这取决于你想做什么。最好是测量和了解自己。在我看来,路由本身不会对负载平衡产生巨大影响。考虑使用MyC缓存、ReDIS等和CDNS. 基本上说,前端的路由将减少HTTP请求的数量,并且对您的服务器更有利。您需要考虑减少文件大小,从而减少TCP/IP额外往返次数。 另外,实现某种非阻塞异步进程池/线程池体系结构并限制后端的后台工作人员数量将有助于负载平衡