So I have my database on the server. That holds all the information on this site. And then I have a bunch of PHP scripts that look at the incoming browser, check for cookies, and then assemble the correct page out of the database.

But I also have a copy of that setup on the machine sitting on my desk (the server is in California, I'm in NYC.) When I'm making big changes I do it on my machine, and then once it's running locally I transfer everything up to the server.

One possibly interesting thing I noticed the last time I did this is that I can also have all the PHP scripts running locally, but accessing the remote database. Hmmm. So I started wondering how much load it would save on the server if all the scripts ran locally (but still accessed the servers database.) And now I've started thinking about having the database local too, as well as keeping a second database centralized on the server.

Here's how it would work. Everything (apache, php, mysql) runs local on my machine. I can make pages, post, edit just like before. All changes effect the setup on my machine. But then each page also has a setting for whether it should be synched to the central server as well. If so, then every post is made to the local machine, and then if the local machine is connected to the internet, the post is also sent to the central server. If the local machine is not connected then a flag is set, and the next time a connection is established, all the new posts are sent to the server.

And then the reverse would have to be true also. On the central server I view pages (some of which are mine, some of which are other people on this site.) For each page I choose whether to mirror it to my local machine. Then when my machine checks in with the central server it looks at the last time stamp for every page I am mirroring and updates my local database where necessary.

This setup would be especially good on a laptop (or smaller machine.) That way I could always be adding to the site, regardless of internet connectivity, and everything would synch up as soon as possible. Also, having the data mirrored in a lot of places has obvious anti-catastrophe appeal.

I'm going to keep thinking about this. I haven't really gotten to the heart of it yet.
- jim 5-20-2002 7:02 pm




add a comment to this page:

Your post will be captioned "posted by anonymous,"
or you may enter a guest username below:


Line breaks work. HTML tags will be stripped.