dongzhi4073 2016-03-20 11:33
浏览 35

为PHP脚本实现循环仲裁器

On my server, I have several PHP scripts running simultaneously that should use the same interface. They call the interface randomly.

That interface has limited "buses" it uses for the call. What I want to do is to add a round robin arbiter, that will direct each subsequent call to the next "bus".

I can do it with php and mysql. I can write a small program that stores the current round robin position, and when there is an interface call, it outputs that position, and increment the position in the database.

Since there are quite a lot of calls to that interface, I am thinking whether it is the most efficient way to do it. I feel that there must be a way to keep the program always running in the background in-memory, with the round robin as a variable. Mysql feels like an inefficient over kill. I might be wrong.

Some other options that I was thinking about are using java for the program and sockets to communicate with php, or using node.js

What do you think will be the most efficient solution for this arbiter?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100