Kiran Divakaran wrote: > A flat file is created by a running process which dumps useful information > about system statistics. > > Now this data is to be archived for viewing later. So to minimize performance > overheads , it was thought that a separate process will read this flat file > and upload this > Information into the database. > > Making db_connect calls within the process writing to the flat file is not > possible as it is time critical.
Huh? Leave the process that is gathering information running. Starting and stopping processes is likely to be more expensive than connecting to a database (it takes 5-10 milliseconds to connect to a modern database). If, even after doing that, performance is a serious issue, start a separate internal thread within the process that will manage the database queries and then protect a linked list with a mutex that will act as a conduit for the data to be sent to the database. And then there is proper database table design for high performance scenarios: Disable foreign key constraints, don't use indexes, disable ACID* (or just don't use a table type that uses ACID - e.g. MySQL's InnoDB uses ACID but MyISAM does not), and other database optimization techniques that speed up INSERT queries. * http://en.wikipedia.org/wiki/ACID -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
