dongmeijian1716 2009-08-22 14:10
浏览 71
已采纳

对来自php的数据库写入响应缓慢

I have my PHP scripts running on the WAMP server. Here's what i am doing

  1. PHP script A that queries the database and gets a set of rows (I have set the set_time_limit (0) // unlimited time for the script to execute )
  2. Based on the result set I execute a tcl script for each row of the result set
  3. The TCL script takes about a minute to execute , it also inserts some data to the same database
  4. Now simultaneously when the TCL script is executing , if i execute another PHP script that writes in to the database , I am not able to do it as the response time is too slow. It infact waits for the PHP script A/TCL script to complete
  5. However during this time, reads from the database is fine and quick

Does anyone has any suggestions ?

Regards, Mithun

  • 写回答

1条回答 默认 最新

  • dongleiqiao2107 2009-08-23 01:49
    关注

    A Session cannot be shared by concurrent scripts. Any new requests which try to session_start() will hang at this point waiting for the previous script end.

    As your script is taking undetermined time to end, its a good idea to session_write_close() right after obtaining all information it needs from the $_SESSION superglobal, so concurrent requests won't hang anymore.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算