doudao1282 2010-02-20 13:20
浏览 26
已采纳

在运行PHP脚本之间传递数据

For multiple running PHP scripts (10 to 100) to communicate, what is the least memory intensive solution?

  • Monitor flat files for changes
  • Keep running queries on a DB to check for new data

Other techniques I have heard of, but never tried:

  • Shared memory (APC, or core functions)
  • Message queues (Active MQ and company)
  • 写回答

2条回答 默认 最新

  • douben1891 2010-02-20 13:35
    关注

    In general, a shared memory based solution is going to be the fastest and have the least overhead in most cases. If you can use it, do it.

    Message Queues I don't know much about, but when the choice is between databases and flat files, I would opt for a database because of concurrency issues.

    A file you have to lock to add a line to it, possibly causing other scripts to fail to write their messages.

    In a database based solution, you can work with one record for each message. The record would contain a unique ID, the recipient, and the message. The recipient script can easily poll for new messages, and after reading, quickly and safely remove the record in question.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?