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.
    评论

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条