这个贴子是
http://topic.csdn.net/u/20110517/13/8776eb52-672a-45ac-946e-7aa7a3c7e33b.html
的继续。现在这个问题似乎还是没有解决我重新编写了index.php,现在index.php不再调用数据库,甚至都包含操作mysql的类文件。
a.php也不调用数据库,它只执行采集的任务。
a.php与index.php是两个独立文件,它们共同包含了另外两个文件(这两个文件中并不执行任务,只是函数),现在的情况是在执行a.php进行采集时,index.php却打不开,等a.php采集完成后index.php才能正常打开。请问这是哪儿出现了问题?
同时,我观察了在执行a.php进行采集时,电脑的CPU和内存消耗并无显明变化。

解决方案 »

  1.   

    这个应该和你环境配置当中的PHP线程数量有关,举个例子,你PHP一个进程,然后有10个线程,现在有10个人同时请求,就相当有有10个并发,那么就交给10个线程同时处理,这样没有问题,但是如果有11个人同时请求,就有1个请求没有PHP线程去处理了,需要排队,当前10个有一个处理完了,空闲一个出来了,才能处理第11个
      

  2.   

    弄明白了,是SESSION的问题。
    http://surmise-sky.com/thinkin-about-php-session-lock-operation/PHP locks the session file until it is closed. If you have 2 scripts using the same session (i.e. from the same user) then the 2nd script will not finish its call to session_start() until the first script finishes execution.
    If you have scripts that run for more than a second and users may be making more than 1 request at a time then it is worth calling session_write_close() as soon as you’ve finished writing session data.