php - Laravel 4 large Route count increases booting time -
php - Laravel 4 large Route count increases booting time -
we have big web application built on laravel 4 (4.2 currently) , have ran bit of problem. each page load takes 900ms boot laravel. did investigation , looks caused big route count in our application - have list of around 1200 - 1500 routes when launch php artisan routes guess long load time due fact, in booting process laravel go on of routes , map them... trieed removing of them , have 1 test route, , app boots - in 100 - 150ms should...
we have routes spread out between many controllers in several workbench packages , in /app/routes.php. using restful , normal controllers.
has had such problem big scale application many routes? how solve , not have laravel go through of them , map them @ booting process?
although it's harder maintain, seek separate routes based on first segment:
$first = request::segment(1); if ($first === 'blog') { // add together blog routes here } elseif ($first === 'forum') { // add together forum routes here } but create other routes unavailable helpers url::route('resource.action').
you need know if there's slow code in routes.php, like:
route::resource('page', slowfunctiontodecidecontrollername()); update: laravel 5 has route cache scheme https://mattstauffer.co/blog/laravel-5.0-route-caching
php laravel laravel-4 laravel-routing
Comments
Post a Comment