in reply to Apache::Session problems under high load
my $loop=8; my $pm = Parallel::ForkManager->new($loop); my $url = "http://localhost/cgi-bin/session.pl"; my %sessionopts; # must contain same config as apache has my $sid; # get sessionID with initial request to session.pl # ... for (my $i = 0; $i < $loop; $i++) { $pm->start and next; my $wait = int((rand)*3000000); # pass loop number, random wait time and sessionID in to script my $content = "count=$i&wait=$wait&sid=$sid"; my $requrl = $url.'?'.$content; print "sending req $i [$requrl] at ".join(':',gettimeofday)."\n"; my $req = HTTP::Request->new('GET', $requrl); my $resp2 = $ua->request($req); $pm->finish; } sleep 10; # be sure last req has finished print "now what is in the session for [$sid]?\n"; my %session; tie %session, 'Apache::Session::Flex', $sid, { %sessionopts }; print "got session data: ".Dumper(\%session)."\n";
# ... # extract cgi args from query string # open session, either using Apache::SessionManager or Apache::Session + directly # ... usleep($wait); # wait for a few microseconds to simulate real server d +oing stuff $session->{'time'} = join('+',gettimeofday); $session->{'querystring'} = $query; $session->{'count'} = $count; my $now = time(); $session->{"$now:$count"} = $count; warn "got session ".Dumper($session);
now what is in the session for [8f13e7d0f1d140f6a1100510c1f82f6a]? got session data: $VAR1 = { 'count' => '6', '1098930095:0' => '0', 'time' => '1098930095+468658', '_session_start' => 1098930095, '1098930095:6' => '6', '1098930095:3' => '3', '_session_id' => '8f13e7d0f1d140f6a1100510c1f82f6a', 'current_uri' => '/cgi-bin/session.pl', 'querystring' => 'count=6&wait=173631&sid=8f13e7d0f1d140f6a1 +100510c1f8 2f6a', 'previous_uri' => '/cgi-bin/session.pl' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Apache::Session problems under high load
by perrin (Chancellor) on Oct 28, 2004 at 04:55 UTC | |
by xpatiate (Initiate) on Oct 28, 2004 at 05:58 UTC | |
by perrin (Chancellor) on Oct 28, 2004 at 19:02 UTC | |
by Anonymous Monk on Nov 01, 2004 at 08:16 UTC | |
by Anonymous Monk on Nov 02, 2004 at 15:24 UTC | |
by Anonymous Monk on Oct 28, 2004 at 08:36 UTC |