Interesting idea. I feel rather unintelligent for not thinking of that, but it would solve my second application for threading - big tasks I don't want the user to wait around to finish like image compression and storage. Excellent suggestion.

Unfortunately, my first application for threading won't work out very well here because a lot of data has to be handed back and fourth here, and it doesn't really improve response times when I am sorting or whatever. So now to look at the next replies....

-Galen

On Jan 24, 2004, at 12:54 PM, Lucas Gonze wrote:

One possibility is to have the code which first receives the request split it up into subrequests and do HTTP requests for the subrequests. Whether that makes sense depends on whether the overhead of an HTTP transaction is a big part of the execution time of the subrequests.

- Lucas


On Saturday, Jan 24, 2004, at 15:24 America/New_York, Galen wrote:


Hi,

This may be completely crazy, but let me tell you what I want to do: thread PHP.

My server is a dual-processor 2 GHz machine, and it's not very loaded. I have a few tasks that are huge and lengthy and would benefit from being placed in their own "thread" if you will. This would serve to either accelerate the process by splitting it among CPUs or allow the process to continue "in the background" for a few seconds after all pages have been loaded.

There are two areas where I'd use this:
1) To accelerate results in a relevancy ranking/fuzzy matching algorithm I have created, and although I've optimized the heck out of it, it can be slow when hundreds of thousands of items are thrown at it. It would be easy to split the array in half and run the algorithm on both halves, which would almost half processing time for returning results.


2) With image processing. When a user uploads an image to a few of my pages, the image is processed, re-compressed, and filed in the database or a file system. This can take several seconds, and I'd prefer that the user doesn't have to wait for the process to complete.

How might I be able to make some PHP code run as a "thread" that would serve these purposes?

-Galen

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



Reply via email to