Changeset 526 for branches/reproxy-cache
- Timestamp:
- 08/18/06 22:38:22 (4 years ago)
- Location:
- branches/reproxy-cache/lib/Perlbal
- Files:
-
- 2 modified
-
ClientProxy.pm (modified) (3 diffs)
-
Service.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/reproxy-cache/lib/Perlbal/ClientProxy.pm
r523 r526 740 740 741 741 my $req_hd = $self->{req_headers}; 742 my $cache = $self->{service}->{reproxy_cache}; 742 my $svc = $self->{service}; 743 my $cache = $svc->{reproxy_cache}; 744 $svc->{_stat_requests}++; 743 745 744 746 my $requri = $req_hd->request_uri || ''; … … 753 755 return 0 if time() > $timeout; 754 756 757 $svc->{_stat_cache_hits}++; 755 758 my %headers = map { ref $_ eq 'SCALAR' ? $$_ : $_ } @{$headers || []}; 756 759 757 760 if (my $ims = $req_hd->header("If-Modified-Since")) { 758 761 my ($lm_key) = grep { uc($_) eq "LAST-MODIFIED" } keys %headers; 759 my $lm = $headers ->{$lm_key} || "";762 my $lm = $headers{$lm_key} || ""; 760 763 761 764 # remove the IE length suffix … … 765 768 if ($ims eq $lm) { 766 769 my $res_hd = Perlbal::HTTPHeaders->new_response(304); 770 $res_hd->header("Content-Length", "0"); 767 771 $self->tcp_cork(1); 768 772 $self->state('xfer_resp'); -
branches/reproxy-cache/lib/Perlbal/Service.pm
r525 r526 90 90 'error_retry_schedule', # string of comma-separated seconds (full or partial) to delay between retries 91 91 'latency', # int: milliseconds of latency to add to request 92 93 # stats: 94 '_stat_requests', # total requests to this service 95 '_stat_cache_hits', # total requests to this service that were served via the reproxy-url cache 92 96 ); 93 97 … … 1334 1338 1335 1339 $out->("SERVICE $self->{name}"); 1336 $out->(" listening: $self->{listen}");1340 $out->(" listening: " . ($self->{listen} || "--")); 1337 1341 $out->(" role: $self->{role}"); 1338 1342 if ($self->{role} eq "reverse_proxy" || … … 1348 1352 } 1349 1353 if ($self->{role} eq "reverse_proxy") { 1354 if ($self->{reproxy_cache}) { 1355 my $hits = $self->{_stat_cache_hits} || 0; 1356 my $hit_rate = sprintf("%0.02f%%", eval { $hits / ($self->{_stat_requests} || 0) * 100 } || 0); 1357 $out->(" cache hits: $hits"); 1358 $out->("cache hit rate: $hit_rate"); 1359 } 1360 1350 1361 my $bored_count = scalar @{$self->{bored_backends}}; 1351 1362 $out->(" connect-ahead: $bored_count/$self->{connect_ahead}");
