Re: Will PHP ever "grow up" and have threading?

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

 



On Monday 22 March 2010 10:51:14 pm Tommy Pham wrote:
> Threading is one of the 2 two main reasons why I moved to Java &
> asp.net (C#).  I've built a PHP based web crawler about 10 years ago.
> I ran into some problems: cookies, form handling and submission,
> threading, and application variables.  I later found some solutions
> for cookies, form handling & submission.  But no solution for
> threading and application variables.  Thus the move.  Here's a simple
> example of one of the many uses for threading.  For an e-commerce
> site,  when the shopper requests for a category (ID), you can have a
> thread to get all subcategories for that category, another thread to
> get any assigned products,  another thread to fetch all manufacturers
> listed under that category, another thread to fetch any filters (price
> ranges, features, specs, etc) set by the store owner that would fall
> under that category, etc...  versus what PHP currently doing now:
> fetch subcategories, then fetch assigned products, then fetch
> manufacturers, etc....  Performance would increase ten fold because of
> parallel (threading) operations versus serial operations.  Add that to
> application variable (less memory usage and CPU cycles due to
> creating/GC of variables that could be used for an entire application
> regardless of requests & sessions), you have an excellent tool.
> 
> Regards,
> Tommy

Threading is also much more difficult to program for safely, because thread 
order is non-deterministic.  Do you really want to unleash hoards of 
marginally competent programmers on a threaded enviornment? :-)

Also, the architecture you describe above is fine if you're scaling a single 
server really big.  PHP is designed to scale the other direction: Just add 
more servers.  There's no data shared from one request to another, so there's 
no need to share data between web heads.  Throw a load balancer in front of it 
and spin up as many web servers as you need.  

The "shared nothing" design is very deliberate.  It has design trade-offs like 
anything else.

PHP is a web-centric language.  It's not really intended for building tier-1 
daemon processes, just like you'd be an idiot to try and code your entire web 
app in C from the start.

--Larry Garfield

-- 
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