Re: Re: Clone of the concurrent users limit of Zend Encoder 4.0 ?

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

 



Curt Zirzow wrote:
On Sat, Feb 11, 2006 at 12:48:50PM +0800, HoWang Wang wrote:

HoWang Wang wrote:

Hi all,

The Zend Encoder 4.0 (beta) have a new function in the license manager
which can limit the number of concurrent users. I have wriiten something
to work like it. But I found a problem. My script can limit the number
of concurrent running script only. When the script ends, there is some
data remain in the buffer (of Apache, I think) and the client connection
is still active! How can I solve this? Please help, Thanks.

Regards

Is it really impossible? Can I do it with Connection Handling?


It is really unclear on exactly what you are doing and i have no
clue what data is remaining in what buffer you think might be the
problem.

<?php
   set_time_limit(0);
   ignore_user_abort(true);
   // add 1 to the number of concurrent users
   // the rest of code
   while (!connection_aborted()) {
       // keep on locking
   } else {
       // release lock
   }
?>


You really dont want to do this. By doing that while loop, you will
do a couple of bad things:

   - eating up a lot of CPU usage, of course a sleep in the loop
     would probably prevent cpu abuse but still not the ideal way
     to do it.
   - You will most likely run out of available slots that http has
     available.


Curt.

Let me give an example:

on fileplanet.com, they have something so called "download slot" and "lines". They limit the number of concurrent downloads. If there are too many users, they will disallow new user to download their files. As I know, they do it with custom HTTP server.

PHP run very quickly & pass all contents to Apache within 0.000X second. But the web server usually have to take up 1 or more seconds to send all the contents to the client. Is it possible to limit the concurrent users (including the users receiving data but the php script already finished) with PHP?

Please reply, thanks to all.

Regards

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