CodeIgniter Forums
thousands of urls in routes.php make the application slower? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: thousands of urls in routes.php make the application slower? (/showthread.php?tid=43761)



thousands of urls in routes.php make the application slower? - El Forum - 07-22-2011

[eluser]eshban[/eluser]
Hi

I want to use routes.php for url rewriting. I have a huge application which contains more than 7000 urls and still growing, so every url will be in route.php file.

I need to ask, are these large number of url's make the routes.php file heavy which will actually slow down the application?

Looking forward for best answers.

Regards,
Eshban


thousands of urls in routes.php make the application slower? - El Forum - 07-22-2011

[eluser]n0xie[/eluser]
Do you really need to add all url's to the routes?


thousands of urls in routes.php make the application slower? - El Forum - 07-22-2011

[eluser]eshban[/eluser]
yes. Thats why I have written it here.


thousands of urls in routes.php make the application slower? - El Forum - 07-22-2011

[eluser]John_Betong_002[/eluser]
[quote author="eshban" date="1311355246"]yes. Thats why I have written it here.[/quote]
 
Can you give a small sample from your URLs.

I am sure that by using the route wildcard features you could considerably reduce the route file size.

 


thousands of urls in routes.php make the application slower? - El Forum - 07-22-2011

[eluser]Nemke[/eluser]
Maybe you should store you URL's in some MySQL table, and then extend core classes

http://ellislab.com/codeigniter/user-guide/general/core_classes.html

and make Router Class check your's MySQL table?


thousands of urls in routes.php make the application slower? - El Forum - 07-22-2011

[eluser]Eric Barnes[/eluser]
I am sorry but 7000 routes is crazy and will be insane to manage. I think the structure of your application needs to be rethought.


thousands of urls in routes.php make the application slower? - El Forum - 08-04-2011

[eluser]John Murowaniecki[/eluser]
If you need more aid for restructuring of your system I suggest that you replicate the production environment and create a development environment (which can be released so that someone can assist you by viewing the entire problem). If you need a help to do it you can also count on me (send a DM).

Good luck!


thousands of urls in routes.php make the application slower? - El Forum - 08-04-2011

[eluser]danmontgomery[/eluser]
routes are an array, which have to be loaded and parsed with every page request... So, yes, 7000 elements in that array will be slower than, say, 10 elements.


thousands of urls in routes.php make the application slower? - El Forum - 08-05-2011

[eluser]n0xie[/eluser]
[quote author="noctrum" date="1312495452"]routes are an array, which have to be loaded and parsed with every page request... So, yes, 7000 elements in that array will be slower than, say, 10 elements.[/quote]
Actually...

When using APC the array will be precached, hence no disk seek is needed. So from a load time/ parsing point of view it shouldn't matter.

Then again when it tries to actually match against this large dataset when it needs to route a request, then yes, it will take a lot longer.

I'm pretty sure the OP's problem can be solved by using .htaccess rewrite rules, but since he has shown us no examples, it seems to me he has solved the problem already.