Re: Pux - High Performance PHP Router

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 9, 2014, at 8:02 PM, Lester Caine <lester@xxxxxxxxxxx> wrote:

> Lin Yo-an wrote:
>> I also tested your case "php array as a router”.
>> 
>> the php array test case is the fastest because there is no any function call.
>> but using php array to route does not help the development and it’s hard to
>> maintain or extend:
> 
> Going off on a slight tangent here, but I feel that it is important. I'm just moving from Apache to nginx to provide the base static serving and am now running php only for php files. I'm still using the same structure that I've used for many years where each area has it's own 'directory', so rewrite is used as part of the routing, and reduces the problem to manageable chunks. So I am at something of a loss to see the advantage of building a large routing application when the php end of things can be simplified to smaller faster modules? In my model the bulk of the routing has been done even before php is accessed?

You are right. I used to use the same structure as yours to develop our application, and it works when you start small. 

When your application is getting bigger and bigger, it will be painful to maintain the whole directory structure and these include paths, and you will want to centralise these common code/library/controller/methods and dispatch your controller from the same place.

It’s right to let HTTP server do the routing and get best performance, but doing this way increases the complexity of including libraries (include path problem). for example, you have a directory structure which has 4+ levels, when you changing one of them to elsewhere, you need to modify all include paths one by one, and you need to trace all files that used the changed file.

So the best way to simplify larger application structure is to use a router to dispatch paths from the same place, but sacrifice performance (the reloading overhead).

Some frameworks like React, which does not depend on Apache2 or Nginx. it also doesn't require reloading.

If you look into React framework, it’s actually running PHP process persistently, and you don’t need to maintain the directory or reloading PHP files anymore.  and the routing speed becomes more important on these frameworks.

In the future, people will run PHP just like other languages do (running a persistent http server in the backend). although it’s still unstable for production servers.


c9s
http://github.com/c9s


> -- 
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux