|
Posted by rich on 11/16/06 17:56
David T. Ashley wrote:
> "rich" <rbrooks@gmail.com> wrote in message
> news:1163690515.482621.145940@b28g2000cwb.googlegroups.com...
> > My question is is there a way to make a connection to mysql that
> > multiple instances of an object will use together? I'm under the
> > impression that something like a singleton would only live on a per
> > instance basis, or am I incorrect?
>
> We'd all need to know a little bit more about your application, and whether
> the updates have to be done right away.
>
> The obvious solution that comes to mind is just to have each PHP web process
> append to a file, and have a separate daemon that flushes the file to the
> database. Unix file semantics guarantee that there is a way to do this with
> guaranteed results (for example, the daemon mv's the file then operates on
> it ... this guarantees that any append operations either occur before or
> after the mv but won't collide with it).
>
> You could have the daemon just look at the file from time to time (once a
> second?), or you could use a more fancy triggering mechanism.
>
> They key design factor seems to be whether the database updates have to
> complete by the time the PHP web script ends ...
>
> Dave.
No, it doesn't have to be instant, and I definitely thought about this
method. At this point though, it seems like if the application can
hold a connection, it would be a heck of a lot bigger than batching
these inserts. I just don't know if it can. Perhaps an import would
be better anyway for performance reasons...
[Back to original message]
|