weixin_33675507 2011-03-23 05:44 采纳率: 0%
浏览 23

max_user_connections和ajax

Certain pages on my site are populated via numerous ajax calls, often 20+ ajax calls running asynchronously. The problem I'm having is that each call is creating a new mysql_connection, causing me to receive the 'max_user_connections' error, which I'm told is capped off at 20. I've tried turning async off, but as the JQuery documentation states, this will often freeze up the page. I have considered turning this into 1 ajax call and letting php perform the loop, but the idea was to display each element as it becomes available (some of the data is gathered from external sources, thus the timing can vary)

Is this something that can be fixed with mysql_pconnect?

  • 写回答

2条回答 默认 最新

  • weixin_33671935 2011-03-23 08:12
    关注

    20+ Ajax calls are a concern even in absence of MySQL issue. Browser would not make these 20 calls simultaneously since it caps max http connection (to a single domian) to 2,4 or 8.

    I would combine these requests and bring number of Ajax calls down to 6 - 8. As you mentioned, rest of calls get data from external sources. Do these calls talk to MySQL as well?
    In addition, these things might help:

    1. Can you cache some of things (E.g. username , user full name) in http session
    2. Can you cache some data out of MySQL into memcached or even a file ? When data becomes available, cache can be updated.
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器