Auriga Posted October 27, 2006 Share Posted October 27, 2006 Hi there!I have a VPS containing some domains of mine. Each domain will only be able to see it's own dedicated space (folders) on the server. Also, each will get some data from a central database using a php file that contains the queries. This database is located on a dedicated domain, and cannot be directly polled by any of the other domains. This because the database is too large to be copied to every domain.To get text from the database (poll the database), i use a script located on that central domain (with the database). This PHP script is called as follows:print include($PATH_TO_CENTRAL_FILE.'?param=$param');$param will give the necessary information to the database (will be put in the query) to get the data from it. The data that the file gets from the database will be send back to the resp. webpage and printed there.When i ran the webpage on the domain, i noticed that it's very slow. Now I ran the linux command ab (Apache Benchmarking) on this webpage. Here are the results for different scenarios:Without database polling, without the include (the file at $PATH_TO_CENTRAL_FILE is not used at all in the webpage):137.36 #/secThe file will only return text, no database polling (no queries run on the database):0.73 #/secThe file will poll the database, but not return any results (the webpage gets an empty string):0.96 #/secThe file will poll the database and send the results to the webpage (normal scenario):0.79 #/secIt appears that whenever I send data back from an included PHP file, the webpage gets incredibly slow. Notice that the webpage still is very slow if i do not poll the database (no query is executed)! (?!)Therefore, I think it has something to do with the way that inclusions of different (absolute) paths are handled by PHP versus calling a procedure inline your html code. If you include a file usingprint include(http://www.mydomain.com/.../afile.php?params=$params);seems to be a lot slower thaninclude(afile.php);and then callprint myFunctionInFile($params);with afile.php in the same folder as the webpage.Do I make any sense at all? And if so, does anybody know a way to speed things up?Thanks in advance!Evarest Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 27, 2006 Share Posted October 27, 2006 Try.require_once(what_ever.php); Quote Link to comment Share on other sites More sharing options...
Auriga Posted October 27, 2006 Author Share Posted October 27, 2006 Thank you for your suggestions! However it didn't work... It's still as slow as before... Any other suggestions? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.