Re: Building a scalable Control Panel In PHP Question . . .
| From: | Jonathan Chum | Date: | Sun, 15 Sep 2002 04:30:00 +0000 |
| Subject: | Re: Building a scalable Control Panel In PHP Question . . . | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116417@lists.php.net to get a copy of this message | ||
Well,
The plan is that the daemon or service will sit alone which will scan the
database for changes. The config file can only be processed one at a time.
If there are 10 users online at that very moment, one person wants to
suspend an account, another wants to create a new account, another wants to
delete an account, the list goes on. However, the daemon or service scans
the database, making the changes one at a time to insure that the file does
not become corrupted.
So there will be one instance of the interface for the control panel sitting
on any dedicated box to handle user intervent
Anytime a new server needs to be added, another daemon/service is installed
and run which listens and scans for changes when they occur for that
particular server it's scanning changes for.
What I'm worried about is that the script in the future may need to execute
some commands that might take a while to execute. Therefore it cannot wait
for it to complete. However, it should also not start another child process
if the previous one is not done to prevent corruption of data. So it should
wait till the first child process complete before starting another.
There's a lot of ways, but all of them have limitations. Not sure of the
best possible way to handle it. . .
"Jeremy Wilson" <jwilson@intravative.com> wrote in message
news:003401c25c49$269c2310$4ac23342@intravative.com...
> Make sure that you implement file locking into your application if you
> work directly with the files so that way your config file will not
> become corrupt when multiple clients are accessing it.
>
> I don't know your skill level, but I would recommend writing a Windows
> 2000 service in C++ or Visual Basic .NET (you need something
> multi-threaded) that will take care of the processing of your database
> updates and converting them into your config files. Use PHP to process
> the web based "requests" for config file updates, and then use the
> Windows 2000 service to process all the requests. The problem with using
> php in windows 2000 cron situations at the operating system level is
> that it is pretty undependable.
>
> I would not recommend installing the script in several locations on all
> the different boxes. Do you have any NAS (network attached storage) in
> your infrastructure? You can setup just one script and then virtually
> map the path to that script from apache. That way if you ever need to
> upgrade your script or fix a bug, you only have to do it in one location
> and not in several. It will make the code, version management and file
> administration much easier in the future.
>
> You can also do the same thing with the windows 2000 service. Set it up
> as a network installation and then just use your service control panel
> in windows 2000 to map it to the NAS location. Also, with a windows 2000
> service, you can set actions if your service stops responding or if
> anything weird happens.
>
> I have several e-books from Microsoft Press that might help you in
> creating your Windows 2000 service. Email me directly if you would like
> to get a copy of them and I can email them to you.
>
> -----Original Message-----
> From: Jonathan Chum [mailto:jchum@jps.net]
> Sent: Saturday, September 14, 2002 3:14 PM
> To: php-general@lists.php.net
> Subject: [PHP] Building a scalable Control Panel In PHP Question . . .
>
>
> I've just started work on building a control panel in PHP to manage web
> hosting services (Apache, Sendmail, Bind, etc.).
>
> Considering the security risks involved and possible data corruption if
> there are several users online attempting to write to a conf file, I'm
> taking the approach of seperating the user interface from the script
> that writes to the system. That is, the user only interfaces to the
> database.
>
> Now, I'm trying to figure out how should I take the data from the
> database, possibly by scanning the database for changes then write it to
> a file. I'm also taking into consideration of how to scale to Windows
> 2K.
>
> I have a few ideas that sounds good, but could be a problem. Let me
> explain. . . I was going to code a seperate script that sits on each
> server at URL under a SSL link which will have to authenticate to get
> through. This script will capture POST data and returns data
> accordingly. This allows me to scale to another machine easily by just
> installing a script.
>
> The issue is that if Apache dies, then it needs to send data to a
> machine, it will cause some issues. Also, if a POST was made to that
> URL, if it takes a while to return data back, Apache could just time out
> on the request.
>
> So that's probably not a good idea.
>
> Another application I reviewed coded up a daemon using PCNTL to control
> child processes or run interactively. This would be feasible on *NIX
> machines, but not sure how well it scales to a Windows machine. Maybe
> recoding the daemon as a service.
>
> Is there any other ideas out there would be even better?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>