找到你要的答案

Q:php progress bar through database

Q:PHP的进度条,通过数据库

I need to run long (mintues to hours) matlab code on server side and send the user its progress status (0-100%). I can't send the data directly to client-side because the client may disconnect and check the status hours later.

Should I do it through the database? Thought about updating the database through matlab/php while the client side (php via javascript/ajax) can query the database every few seconds but I am afraid its very "expensive" (many read & write operations for only one user).

What should I do? by the way, its an internal network, dozenes of users, no more.

我需要跑长(分钟,小时)的matlab代码对服务器端和用户发送其进展状况(0-100%)。我不能直接发送数据到客户端,因为客户端可能断开并检查状态小时后。

我应该通过数据库来做吗?想通过MATLAB / PHP更新数据库,而客户端(PHP通过JavaScript、Ajax)可以查询数据库,每隔几秒钟,但恐怕很“昂贵”(许多阅读&;只有一个用户写操作)。

What should I do? by the way, its an internal network, dozenes of users, no more.

answer1: 回答1:

You did not mention the kind of database you are using. If it is mysql and since you are only in an internal network with some dozens users: yes you can use the database. If you want to keep read/write-operations low, you can use the MEMORY-Database-Engine for that purpose.

Also, you can use Memcache for interprocess-communication. One process writes into memcache, and another process reads the value out.

You did not mention the kind of database you are using. If it is mysql and since you are only in an internal network with some dozens users: yes you can use the database. If you want to keep read/write-operations low, you can use the MEMORY-Database-Engine for that purpose.

另外,你可以使用memcache用于进程间通信。一个进程写入到缓存,而另一个进程读取值。

php  database  matlab  progress-bar