Storing Configuration in the database

A place to discuss development of the Xataface core.

Postby shannah » Fri Mar 24, 2006 10:31 am

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).
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Sat Mar 25, 2006 11:26 am

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.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Storing Configuration in Database

Postby pwykes » Tue Aug 11, 2009 1:49 pm

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.
Paul D. Wykes
pwykes
 
Posts: 2
Joined: Mon Aug 10, 2009 1:47 pm

Postby shannah » Tue Aug 11, 2009 2:21 pm

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 ...
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby pwykes » Tue Aug 11, 2009 3:02 pm

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.
Paul D. Wykes
pwykes
 
Posts: 2
Joined: Mon Aug 10, 2009 1:47 pm

Postby cyberws » Thu Sep 03, 2009 1:13 pm

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.
Last edited by cyberws on Fri Sep 04, 2009 9:22 am, edited 1 time in total.
cyberws
 
Posts: 19
Joined: Wed Jul 01, 2009 10:32 am

Postby shannah » Thu Sep 03, 2009 2:13 pm

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.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Storing Configuration in the database

Postby ururk » Fri Jan 07, 2011 9:39 am

(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.
ururk
 
Posts: 18
Joined: Mon Nov 01, 2010 12:31 pm


Return to Xataface Developers

Who is online

Users browsing this forum: No registered users and 20 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved