Re: Testing MySQL 4.0 ; detaching queries
| From: | Ben Gollmer | Date: | Wed, 28 Nov 2001 01:50:01 +0000 |
| Subject: | Re: Testing MySQL 4.0 ; detaching queries | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75828@lists.php.net to get a copy of this message | ||
Look at http://www.php.net/manual/en/function.exec.php.
You could just exec() the page again, with a parameter telling it to use the test server, like so:
<?php
//page start
if($do_again)
{
//connect to test server and do queries
}
else
{
//connect to production server, do the usual stuff
exec("lynx http://www.mysite.com/mypage.php?do_again=1 > /dev/null");
}
//and so on
?>
As long as you redirect the exec()ed command to a file (or /dev/null), it will return immediately. Of course, this sample code will only work on *NIX with lynx installed. You could also build php as a standard binary and exec() it (which also works on Win32).
Ben
On Tuesday, November 27, 2001, at 06:15 PM, Steven Roussey wrote:
We are planning to test MySQL v4.0.1 (multiple tests -- MyISAM and InnoDB) with live queries from our server in order to get real world testing of its stability with the same mix of queries we would send it if it were the production SQL server. The plan, at the moment, is to send a second query to the test server after sending it to the live one. This gets both inserts/updates as well as selects. Since the production app server will be doing this, we don't want a failure on the test SQL server to slow things down or cause a failure to the production environment. Two things we need in order to do this: 1. PHP should test connection to test MySQL server with timeout, so we don't wait if test MySQL server is down or unavailable (mysql_connect will wait for a long time). This is easy. Ideally, mysql_connect would have a timeout, but its not a showstopper. 2. PHP needs to send the query to the test server and continue WITHOUT results. At first we are not testing the validity of the queries. Its better to check elsewhere. Right now we don't want this testing to adversely affect the service in production. So either we need a way to have PHP detach the query (or run it asynchronously), or have the test MySQL server immediately return even though the query continues (this is my preference). This implies that every query will create a new connection. Is this a reasonable test? The timing won't be identical, but its as close as I can imagine getting. Any thoughts on how to accomplish this? Sincerely, Steven Roussey http://Network54.com/?pp=e --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual)http://lists.mysql.com/ (the list archive)To request this thread, e-mail <mysql-thread92430@lists.mysql.com> To unsubscribe, e-mail <mysql-unsubscribe- ben=jatosoft.com@lists.mysql.com> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php