Page 1 of 1

PostPosted: Fri Mar 24, 2006 10:31 am
by shannah
I like using INI files to store configuration, but it occurs to me that there are potential performance gains by storing the configuration in the database. I have factored out all configuration loading into a new class called Dataface_ConfigTool which will allow loading and saving configuration to multiple forms off datasource transparently. The support for INI files will continue indefinitely. The idea is that sites can be migrated back and forth from INI file configuration to database configuration with the click of a button. Database configuration is available for sites that need the performance boost.

One other benefit of using the Database for configuration is that we can use Dataface to edit the configuration info. The use case uncovered some deficiencies in Dataface that will have to be remedied as I would like to have the equivalent of a Filemaker 'Portal' field to be able to edit related records in a grid format from the "edit" form of the master record. It will also be nice to have heirarchical select lists (i.e., when you select an option from list #1, the options in list #2 change to be relevant to what was chosen in list #1).

PostPosted: Sat Mar 25, 2006 11:26 am
by shannah
I have completed a skeleton implementation of database configuration along with a rough migration script to migrate from ini config to db config. After some preliminary tests it appears the database configuration stands to improve configuration loading performance by 25 to 50%. The percentage of time required to load the configuration (compared to doing the rest of the duties of the script) range from 75% down to 15% on some of the more complicated pages. This means that using database configuration will increase total performance by 5% to 30% depending on the page you are trying to load.

The real benefit of database configuration, however, will be the ability to edit the configuration through the web using Dataface as an interface.

These features are still rough so it will take a little while before they are ready to roll out.. but just a look at what is coming.

Storing Configuration in Database

PostPosted: Tue Aug 11, 2009 1:49 pm
by pwykes
Hi:

Just wandering where this stands as I don't see it documented anywhere. I've been playing with Xataface after reading about it in PHPArchitect and I agree it would be a better to store configuration information in a database instead of in ini files.

Thanks.

PostPosted: Tue Aug 11, 2009 2:21 pm
by shannah
I did quite a bit of experimentation a few years back with storing the configuration in the database. I was hoping to get some performance improvements, but found that there were none to be had down that avenue.

I ultimately chose not to pursue this direction further because I didn't see a whole lot of benefits. It would introduce new security concerns and it just didn't seem to offer very much on the up side.

The configuration tool is plugable though. Perhaps I'll get around to documenting the interface so that others can develop their own configuration modules and store the config in their own way ...

PostPosted: Tue Aug 11, 2009 3:02 pm
by pwykes
Thanks for your quick response. The main benefit I see is I think it would make configuration easier rather than dealing with a bunch of text files. Performance wasn't really my main concern. If you end up documenting the interface, that would be great - I'd be very interested in taking a crack at it.

Thanks for making Xatabace available - it is very impressive.

PostPosted: Thu Sep 03, 2009 1:13 pm
by cyberws
While I understand the desire to store configs in the database I would personally vote against it. When working on an application it is always wise to reduce database server load which includes reducing the number of queries.

If someone wants performance gains, and have a VPS or dedicated server, try the following:

http://kevin.vanzonneveld.net/techblog/ ... ing_tmpfs/

Also depending on the operating system in use some OSes will cache files in RAM when there is free RAM not in use by applications.

For many ideas on performance I would suggest the following article:

http://kevin.vanzonneveld.net/techblog/ ... webserver/

For PHP performance gains see PHP accelerators like APC.

PostPosted: Thu Sep 03, 2009 2:13 pm
by shannah
Thanks for the tip on tempfs. I will have to give it a try. If you have APC installed, Xataface already uses it to cache as much of the configuration as possible to help with performance.

Re: Storing Configuration in the database

PostPosted: Fri Jan 07, 2011 9:39 am
by ururk
(I realize this is an old thread)

One possible way around the performance issues (eg, constantly looking up information from the database), is to have the database tool write out the config files. So there would be a GUI to edit and publish the config files, but the end result would be static files.