knetcozd Posted January 2, 2010 Share Posted January 2, 2010 Recently i built a template system , to get page requests through the get query string , any case i use my index.php to initialize all core constants , objects etc... , every request goes through my index page , i also initialize 1 database object in the index page called db( instance of my own MYSQL abstraction layer) and every other page on my site utilizes this object for database queries. What i would like to know is , will i experience any performance issues due to this ,when the site receives hundreds or thousands of requests? and lastly should i rather create a new DB instance on every page that would interact with the database and destroy that instance on each pages? Link to comment https://forums.phpfreaks.com/topic/186924-database-performance/ Share on other sites More sharing options...
Mchl Posted January 2, 2010 Share Posted January 2, 2010 It's better to have single connection for whole application that to create a new one for each page. Link to comment https://forums.phpfreaks.com/topic/186924-database-performance/#findComment-987078 Share on other sites More sharing options...
Daniel0 Posted January 2, 2010 Share Posted January 2, 2010 I'm not sure what you mean with a "page". Under normal circumstances, objects and other kind of resources do not persist across multiple requests. Link to comment https://forums.phpfreaks.com/topic/186924-database-performance/#findComment-987079 Share on other sites More sharing options...
knetcozd Posted January 2, 2010 Author Share Posted January 2, 2010 by page i mean , that all requests that come to my website go through the index page , like so : index.php/page/mypage1 index.php/page/mypage2 // and so on the index page then requires the appropriate file into the index page , therefore those other pages never get called directly(similar to MVC), but thanks Mchl , i was thinking the same , was just unsure. Link to comment https://forums.phpfreaks.com/topic/186924-database-performance/#findComment-987101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.