
![]() |
perkiset
I am considering an app that needs to emulate multithreading from an
ajaxcall.My first preference would be to have the app fire off a bunch of Apachecalls, which come back instantly yet continue working so that the callingPHPscript is not "serially waiting" for each one of theApachecalls to be complete... but I am having a bit of trouble with flushing the buffer out consistently (more work and research to do here). If I can work it out, this is an important part of a scalability plan, so I'd really like to make this work.But another way is to exec() it with a > /dev/null & suffix and let them run as daemons to get the jobs done... but I am concerned with the load I will place on my system to do this, because I'm firing up a new shell to run a new instance of the PHPinterpreter to run my script... they're not long, perhaps 2-3 seconds each and low processor because the majority of the wait is on the client that I am hitting.I'm just wondering if I get hit with 100 surfers in a single moment and each one fires off 16 tasks what the real cost in terms of memory might look like. Linuxheads seem to be of the opinion that it's quite a hit to fire off another shell for each processing, but what is "quite a hit?" Isn't this exactly howApachefires things off in a CGI arrangement?Thanks in advance, -p emonk
quote Isn't this exactly how Apachefires things off in a CGI arrangement?Yeah, and that's part of the reason that you shouldn't run PHPas a CGI, but instead use theapachemodule. It reduces overhead significantly.As for the rest, I don't really know. I'm trying to figure out something very similar myself right now, and I'm pretty stumped. I think I'm just gonna override the maximum execution time, and do a bunch of forking with the whole thing output buffered. jammaster82
quote author=perkiset link=topic=772.msg5325#msg5325 date=1202925264 I'm just wondering if I get hit with 100 surfers in a single moment and each one fires off 16 tasks what the real cost in terms of memory might look like. Exactly what 16 tasks, can we make an example task/benchmark app to show it for discussion sake i am curious as well and would love to do some experiments here... perkiset
Answered my own question by making this unnecessary.
I polished off my Apachepseudo multithreading notion and posted about it here: http://www.perkiset.org/forum/php/using_php_the_webrequest2_class_and_apache_for_multitasking-t773.0.html;msg5337WAY WAY WAY Better solution and it is as fast as poop through a goose. |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads