|  | Posted by Jerry Stuckle on 01/26/08 01:33 
Martin wrote:> On Fri, 25 Jan 2008 11:27:00 -0800 (PST), ZeldorBlat
 > <zeldorblat@gmail.com> wrote:
 >
 >> On Jan 25, 11:25 am, Martin <martinval...@comcast.net> wrote:
 >>> I have a series of php scripts that provide the user interface to an
 >>> industrial automation program.
 >>>
 >>> One of the scripts serves out a page  which displays some data, some
 >>> of which is constantly changing. On that page, I have some AJAX code
 >>> running that frequently requests fresh data and displays it
 >>> (frequently means about once a second).
 >>>
 >>> When the php script that services the AJAX requests receives one, it
 >>> passes a request of its own over to the main process (via a socket)
 >>> which responds with some data which the script then sends out to the
 >>> browser page.
 >>>
 >>> This all works fine but I'm concerned about the load this exchange of
 >>> data places in the main process.
 >>>
 >>> What I'm wondering is: would it be possible that I could have my main
 >>> process send its data (in real time) to "something" in the php system
 >>> such that the php script could access this data much like it accesses
 >>> its own global variables? IOW, the script would have immediate access
 >>> to the values instead of having to request them from the main process.
 >>>
 >>> Please understand that all of this activity is running on one computer
 >>> and this is all confined to an inTRAnet (there's no internet access
 >>> involved). And, this one computer is entirely under my control. I am
 >>> free to do what ever needs to be done with regards to php
 >>> configuration, security settings, etc.
 >>>
 >>> Any recommendations?
 >>>
 >>> Thanks.
 >> Sounds likes a database would work just fine.  The main process can
 >> update values in the database and the PHP script can read them
 >> whenever it needs to.  Or perhaps I'm missing something larger here...
 >
 > Yes, I agree -  a database probably would work ok. But, even then,
 > there would be a lot of disc activity. I'm thinking that if the data
 > could be stored in memory somewhere/someway, then the processing time
 > would be minimized.
 >
 > I'm also thinking that if the processing time is minimized, then I
 > could speed up the frequency of the AJAX requests (and thus provide a
 > more real-time appearance to the viewer's screens).
 >
 >
 >
 
 Your limitation is probably going to be network, not disk activity.
 
 Also, databases and your OS cache a lot of data.  You can store it in
 memory, but then you're going to go through a lot of trouble (and CPU
 cycles) retrieving and sorting it.
 
 Allow the database to do its job.
 
 --
 ==================
 Remove the "x" from my email address
 Jerry Stuckle
 JDS Computer Training Corp.
 jstucklex@attglobal.net
 ==================
  Navigation: [Reply to this message] |