Re: [PHP4BETA] Re: yet another Session oddness/bug?
| From: | waltb | Date: | Wed, 29 Mar 2000 19:29:59 +0000 |
| Subject: | Re: [PHP4BETA] Re: yet another Session oddness/bug? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12817@lists.php.net to get a copy of this message | ||
Hi Peter,
I have included my test app. Its pretty straight forward.
To compile it just do
gcc -o test test.c -lpthread
That should work on a linux box.
I'm still trying to track down where my session problems are coming from.
This test app assumes that you have a php script which outputs COUNT=<val>;
The app looks for COUNT=<val here>; to find the value of the session variable.
In this case it should increase by 1 each time through the loop for each thread
that is hitting it.
I just ran a test last night using 3 different machines to simultaneously hit
the
web server. Each run was 100 threads running 20000 iterations, and about
10% of the threads failed to get the final result of 20,000 for the session
variable.
It looks like it may have a hard time starting a lot of sessions at the same
time, but
I do have 64 apache processes running on the web server.
so I have a test page which is
<?
session_start();
?>
<html>
<?
if (!isset($count))
{
session_register("count");
$count = 1;
echo "\nNEW SESSION\n";
}
else
$count++;
?>
COUNT=<? echo $count; ?>;<br>
</html>
Peter Kovacs wrote:
> Could I take a look at your test app? I'm using mysql to store sessions
> (I can share the definitions with you if you like, as I got them off the
> list). I haven't tested the database sessions under a heavy load yet.
>
> Thanks,
> Peter
>
> On Tue, 28 Mar 2000, waltb wrote:
>
> > Howdy again,
> > I've been doing even more testing with this and sessions just seems to be
> >
> > very flaky to me under a decent load.
> >
> > Here is another output where I had the value of my session variable
> > got blown away. It was working just fine for 29 requests, and then
> > all of a suddon the value got nuked and changed. Here is the output
> > of the test. During test 30 (RESPONSE(30), you can see that
> > the $count variable got changed from 29 to 2. There are no other
> > threads using this session id. I can give out my test app freely if
> > anyone wants to look at it. It's pretty straight forward.
> >
> > ...
> > RESPONSE(28)
> > HTTP/1.1 200 OK^M
> > Date: Wed, 29 Mar 2000 20:39:40 GMT^M
> > Server: Apache/1.3.12 Ben-SSL/1.39 (Unix) PHP/4.0b5-dev^M
> > Set-Cookie: Apache=10.1.0.69.14067954362380798; path=/^M
> > X-Powered-By: PHP/4.0b5-dev^M
> > Expires: Thu, 19 Nov 1981 08:52:00 GMT^M
> > Cache-Control: no-cache^M
> > Pragma: no-cache^M
> > Connection: close^M
> > Content-Type: text/html; charset=iso-8859-1^M
> > ^M
> > <html>
> > COUNT=28;<br>
> > </html>
> >
> > REQUEST(29) GET /rc/php/test/test_session.php HTTP/1.0
> > User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.12-20 i686)
> > Host: 10.1.0.80
> > Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png
> > Accept-Encoding: gzip
> > Accept-Language: en
> > Accept-Charset: iso-8859-1,*,utf-8
> > Cookie: PHPSESSID=e202710a7f3217f80f74aa5a21602c85
> >
> >
> > RESPONSE(29)
> > HTTP/1.1 200 OK^M
> > Date: Wed, 29 Mar 2000 20:39:40 GMT^M
> > Server: Apache/1.3.12 Ben-SSL/1.39 (Unix) PHP/4.0b5-dev^M
> > Set-Cookie: Apache=10.1.0.69.14092954362380804; path=/^M
> > X-Powered-By: PHP/4.0b5-dev^M
> > Expires: Thu, 19 Nov 1981 08:52:00 GMT^M
> > Cache-Control: no-cache^M
> > Pragma: no-cache^M
> > Connection: close^M
> > Content-Type: text/html; charset=iso-8859-1^M
> > ^M
> > <html>
> > COUNT=29;<br>
> > </html>
> >
> > REQUEST(30) GET /rc/php/test/test_session.php HTTP/1.0
> > User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.12-20 i686)
> > Host: 10.1.0.80
> > Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png
> > Accept-Encoding: gzip
> > Accept-Language: en
> > Accept-Charset: iso-8859-1,*,utf-8
> > Cookie: PHPSESSID=e202710a7f3217f80f74aa5a21602c85
> >
> >
> > RESPONSE(30)
> > HTTP/1.1 200 OK^M
> > Date: Wed, 29 Mar 2000 20:39:40 GMT^M
> > Server: Apache/1.3.12 Ben-SSL/1.39 (Unix) PHP/4.0b5-dev^M
> > Set-Cookie: Apache=10.1.0.69.14073954362380807; path=/^M
> > X-Powered-By: PHP/4.0b5-dev^M
> > Expires: Thu, 19 Nov 1981 08:52:00 GMT^M
> > Cache-Control: no-cache^M
> > Pragma: no-cache^M
> > Connection: close^M
> > Content-Type: text/html; charset=iso-8859-1^M
> > ^M
> > <html>
> > COUNT=2;<br>
> > </html>
> >
> >
> >
> >
> >
> >
> > > Howdy folks,
> > > I'm working on writing a C test application to test the robustness of
> > > sessions.
> > > I basically need to validate to myself that I can use this on a very
> > > high traffic site.
> > > So I wrote a simple multithreaded app that just makes simple http
> > > GET requests
> > > for a small php page that I wrote. The only thing that this app does is
> > > spawn off
> > > n number of threads to make x number of back to back requests of the
> > > same url.
> > > It parses out the PHPSESSID cookie from the response header the first
> > > time it
> > > sees it, to use in subsiquent GET requests to maintain the session.
> > > Below is my simple php page which gets called over and over for each
> > > thread.
> > > <?
> > > session_start();
> > > ?>
> > > <html>
> > > <?
> > > if (!isset($count))
> > > {
> > > session_register("count");
> > > $count = 1;
> > > echo "\nNEW SESSION\n";
> > > }
> > > else
> > > $count++;
> > > ?>
> > > COUNT=<? echo $count; ?>; times.<br>
> > > </html>
> > >
> > > My problem I'm having is that I'm seeing a session not really working
> > > properly.
> > > Below is the output of my app. I have the output of all of the threads
> > > going to individual
> > > files, so I can make sense of the output.
> > >
> > > As you see from the output (below), the app makes 2 requests for the
> > > same file on the server.
> > > The first request gets a response to set the PHPSESSID cookie and the
> > > output of the
> > > php script shows that the session is new and the count variable's value
> > > is 1.
> > > The app then makes the second request for the same file on the server
> > > with the
> > > PHPSESSID cookie set with the appropriate value. The problem is the
> > > second
> > > response. According to the second response, the session variable $count
> > > wasn't
> > > set, and so it re-registers the variable again and the assigns it to 1
> > > again. This seems
> > > like a bug to me.
> > >
> > > The really odd thing is, this only happens when I run the test app on a
> > > different machine
> > > then the web server. If I run the test app on the same machine as the
> > > test server sessions
> > > seem to start and work appropriately.
> > >
> > > Does anyone have any ideas of what I might look at? Is this a bug?
> > > Could the server
> > > GET requests be malformed?
> > >
> > > Thanks
> > > Walt
> > >
> > > thread 1 started
> > > GET /rc/php/test/test_session.php HTTP/1.0
> > > User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.12-20 i686)
> > > Host: 10.1.0.69
> > > Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png
> > > Accept-Encoding: gzip
> > > Accept-Language: en
> > > Accept-Charset: iso-8859-1,*,utf-8
> > >
> > > REQUEST(0) GET /rc/php/test/test_session.php HTTP/1.0
> > > User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.12-20 i686)
> > > Host: 10.1.0.69
> > > Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png
> > > Accept-Encoding: gzip
> > > Accept-Language: en
> > > Accept-Charset: iso-8859-1,*,utf-8
> > >
> > > RESPONSE(0)
> > > HTTP/1.1 200 OK^M
> > > Date: Wed, 29 Mar 2000 04:28:24 GMT^M
> > > Server: Apache/1.3.12 Ben-SSL/1.39 (Unix) PHP/4.0RC1^M
> > > Set-Cookie: Apache=10.1.0.79.2060954304104670; path=/^M
> > > X-Powered-By: PHP/4.0RC1^M
> > > Set-Cookie: PHPSESSID=793e2564f9581b193f6f732a9c075aba; path=/;
> > > domain=.rocketcash.com^M
> > > Expires: Thu, 19 Nov 1981 08:52:00 GMT^M
> > > Cache-Control: no-cache, post-check=0, pre-check=0^M
> > > Pragma: no-cache^M
> > > Connection: close^M
> > > Content-Type: text/html; charset=iso-8859-1^M
> > > ^M
> > > <html>
> > >
> > > NEW SESSION
> > > COUNT=1; times.<br>
> > > </html>
> > >
> > > New COOKIE: PHPSESSID=793e2564f9581b193f6f732a9c075aba
> > > REQUEST(1) GET /rc/php/test/test_session.php HTTP/1.0
> > > User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.12-20 i686)
> > > Host: 10.1.0.69
> > > Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png
> > > Accept-Encoding: gzip
> > > Accept-Language: en
> > > Accept-Charset: iso-8859-1,*,utf-8
> > > Cookie: PHPSESSID=793e2564f9581b193f6f732a9c075aba
> > >
> > > RESPONSE(1)
> > > HTTP/1.1 200 OK^M
> > > Date: Wed, 29 Mar 2000 04:28:24 GMT^M
> > > Server: Apache/1.3.12 Ben-SSL/1.39 (Unix) PHP/4.0RC1^M
> > > Set-Cookie: Apache=10.1.0.79.2063954304104677; path=/^M
> > > X-Powered-By: PHP/4.0RC1^M
> > > Expires: Thu, 19 Nov 1981 08:52:00 GMT^M
> > > Cache-Control: no-cache, post-check=0, pre-check=0^M
> > > Pragma: no-cache^M
> > > Connection: close^M
> > > Content-Type: text/html; charset=iso-8859-1^M
> > > ^M
> > > <html>
> > >
> > > NEW SESSION
> > > COUNT=1; times.<br>
> > > </html>
> >
> >
> > --
> > PHP 4.0 Beta Mailing List
> > <http://www.php.net/version4/>
> > To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> > For additional commands, e-mail: php4beta-help@lists.php.net
> > To contact the list administrators, e-mail: php4beta-admin@lists.php.net
> >
> >
>
> --------------------------------------------------
> Peter D. Kovacs KnowPost.com LLC
> Lead Engineer peter@knowpost.com
> --------------------------------------------------
Attachment: [application/octet-stream] perf-test.tgz
Attachment: [application/octet-stream] perf-test.tgz